Changeset 1486 for pyamf/trunk
- Timestamp:
- 07/08/08 19:51:10 (6 months ago)
- Location:
- pyamf/trunk
- Files:
-
- 6 modified
-
CHANGES.txt (modified) (1 diff)
-
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)
Legend:
- Unmodified
- Added
- Removed
-
pyamf/trunk/CHANGES.txt
r1475 r1486 7 7 0.4.0 (unreleased) 8 8 ------------------ 9 - The remoting gateways now send a customizable Server header (Ticket:317)10 9 - The remoting client now sends a customizable User-Agent header (Ticket:306) 11 10 - Added ability to set the HTTP referer in remoting client (Ticket:316) -
pyamf/trunk/pyamf/remoting/gateway/__init__.py
r1477 r1486 8 8 """ 9 9 10 import platform11 10 import types 12 11 13 12 import pyamf 14 13 from pyamf import remoting, logging, util 15 16 #: Value for the Server response-header that contains17 #: information about the PyAMF and Python version used18 #: by the origin server to handle the request.19 SERVER_NAME = 'PyAMF/%s Python/%s' % (20 '.'.join(map(lambda x: str(x), pyamf.__version__)),21 platform.python_version()22 )23 14 24 15 fault_alias = pyamf.get_class_alias(remoting.ErrorFault) -
pyamf/trunk/pyamf/remoting/gateway/django.py
r1474 r1486 87 87 request = remoting.decode(http_request.raw_post_data, context) 88 88 except pyamf.DecodeError: 89 self.logger.e xception(gateway.format_exception())89 self.logger.error(gateway.format_exception()) 90 90 http_response.status_code = 400 91 91 … … 100 100 raise 101 101 except: 102 self.logger.e xception(gateway.format_exception())102 self.logger.error(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 xception(gateway.format_exception())112 self.logger.error(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_NAME120 119 http_response.write(buf) 121 120 -
pyamf/trunk/pyamf/remoting/gateway/google.py
r1474 r1486 60 60 def get(self): 61 61 self.response.headers['Content-Type'] = 'text/plain' 62 self.response.headers['Server'] = gateway.SERVER_NAME63 62 self.error(405) 64 63 self.response.out.write("405 Method Not Allowed\n\n" + \ … … 76 75 request = remoting.decode(body, context) 77 76 except pyamf.DecodeError: 78 self.logger.e xception(gateway.format_exception())77 self.logger.error(gateway.format_exception()) 79 78 80 79 response = "400 Bad Request\n\nThe request body was unable to " \ … … 86 85 self.error(400) 87 86 self.response.headers['Content-Type'] = 'text/plain' 88 self.response.headers['Server'] = gateway.SERVER_NAME89 87 self.response.out.write(response) 90 88 … … 99 97 raise 100 98 except: 101 self.logger.e xception(gateway.format_exception())99 self.logger.error(gateway.format_exception()) 102 100 103 101 response = "500 Internal Server Error\n\nThe request was " \ … … 109 107 self.error(500) 110 108 self.response.headers['Content-Type'] = 'text/plain' 111 self.response.headers['Server'] = gateway.SERVER_NAME112 109 self.response.out.write(response) 113 110 … … 120 117 stream = remoting.encode(response, context) 121 118 except pyamf.EncodeError: 122 self.logger.e xception(gateway.format_exception())119 self.logger.error(gateway.format_exception()) 123 120 124 121 response = "500 Internal Server Error\n\nThe request was " \ … … 130 127 self.error(500) 131 128 self.response.headers['Content-Type'] = 'text/plain' 132 self.response.headers['Server'] = gateway.SERVER_NAME133 129 self.response.out.write(response) 134 130 … … 139 135 self.response.headers['Content-Type'] = remoting.CONTENT_TYPE 140 136 self.response.headers['Content-Length'] = str(len(response)) 141 self.response.headers['Server'] = gateway.SERVER_NAME142 143 137 self.response.out.write(response) 144 138 -
pyamf/trunk/pyamf/remoting/gateway/twisted.py
r1474 r1486 69 69 70 70 def response_cb(result): 71 self.gateway.logger.debug("AMF Response: %r" % result) 71 72 response.body = result 72 73 self.gateway.logger.debug("AMF Response: %r" % response)74 73 deferred_response.callback(response) 75 74 … … 125 124 126 125 def response_cb(result): 127 126 self.gateway.logger.debug("AMF Response: %r" % result) 128 127 ro_response.body = result 129 res = remoting.Response(ro_response) 130 self.gateway.logger.debug("AMF Response: %r" % res) 131 132 deferred_response.callback(res) 128 deferred_response.callback(remoting.Response(ro_response)) 133 129 134 130 def process_cb(result): … … 199 195 request.setHeader("Content-Type", mimetype) 200 196 request.setHeader("Content-Length", str(len(content))) 201 request.setHeader("Server", gateway.SERVER_NAME)202 197 203 198 request.write(content) … … 215 210 Return HTTP 400 Bad Request. 216 211 """ 217 self.logger.e xception(failure.printDetailedTraceback())212 self.logger.error(failure.printDetailedTraceback()) 218 213 219 214 body = "400 Bad Request\n\nThe request body was unable to " \ -
pyamf/trunk/pyamf/remoting/gateway/wsgi.py
r1474 r1486 61 61 ('Content-Type', 'text/plain'), 62 62 ('Content-Length', str(len(response))), 63 ('Server', gateway.SERVER_NAME),64 63 ]) 65 64 … … 83 82 request = remoting.decode(body, context) 84 83 except pyamf.DecodeError: 85 self.logger.e xception(gateway.format_exception())84 self.logger.error(gateway.format_exception()) 86 85 87 86 response = "400 Bad Request\n\nThe request body was unable to " \ … … 94 93 ('Content-Type', 'text/plain'), 95 94 ('Content-Length', str(len(response))), 96 ('Server', gateway.SERVER_NAME),97 95 ]) 98 96 … … 107 105 raise 108 106 except: 109 self.logger.e xception(gateway.format_exception())107 self.logger.error(gateway.format_exception()) 110 108 111 109 response = "500 Internal Server Error\n\nThe request was " \ … … 118 116 ('Content-Type', 'text/plain'), 119 117 ('Content-Length', str(len(response))), 120 ('Server', gateway.SERVER_NAME),121 118 ]) 122 119 … … 129 126 stream = remoting.encode(response, context) 130 127 except pyamf.EncodeError: 131 self.logger.e xception(gateway.format_exception())128 self.logger.error(gateway.format_exception()) 132 129 133 130 response = "500 Internal Server Error\n\nThe request was " \ … … 140 137 ('Content-Type', 'text/plain'), 141 138 ('Content-Length', str(len(response))), 142 ('Server', gateway.SERVER_NAME),143 139 ]) 144 140 … … 150 146 ('Content-Type', remoting.CONTENT_TYPE), 151 147 ('Content-Length', str(len(response))), 152 ('Server', gateway.SERVER_NAME),153 148 ]) 154 149
