997 |
# client identifier (may be overridden) |
# client identifier (may be overridden) |
998 |
user_agent = "xmlrpclib.py/%s (by www.pythonware.com)" % __version__ |
user_agent = "xmlrpclib.py/%s (by www.pythonware.com)" % __version__ |
999 |
|
|
1000 |
|
#def __init__(self): |
1001 |
|
#import xmlrpclib |
1002 |
|
#self.phpsessionid = "" |
1003 |
|
|
1004 |
## |
## |
1005 |
# Send a complete request, and parse the response. |
# Send a complete request, and parse the response. |
1006 |
# |
# |
1019 |
|
|
1020 |
self.send_request(h, handler, request_body) |
self.send_request(h, handler, request_body) |
1021 |
self.send_host(h, host) |
self.send_host(h, host) |
1022 |
self.send_php_sessionid(h, host) |
self.send_php_sessionid(h) |
1023 |
self.send_user_agent(h) |
self.send_user_agent(h) |
1024 |
self.send_content(h, request_body) |
self.send_content(h, request_body) |
1025 |
|
|
|
#errcode, errmsg, headers = h.getreply() |
|
1026 |
response = h.getresponse() |
response = h.getresponse() |
1027 |
|
|
1028 |
if response.status != 200: |
if response.status != 200: |
1038 |
except AttributeError: |
except AttributeError: |
1039 |
sock = None |
sock = None |
1040 |
|
|
1041 |
self.phpsessionid = response.getheader('Set-Cookie') |
import __main__ |
1042 |
#print self.phpsessionid |
__main__.phpsessionid = response.getheader('Set-Cookie') |
1043 |
|
|
1044 |
#return self._parse_response(h.getfile(), sock) |
#return self._parse_response(h.getfile(), sock) |
1045 |
return self._parse_response(response, None) |
return self._parse_response(response, None) |
1062 |
def make_connection(self, host): |
def make_connection(self, host): |
1063 |
# create a HTTP connection object from a host descriptor |
# create a HTTP connection object from a host descriptor |
1064 |
import httplib |
import httplib |
|
#return httplib.HTTP(host) |
|
1065 |
return httplib.HTTPConnection(host) |
return httplib.HTTPConnection(host) |
1066 |
|
|
1067 |
## |
## |
1089 |
# @param connection Connection handle. |
# @param connection Connection handle. |
1090 |
# @param host Host name. |
# @param host Host name. |
1091 |
|
|
1092 |
def send_php_sessionid(self, connection, host): |
def send_php_sessionid(self, connection): |
1093 |
connection.putheader("PHPSESSID", host) |
import __main__ |
1094 |
#pass |
connection.putheader("Cookie", str(__main__.phpsessionid)) |
1095 |
|
|
1096 |
|
|
1097 |
## |
## |