aboutsummaryrefslogtreecommitdiff
path: root/src/Sproxy
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2016-11-24 23:15:45 +0300
committerIgor Pashev <pashev.igor@gmail.com>2016-11-24 23:15:45 +0300
commit808b6212cc2d90f2ea6dbeb25f9ae4cb292fc19a (patch)
tree6e5d46456b493012906fad98e1dc2808fe3bd2f4 /src/Sproxy
parent2ac9a861e47d17195bccb9c2a0d0c6e28dbc0316 (diff)
downloadsproxy2-808b6212cc2d90f2ea6dbeb25f9ae4cb292fc19a.tar.gz
Added comments on proxying
Diffstat (limited to 'src/Sproxy')
-rw-r--r--src/Sproxy/Application.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Sproxy/Application.hs b/src/Sproxy/Application.hs
index 8c3247c..18d547b 100644
--- a/src/Sproxy/Application.hs
+++ b/src/Sproxy/Application.hs
@@ -197,6 +197,9 @@ authorize db (authCookie, otherCookies) req = do
setCookies cs = insert hCookie (toByteString . renderCookies $ cs)
+-- XXX If something seems strange, think about HTTP/1.1 <-> HTTP/1.0.
+-- FIXME For HTTP/1.0 backends we might need an option
+-- FIXME in config file. HTTP Client does HTTP/1.1 by default.
forward :: BE.Manager -> W.Application
forward mgr req resp = do
let beReq = BE.defaultRequest
@@ -232,15 +235,20 @@ modifyRequestHeaders = filter (\(n, _) -> n `notElem` ban)
, hTransferEncoding -- XXX Likewise
]
+
modifyResponseHeaders :: ResponseHeaders -> ResponseHeaders
modifyResponseHeaders = filter (\(n, _) -> n `notElem` ban)
where
ban =
[
hConnection
- , hTransferEncoding -- XXX This is set automtically when sending respond from sproxy
+ -- XXX WAI docs say we MUST NOT add (keep) Content-Length, Content-Range, and Transfer-Encoding,
+ -- XXX but we use streaming body, which may add Transfer-Encoding only.
+ -- XXX Thus we keep Content-* headers.
+ , hTransferEncoding
]
+
authenticationRequired :: ByteString -> HashMap Text OAuth2Client -> W.Application
authenticationRequired key oa2 req resp = do
Log.info $ "511 Unauthenticated: " ++ showReq req