diff options
author | martin.von.loewis <devnull@localhost> | 2011-03-16 12:22:26 +0000 |
---|---|---|
committer | martin.von.loewis <devnull@localhost> | 2011-03-16 12:22:26 +0000 |
commit | 2ee4a03dfc3767162c9bf26506aca6885ca0c38a (patch) | |
tree | 9ea153bb92c751a69f48bb4a5eaadc891e519a3a /standalone.py | |
parent | b403c72e514f2e51d5f49a7351eed14a80f4a2b5 (diff) | |
download | decorator-2ee4a03dfc3767162c9bf26506aca6885ca0c38a.tar.gz |
Ignore authorization headers if we have a ssh user.
Diffstat (limited to 'standalone.py')
-rwxr-xr-x | standalone.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/standalone.py b/standalone.py index e38e527..61b838b 100755 --- a/standalone.py +++ b/standalone.py @@ -42,15 +42,18 @@ class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] - authorization = self.headers.getheader("authorization") + if self.ssh_user: + # ignore authorization headers if this is a SSH client + authorization = None + env['SSH_USER'] = self.ssh_user + else: + authorization = self.headers.getheader("authorization") if authorization: env['HTTP_CGI_AUTHORIZATION'] = authorization authorization = authorization.split() if len(authorization) == 2: import base64, binascii env['AUTH_TYPE'] = authorization[0] - if self.ssh_user: - env['SSH_USER'] = self.ssh_user if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: |