diff --git a/bin/service/http_server.py b/bin/service/http_server.py index fe3d98a0004..47ae6c35ae8 100644 --- a/bin/service/http_server.py +++ b/bin/service/http_server.py @@ -251,12 +251,11 @@ class OerpAuthProxy(AuthProxy): self.auth_tries = 0 self.last_auth = None - def checkRequest(self,handler,path = '/'): - if self.auth_creds: - return True + def checkRequest(self,handler,path, db=False): auth_str = handler.headers.get('Authorization',False) try: - db = handler.get_db_from_path(path) + if not db: + db = handler.get_db_from_path(path) print "Got db:",db except: if path.startswith('/'): @@ -267,8 +266,9 @@ class OerpAuthProxy(AuthProxy): else: #FIXME! self.provider.log("Wrong path: %s, failing auth" %path) - raise AuthRejectedExc("Authorization failed. Wrong sub-path.") - + raise AuthRejectedExc("Authorization failed. Wrong sub-path.") + if self.auth_creds.get(db): + return True if auth_str and auth_str.startswith('Basic '): auth_str=auth_str[len('Basic '):] (user,passwd) = base64.decodestring(auth_str).split(':') @@ -276,7 +276,7 @@ class OerpAuthProxy(AuthProxy): acd = self.provider.authenticate(db,user,passwd,handler.client_address) if acd != False: self.auth_creds[db] = acd - self.last_auth=db + self.last_auth = db return True if self.auth_tries > 5: self.provider.log("Failing authorization after 5 requests w/o password") diff --git a/bin/service/websrv_lib.py b/bin/service/websrv_lib.py index 354311eaa64..464c41ca356 100644 --- a/bin/service/websrv_lib.py +++ b/bin/service/websrv_lib.py @@ -234,6 +234,9 @@ class MultiHTTPHandler(FixSendError,BaseHTTPRequestHandler): if fore.close_connection: # print "Closing connection because of handler" self.close_connection = fore.close_connection + if hasattr(fore, '_flush'): + fore._flush() + def parse_rawline(self): """Parse a request (internal).