Skip to content

Instantly share code, notes, and snippets.

@clayg
Created September 23, 2016 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/80368d1aed6a512e962bc6ea07d54e0b to your computer and use it in GitHub Desktop.
Save clayg/80368d1aed6a512e962bc6ea07d54e0b to your computer and use it in GitHub Desktop.
client ends up with an empty response
diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py
index ea26129..f3025a3 100644
--- a/swift/common/wsgi.py
+++ b/swift/common/wsgi.py
@@ -420,6 +420,10 @@ class SwiftHttpProxiedProtocol(SwiftHttpProtocol):
See http://www.haproxy.org/download/1.7/doc/proxy-protocol.txt
"""
+ # set in case of error on the first line
+ self.command = None
+ self.request_version = self.default_request_version
+ self.close_connection = 1
if self.raw_requestline.startswith('PROXY'):
proxy_parts = self.raw_requestline.split()
if len(proxy_parts) >= 2 and proxy_parts[0] == 'PROXY':
Sep 23 00:46:48 ubuntu proxy-server: STDERR: (28592) accepted ('127.0.0.1', 39346)
Sep 23 00:46:48 ubuntu proxy-server: ERROR WSGI: code 400, message Missing required PROXY line
Sep 23 00:46:48 ubuntu proxy-server: STDERR: Traceback (most recent call last):
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/local/lib/python2.7/dist-packages/eventlet/greenpool.py", line 82, in _spawn_n_impl
Sep 23 00:46:48 ubuntu proxy-server: STDERR: func(*args, **kwargs)
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 719, in process_request
Sep 23 00:46:48 ubuntu proxy-server: STDERR: proto.__init__(sock, address, self)
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
Sep 23 00:46:48 ubuntu proxy-server: STDERR: self.handle()
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
Sep 23 00:46:48 ubuntu proxy-server: STDERR: self.handle_one_request()
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 351, in handle_one_request
Sep 23 00:46:48 ubuntu proxy-server: STDERR: if not self.parse_request():
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/vagrant/swift/swift/common/wsgi.py", line 439, in parse_request
Sep 23 00:46:48 ubuntu proxy-server: STDERR: self.send_error(400, 'Missing required PROXY line')
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/lib/python2.7/BaseHTTPServer.py", line 365, in send_error
Sep 23 00:46:48 ubuntu proxy-server: STDERR: self.send_response(code, message)
Sep 23 00:46:48 ubuntu proxy-server: STDERR: File "/usr/lib/python2.7/BaseHTTPServer.py", line 402, in send_response
Sep 23 00:46:48 ubuntu proxy-server: STDERR: if self.request_version != 'HTTP/0.9':
Sep 23 00:46:48 ubuntu proxy-server: STDERR: AttributeError: SwiftHttpProxiedProtocol instance has no attribute 'request_version'
Sep 23 00:48:56 ubuntu proxy-server: SIGTERM received
Sep 23 00:48:56 ubuntu proxy-server: SIGTERM received
Sep 23 00:48:56 ubuntu proxy-server: Removing dead child 28592
Sep 23 00:48:56 ubuntu proxy-server: Removing dead child 28591
Sep 23 00:48:56 ubuntu proxy-server: Exited
Sep 23 00:48:56 ubuntu proxy-server: Exited
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment