What steps will reproduce the problem?
1. Start proxy
2. Make an HTTP PUT or DELETE request through proxy
What is the expected output? What do you see instead?
Expected proxying as with POST. Got the following error:
2014-02-13T22:51:51.793047+00:00 app[web.1]: Traceback (most recent call last):
2014-02-13T22:51:51.793047+00:00 app[web.1]: File
"/usr/local/lib/python2.7/SocketServer.py", line 582, in process_request_thread
2014-02-13T22:51:51.793047+00:00 app[web.1]: self.finish_request(request,
client_address)
2014-02-13T22:51:51.793047+00:00 app[web.1]: File
"/usr/local/lib/python2.7/SocketServer.py", line 323, in finish_request
2014-02-13T22:51:51.793047+00:00 app[web.1]:
self.RequestHandlerClass(request, client_address, self)
2014-02-13T22:51:51.793047+00:00 app[web.1]: File "/app/proxpy/core.py", line
54, in __init__
2014-02-13T22:51:51.793047+00:00 app[web.1]:
SocketServer.StreamRequestHandler.__init__(self, request, client_address,
server)
2014-02-13T22:51:51.794594+00:00 app[web.1]: File
"/usr/local/lib/python2.7/SocketServer.py", line 639, in __init__
2014-02-13T22:51:51.794671+00:00 app[web.1]: self.handle()
2014-02-13T22:51:51.794671+00:00 app[web.1]: File "/app/proxpy/core.py", line
128, in handle
2014-02-13T22:51:51.794671+00:00 app[web.1]: if req.getMethod() ==
HTTPRequest.METHOD_GET:
2014-02-13T22:51:51.794671+00:00 app[web.1]: File "/app/proxpy/http.py", line
272, in getMethod
2014-02-13T22:51:51.794671+00:00 app[web.1]: return r
2014-02-13T22:51:51.794671+00:00 app[web.1]: UnboundLocalError: local variable
'r' referenced before assignment
The error occurs because `getMethod` does not account for these HTTP verbs
(presumably because PUT and DELETE need more code):
def getMethod(self):
m = self.method.lower()
if m == "get": r = HTTPRequest.METHOD_GET
elif m == "post": r = HTTPRequest.METHOD_POST
elif m == "head": r = HTTPRequest.METHOD_HEAD
elif m == "options": r = HTTPRequest.METHOD_OPTIONS
elif m == "connect": r = HTTPRequest.METHOD_CONNECT
elif m == "unknown": r = HTTPRequest.METHOD_UNKNOWN
return r
What version of the product are you using? On what operating system?
r29 on Ubuntu 10.04, with Python 2.7.2
Original issue reported on code.google.com by mac...@heroku.com on 14 Feb 2014 at 12:24
Original issue reported on code.google.com by
mac...@heroku.com
on 14 Feb 2014 at 12:24