M
michaelparkin
Hi,
Sorry to post what might seem like a trivial problem here, but its
driving me mad!
I have a simple https client that uses httplib to post data to a web
server.
When I post over http & https using curl the data is recieved by the
web server with no problems.
When I post using my python client the headers get there, but the body
of the message does not.
My code is pretty standard and has the format:
httplib.HTTPSConnection.debuglevel = 1
connection = httplib.HTTPSConnection(host_name, key_file = key,
cert_file = cert)
connection.putrequest("POST", path)
connection.putheader("Content-Length", str(len(body)))
....(some more headers)...
connection.endheaders()
connection.send(body)
response = connection.getresponse()
connection.close()
(some code has been removed for clarity)..
I can see in the debug messages the body getting sent, but nothing
arrives at
the server...
I think I would understand whats going on better if I knew how Python
uses the
underlying socket - does it
a) open the socket, send the header & body together or
b) send the header, wait, then send the body?
I think the answer to this question solve my problem - can anyone help?
Thanks.
p.s. I'm using Python 2.3.3 [GCC 3.3.3 (SuseLinx)]
Sorry to post what might seem like a trivial problem here, but its
driving me mad!
I have a simple https client that uses httplib to post data to a web
server.
When I post over http & https using curl the data is recieved by the
web server with no problems.
When I post using my python client the headers get there, but the body
of the message does not.
My code is pretty standard and has the format:
httplib.HTTPSConnection.debuglevel = 1
connection = httplib.HTTPSConnection(host_name, key_file = key,
cert_file = cert)
connection.putrequest("POST", path)
connection.putheader("Content-Length", str(len(body)))
....(some more headers)...
connection.endheaders()
connection.send(body)
response = connection.getresponse()
connection.close()
(some code has been removed for clarity)..
I can see in the debug messages the body getting sent, but nothing
arrives at
the server...
I think I would understand whats going on better if I knew how Python
uses the
underlying socket - does it
a) open the socket, send the header & body together or
b) send the header, wait, then send the body?
I think the answer to this question solve my problem - can anyone help?
Thanks.
p.s. I'm using Python 2.3.3 [GCC 3.3.3 (SuseLinx)]