def on_request_head(self, request_message): user_agent_header = request_message.get_header("user-agent") if user_agent_header and len(user_agent_header.values) > 0: # If there is a user-agent value then print it out and pass # the request upstream print(user_agent_header.values[0]) return filtering.next() else: # If there is no user-agent, then reject the request return filtering.reject()
def on_request_head(self, request_message): user_agent_header = request_message.get_header('user-agent') if user_agent_header and len(user_agent_header.values) > 0: # If there is a user-agent value then print it out and pass # the request upstream print(user_agent_header.values[0]) return filtering.next() else: # If there is no user-agent, then reject the request return filtering.reject()
def on_request_head(self, request_head): tenant_header = request_head.get_header(AUTH_TENANT_ID) token_header = request_head.get_header(X_AUTH_TOKEN) if _header_is_set(tenant_header) and _header_is_set(token_header): try: auth_result = self.client.authenticate( token=token_header.values[0], tenant_id=tenant_header.values[0]) if auth_result is not False: return filtering.next() except Exception as ex: _LOG.exception(ex) return filtering.reject()
def on_request_head(self, request_head): token_header = request_head.get_header(X_AUTH_TOKEN) if token_header and len(token_header.values) >= 1: match = self.id_regex.match(request_head.url) if match and len(match.groups()) >= 1: tenant_id = match.group(1) try: auth_result = self.client.authenticate( token=token_header.values[0], tenant_id=tenant_id) if auth_result: return filtering.next() except Exception as ex: _LOG.exception(ex) return filtering.reject()
def on_response_body_no_request(self, msg_part, body): return filtering.next()
def on_response_head_no_request(self, head): return filtering.next()
def on_response_body_with_request(self, msg_part, body, req): global request, on_body_got_request assert req == request on_body_got_request = True return filtering.next()
def on_response_head_with_request(self, response, req): global request, on_head_got_request assert req == request on_head_got_request = True return filtering.next()