I am making a streaming POST request with around 12MB of body data. Once this request is complete, I intend to send another POST request on the same TCP connection. However, I do not see it happening on the same TCP connection. It takes place on an another TCP connection(as per Wireshark). As per my understanding from here and here, that should not be the case. Here is the snippet:
# First POST request without Auth info
with open(file) as f:
r = requests.post(url, data=f, headers=h)
# Second POST request with Auth info
r = requests.post(url, headers=h)
I then tried using a session object, however, in this case I am not seeing the second POST request on the Wireshark (as a second POST method). It is actually getting appended in the end of the first streaming POST data:
# First POST request without Auth info
s = requests.session()
with open(file) as f:
r = s.post(url, data=f, headers=h)
# Second POST request with Auth info
r = s.post(url, headers=h)
SPBWZKSCM3RJQAKKC0B7UQ1DIRDWHPBXDYMTUPODQ4TFAFPZTQFMY6Q2SIY6ZET8W6BD4889Z69WMO7UIKQOZB22BOBQ1TH2EUUOOSQJA8B0Y***POST / HTTP/1.1 Content-Length:***
So, I have following questions:
- why the first case does not work?
- in the second case, why POST is getting appended to the previous streaming POST?
Thanks.