on master help sign in
Set serverName and port even if HTTP/1.0 is used.
6f8fa02Kazu Yamamoto
Network/Wai/Handler/Warp.hs+6−4
@@ -207,12 +207,14 @@ parseRequest' :: Port
207parseRequest' _ [] _ = E.throwError $ NotEnoughLines []
207parseRequest' _ [] _ = E.throwError $ NotEnoughLines []
208parseRequest' port (firstLine:otherLines) remoteHost' = do
208parseRequest' port (firstLine:otherLines) remoteHost' = do
209 (method, rpath', gets, httpversion) <- parseFirst firstLine
209 (method, rpath', gets, httpversion) <- parseFirst firstLine
210− let rpath =
210+ let (host',rpath) =
211 if S.null rpath'
211 if S.null rpath'
212− then "/"
212+ then ("","/")
213− else rpath'
213+ else if "http://" `S.isPrefixOf` rpath'
214+ then S.break (47==) $ S.drop 7 rpath' -- '/'
215+ else ("", rpath')
214 let heads = map parseHeaderNoAttr otherLines
216 let heads = map parseHeaderNoAttr otherLines
215− let host = fromMaybe "" $ lookup "host" heads
217+ let host = fromMaybe host' $ lookup "host" heads
216 let len =
218 let len =
217 case lookup "content-length" heads of
219 case lookup "content-length" heads of
218 Nothing -> 0
220 Nothing -> 0