I'm using python 2.6 to create a HTTPS client that can POST XML data. So far it is able to POST to a HTTP server I also wrote. The issue is that when I try to return the status and reason from the response, it isn't correct.
The HTTPS server should return an empty response with a HTTP 202 status. When I use curl to POST to it, it properly returns what I expect. The HTTPS python client gets back a HTTP 200 and a empty reason. It is as if the response object I'm parsing isn't correct or hasn't been created from the correct request.
import httplib
def https_client(client_host, client_port, client_key, client_cert, xml_file, client_path)
headers = {"Content-type" : "application/xml"}
http_post = httplib.HTTPSConnection(client_host, client_port, client_key, client_cert)
http_post.request("POST", "/" + client_path, xml_file, headers)
response1 = http_post.getresponse()
print response1.status, response1.reason
The console returns:
200
The server is getting the POST and like I mentioned before I can get a 202 status and Accepted reason back when using curl. I've seen something about read the response and/or closing the connection, but I've not found an example of needing to do that.