Skip to content

Commit

Permalink
Header case sensitivity and status code (#88)
Browse files Browse the repository at this point in the history
* headers are case-insensitive (some servers use lowercase only)

* forward to the client the status code received from the proxied server
  • Loading branch information
David Caron authored and cehbrecht committed Sep 19, 2019
1 parent 071f38c commit 8fbe0c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions twitcher/owsproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ def _send_request(request, service, extra_path=None, request_params=None):
return OWSAccessFailed("Request failed: {}".format(e))

# Headers meaningful only for a single transport-level connection
hop_by_hop = ['Connection', 'Keep-Alive', 'Public', 'Proxy-Authenticate', 'Transfer-Encoding', 'Upgrade']
hop_by_hop = ['connection', 'keep-alive', 'public', 'proxy-authenticate', 'transfer-encoding', 'upgrade']
return Response(app_iter=BufferedResponse(resp_iter),
headers={k: v for k, v in list(resp_iter.headers.items()) if k not in hop_by_hop})
headers={k: v for k, v in list(resp_iter.headers.items()) if k.lower() not in hop_by_hop},
status_code=resp_iter.status_code)
else:
try:
resp = requests.request(method=request.method.upper(), url=url, data=request.body, headers=h,
Expand Down

0 comments on commit 8fbe0c8

Please sign in to comment.