Changeset 1499
- Timestamp:
- 07/09/08 15:01:56 (4 months ago)
- Location:
- pyamf/trunk
- Files:
-
- 8 modified
-
CHANGES.txt (modified) (1 diff)
-
pyamf/remoting/client/__init__.py (modified) (3 diffs)
-
pyamf/remoting/gateway/__init__.py (modified) (1 diff)
-
pyamf/remoting/gateway/django.py (modified) (4 diffs)
-
pyamf/remoting/gateway/google.py (modified) (8 diffs)
-
pyamf/remoting/gateway/twisted.py (modified) (4 diffs)
-
pyamf/remoting/gateway/wsgi.py (modified) (8 diffs)
-
setup.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pyamf/trunk/CHANGES.txt
r1486 r1499 7 7 0.4.0 (unreleased) 8 8 ------------------ 9 - The remoting gateways now send a customizable Server header (Ticket:317) 9 10 - The remoting client now sends a customizable User-Agent header (Ticket:306) 10 11 - Added ability to set the HTTP referer in remoting client (Ticket:316) -
pyamf/trunk/pyamf/remoting/client/__init__.py
r1477 r1499 397 397 self.logger.debug('Waiting for response...') 398 398 http_response = self.connection.getresponse() 399 self.logger.debug('Got response status =%s' % http_response.status)400 self.logger.debug('Content-Type =%s' % http_response.getheader('Content-Type'))399 self.logger.debug('Got response status: %s' % http_response.status) 400 self.logger.debug('Content-Type: %s' % http_response.getheader('Content-Type')) 401 401 402 402 if http_response.status != HTTP_OK: 403 self.logger.debug('Body =%s' % http_response.read())403 self.logger.debug('Body: %s' % http_response.read()) 404 404 405 405 if hasattr(httplib, 'responses'): … … 420 420 bytes = '' 421 421 422 self.logger.debug('Content-Length = %s' % content_length) 423 422 self.logger.debug('Content-Length: %s' % content_length) 423 self.logger.debug('Server: %s' % http_response.getheader('Server')) 424 424 425 if content_length is None: 425 426 bytes = http_response.read() … … 430 431 431 432 response = remoting.decode(bytes) 432 self.logger.debug('Response =%s' % response)433 self.logger.debug('Response: %s' % response) 433 434 434 435 if remoting.APPEND_TO_GATEWAY_URL in response.headers: -
pyamf/trunk/pyamf/remoting/gateway/__init__.py
r1486 r1499 8 8 """ 9 9 10 import types10 import sys, types 11 11 12 12 import pyamf 13 13 from pyamf import remoting, logging, util 14 15 SERVER_NAME = 'PyAMF/%s Python/%s' % ( 16 '.'.join(map(lambda x: str(x), pyamf.__version__)), 17 '.'.join(map(lambda x: str(x), sys.version_info[0:3])) 18 ) 14 19 15 20 fault_alias = pyamf.get_class_alias(remoting.ErrorFault) -
pyamf/trunk/pyamf/remoting/gateway/django.py
r1486 r1499 87 87 request = remoting.decode(http_request.raw_post_data, context) 88 88 except pyamf.DecodeError: 89 self.logger.e rror(gateway.format_exception())89 self.logger.exception(gateway.format_exception()) 90 90 http_response.status_code = 400 91 91 … … 100 100 raise 101 101 except: 102 self.logger.e rror(gateway.format_exception())102 self.logger.exception(gateway.format_exception()) 103 103 104 104 return http.HttpResponseServerError() … … 110 110 stream = remoting.encode(response, context) 111 111 except pyamf.EncodeError: 112 self.logger.e rror(gateway.format_exception())112 self.logger.exception(gateway.format_exception()) 113 113 114 114 return http.HttpResponseServerError('Unable to encode the response') … … 117 117 http_response['Content-Type'] = remoting.CONTENT_TYPE 118 118 http_response['Content-Length'] = str(len(buf)) 119 http_response['Server'] = gateway.SERVER_NAME 119 120 http_response.write(buf) 120 121 -
pyamf/trunk/pyamf/remoting/gateway/google.py
r1486 r1499 60 60 def get(self): 61 61 self.response.headers['Content-Type'] = 'text/plain' 62 self.response.headers['Server'] = gateway.SERVER_NAME 62 63 self.error(405) 63 64 self.response.out.write("405 Method Not Allowed\n\n" + \ … … 75 76 request = remoting.decode(body, context) 76 77 except pyamf.DecodeError: 77 self.logger.e rror(gateway.format_exception())78 self.logger.exception(gateway.format_exception()) 78 79 79 80 response = "400 Bad Request\n\nThe request body was unable to " \ … … 85 86 self.error(400) 86 87 self.response.headers['Content-Type'] = 'text/plain' 88 self.response.headers['Server'] = gateway.SERVER_NAME 87 89 self.response.out.write(response) 88 90 … … 97 99 raise 98 100 except: 99 self.logger.e rror(gateway.format_exception())101 self.logger.exception(gateway.format_exception()) 100 102 101 103 response = "500 Internal Server Error\n\nThe request was " \ … … 107 109 self.error(500) 108 110 self.response.headers['Content-Type'] = 'text/plain' 111 self.response.headers['Server'] = gateway.SERVER_NAME 109 112 self.response.out.write(response) 110 113 … … 117 120 stream = remoting.encode(response, context) 118 121 except pyamf.EncodeError: 119 self.logger.e rror(gateway.format_exception())122 self.logger.exception(gateway.format_exception()) 120 123 121 124 response = "500 Internal Server Error\n\nThe request was " \ … … 127 130 self.error(500) 128 131 self.response.headers['Content-Type'] = 'text/plain' 132 self.response.headers['Server'] = gateway.SERVER_NAME 129 133 self.response.out.write(response) 130 134 … … 135 139 self.response.headers['Content-Type'] = remoting.CONTENT_TYPE 136 140 self.response.headers['Content-Length'] = str(len(response)) 141 self.response.headers['Server'] = gateway.SERVER_NAME 142 137 143 self.response.out.write(response) 138 144 -
pyamf/trunk/pyamf/remoting/gateway/twisted.py
r1486 r1499 69 69 70 70 def response_cb(result): 71 self.gateway.logger.debug("AMF Response: %r" % result)72 71 response.body = result 72 73 self.gateway.logger.debug("AMF Response: %r" % response) 73 74 deferred_response.callback(response) 74 75 … … 124 125 125 126 def response_cb(result): 126 self.gateway.logger.debug("AMF Response: %r" % result)127 127 128 ro_response.body = result 128 deferred_response.callback(remoting.Response(ro_response)) 129 res = remoting.Response(ro_response) 130 self.gateway.logger.debug("AMF Response: %r" % res) 131 132 deferred_response.callback(res) 129 133 130 134 def process_cb(result): … … 195 199 request.setHeader("Content-Type", mimetype) 196 200 request.setHeader("Content-Length", str(len(content))) 201 request.setHeader("Server", gateway.SERVER_NAME) 197 202 198 203 request.write(content) … … 210 215 Return HTTP 400 Bad Request. 211 216 """ 212 self.logger.e rror(failure.printDetailedTraceback())217 self.logger.exception(failure.printDetailedTraceback()) 213 218 214 219 body = "400 Bad Request\n\nThe request body was unable to " \ -
pyamf/trunk/pyamf/remoting/gateway/wsgi.py
r1486 r1499 61 61 ('Content-Type', 'text/plain'), 62 62 ('Content-Length', str(len(response))), 63 ('Server', gateway.SERVER_NAME), 63 64 ]) 64 65 … … 82 83 request = remoting.decode(body, context) 83 84 except pyamf.DecodeError: 84 self.logger.e rror(gateway.format_exception())85 self.logger.exception(gateway.format_exception()) 85 86 86 87 response = "400 Bad Request\n\nThe request body was unable to " \ … … 93 94 ('Content-Type', 'text/plain'), 94 95 ('Content-Length', str(len(response))), 96 ('Server', gateway.SERVER_NAME), 95 97 ]) 96 98 … … 105 107 raise 106 108 except: 107 self.logger.e rror(gateway.format_exception())109 self.logger.exception(gateway.format_exception()) 108 110 109 111 response = "500 Internal Server Error\n\nThe request was " \ … … 116 118 ('Content-Type', 'text/plain'), 117 119 ('Content-Length', str(len(response))), 120 ('Server', gateway.SERVER_NAME), 118 121 ]) 119 122 … … 126 129 stream = remoting.encode(response, context) 127 130 except pyamf.EncodeError: 128 self.logger.e rror(gateway.format_exception())131 self.logger.exception(gateway.format_exception()) 129 132 130 133 response = "500 Internal Server Error\n\nThe request was " \ … … 137 140 ('Content-Type', 'text/plain'), 138 141 ('Content-Length', str(len(response))), 142 ('Server', gateway.SERVER_NAME), 139 143 ]) 140 144 … … 146 150 ('Content-Type', remoting.CONTENT_TYPE), 147 151 ('Content-Length', str(len(response))), 152 ('Server', gateway.SERVER_NAME), 148 153 ]) 149 154 -
pyamf/trunk/setup.py
r1350 r1499 20 20 21 21 def run_tests(self): 22 import logging 23 logging.basicConfig(level=logging.CRITICAL) 22 24 try: 23 25 import twisted
