on master help sign in
Merge pull request #698 from ChickenProp/log-real-requests
89f81ceMichael Snoyman
warp/ChangeLog.md+5
@@ -1,3 +1,8 @@
1+## 3.2.23
2+
3+* Log real requsts when an app throws an error.
4+ [#698](https://github.com/yesodweb/wai/pull/698)
5+
1## 3.2.22
6## 3.2.22
2
7
3* Fixing large request body in HTTP/2.
8* Fixing large request body in HTTP/2.
warp/Network/Wai/Handler/Warp/Run.hs+5−5
@@ -339,8 +339,9 @@ serveConnection conn ii1 origAddr transport settings app = do
339 -- https://github.com/yesodweb/wai/issues/618
339 -- https://github.com/yesodweb/wai/issues/618
340 Just NoKeepAliveRequest -> return ()
340 Just NoKeepAliveRequest -> return ()
341 Nothing -> do
341 Nothing -> do
342− sendErrorResponse addr istatus e
342+ sendErrorResponse (dummyreq addr) istatus e
343 throwIO e
343 throwIO e
344+
344 where
345 where
345 getProxyProtocolAddr src =
346 getProxyProtocolAddr src =
346 case settingsProxyProtocol settings of
347 case settingsProxyProtocol settings of
@@ -388,12 +389,11 @@ serveConnection conn ii1 origAddr transport settings app = do
388 | Just ConnectionClosedByPeer <- fromException se = False
389 | Just ConnectionClosedByPeer <- fromException se = False
389 | otherwise = True
390 | otherwise = True
390
391
391− sendErrorResponse addr istatus e = do
392+ sendErrorResponse req istatus e = do
392 status <- readIORef istatus
393 status <- readIORef istatus
393 when (shouldSendErrorResponse e && status) $ do
394 when (shouldSendErrorResponse e && status) $ do
394 let ii = toInternalInfo ii1 0 -- dummy
395 let ii = toInternalInfo ii1 0 -- dummy
395− dreq = dummyreq addr
396− void $ sendResponse settings conn ii dreq defaultIndexRequestHeader (return S.empty) (errorResponse e)
396+ void $ sendResponse settings conn ii req defaultIndexRequestHeader (return S.empty) (errorResponse e)
397
397
398 dummyreq addr = defaultRequest { remoteHost = addr }
398 dummyreq addr = defaultRequest { remoteHost = addr }
399
399
@@ -405,7 +405,7 @@ serveConnection conn ii1 origAddr transport settings app = do
405 keepAlive <- processRequest istatus src req mremainingRef idxhdr nextBodyFlush ii
405 keepAlive <- processRequest istatus src req mremainingRef idxhdr nextBodyFlush ii
406 `E.catch` \e -> do
406 `E.catch` \e -> do
407 -- Call the user-supplied exception handlers, passing the request.
407 -- Call the user-supplied exception handlers, passing the request.
408− sendErrorResponse addr istatus e
408+ sendErrorResponse req istatus e
409 settingsOnException settings (Just req) e
409 settingsOnException settings (Just req) e
410 -- Don't throw the error again to prevent calling settingsOnException twice.
410 -- Don't throw the error again to prevent calling settingsOnException twice.
411 return False
411 return False
warp/warp.cabal+1−1
@@ -1,5 +1,5 @@
1Name: warp
1Name: warp
2−Version: 3.2.22
2+Version: 3.2.23
3Synopsis: A fast, light-weight web server for WAI applications.
3Synopsis: A fast, light-weight web server for WAI applications.
4License: MIT
4License: MIT
5License-file: LICENSE
5License-file: LICENSE