on master help sign in
requestBodyLength yesodweb/yesod#468
commit613242a461036d1b148835ec80ea6c7305b010f4 authorMichael Snoyman <michael@snoyman.com> dateMon 18 Feb 2013, 12:20 (14 years ago) parente13c50a
17 files changed+51−28
wai-app-static/wai-app-static.cabal+2−2 wai-eventsource/wai-eventsource.cabal+2−2 wai-extra/Network/Wai/Handler/CGI.hs+4 wai-extra/wai-extra.cabal+2−2 wai-frontend-monadcgi/wai-frontend-monadcgi.cabal+2−2 wai-handler-devel/wai-handler-devel.cabal+2−2 wai-handler-fastcgi/wai-handler-fastcgi.cabal+2−2 wai-handler-launch/wai-handler-launch.cabal+2−2 wai-handler-scgi/wai-handler-scgi.cabal+2−2 wai-handler-webkit/wai-handler-webkit.cabal+3−3 wai-test/wai-test.cabal+2−2 wai-websockets/wai-websockets.cabal+2−2 wai/Network/Wai.hs+12 wai/wai.cabal+1−1 warp-tls/warp-tls.cabal+1−1 warp/Network/Wai/Handler/Warp/Request.hs+7 warp/warp.cabal+3−3
wai-app-static/wai-app-static.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-app-static
2−version: 1.3.1.1
2+version: 1.3.1.2
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -24,7 +24,7 @@ Flag print
2424
2525library
2626 build-depends: base >= 4 && < 5
27− , wai >= 1.3 && < 1.4
27+ , wai >= 1.3 && < 1.5
2828 , bytestring >= 0.9.1.4
2929 , http-types >= 0.7
3030 , transformers >= 0.2.2
wai-eventsource/wai-eventsource.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai-eventsource
2−Version: 1.3.0.3
2+Version: 1.3.0.4
33Synopsis: WAI support for server-sent events
44Description: WAI support for server-sent events
55License: MIT
@@ -19,7 +19,7 @@ Library
1919 , blaze-builder >= 0.3 && < 0.4
2020 , conduit >= 0.5 && < 1.1
2121 , http-types >= 0.7
22− , wai >= 1.3 && < 1.4
22+ , wai >= 1.3 && < 1.5
2323 , warp >= 1.3 && < 1.4
2424 , transformers
2525
wai-extra/Network/Wai/Handler/CGI.hs+4
@@ -1,5 +1,6 @@
11{-# LANGUAGE OverloadedStrings #-}
22{-# LANGUAGE RankNTypes #-}
3+{-# LANGUAGE CPP #-}
34-- | Backend for Common Gateway Interface. Almost all users should use the
45-- 'run' function.
56module Network.Wai.Handler.CGI
@@ -109,6 +110,9 @@ runGeneric vars inputH outputH xsendfile app = do
109110 , httpVersion = H.http11 -- FIXME
110111 , requestBody = inputH contentLength
111112 , vault = mempty
113+#if MIN_VERSION_wai(1, 4, 0)
114+ , requestBodyLength = KnownLength $ fromIntegral contentLength
115+#endif
112116 }
113117 -- FIXME worry about exception?
114118 res <- app env
wai-extra/wai-extra.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai-extra
2−Version: 1.3.2.3
2+Version: 1.3.2.4
33Synopsis: Provides some basic WAI handlers and middleware.
44Description: The goal here is to provide common features without many dependencies.
55License: MIT
@@ -22,7 +22,7 @@ extra-source-files:
2222Library
2323 Build-Depends: base >= 4 && < 5
2424 , bytestring >= 0.9.1.4
25− , wai >= 1.3 && < 1.4
25+ , wai >= 1.3 && < 1.5
2626 , old-locale >= 1.0.0.2 && < 1.1
2727 , time >= 1.1.4
2828 , network >= 2.2.1.5
wai-frontend-monadcgi/wai-frontend-monadcgi.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-frontend-monadcgi
2−version: 1.3.0.1
2+version: 1.3.0.2
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -20,7 +20,7 @@ library
2020 , http-types
2121 , transformers
2222 , case-insensitive
23− , wai >= 1.3 && < 1.4
23+ , wai >= 1.3 && < 1.5
2424 exposed-modules: Network.Wai.Frontend.MonadCGI
2525 ghc-options: -Wall
2626
wai-handler-devel/wai-handler-devel.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai-handler-devel
2−Version: 1.3.0.4
2+Version: 1.3.0.5
33Synopsis: WAI server that automatically reloads code after modification.
44Description: This handler automatically reloads your source code upon any changes. It works by using the hint package, essentially embedding GHC inside the handler. The handler (both the executable and library) takes three arguments: the port to listen on, the module name containing the application function, and the name of the function.
55 .
@@ -22,7 +22,7 @@ Source-repository head
2222
2323Library
2424 Build-Depends: base >= 4 && < 5
25− , wai >= 1.3 && < 1.4
25+ , wai >= 1.3 && < 1.5
2626 , wai-extra >= 1.3 && < 1.4
2727 , http-types >= 0.7
2828 , warp >= 1.3 && < 1.4
wai-handler-fastcgi/wai-handler-fastcgi.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-handler-fastcgi
2−version: 1.3.0.1
2+version: 1.3.0.2
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -15,7 +15,7 @@ description: Calls out to the libfcgi C library.
1515
1616library
1717 build-depends: base >= 4 && < 5
18− , wai >= 1.3 && < 1.4
18+ , wai >= 1.3 && < 1.5
1919 , wai-extra >= 1.3 && < 1.4
2020 , bytestring >= 0.9.1.4
2121 exposed-modules: Network.Wai.Handler.FastCGI
wai-handler-launch/wai-handler-launch.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai-handler-launch
2−Version: 1.3.1.3
2+Version: 1.3.1.4
33Synopsis: Launch a web app in the default browser.
44Description: This handles cross-platform launching and inserts Javascript code to ping the server. When the server no longer receives pings, it shuts down.
55License: MIT
@@ -13,7 +13,7 @@ Cabal-version: >=1.6
1313Library
1414 Exposed-modules: Network.Wai.Handler.Launch
1515 build-depends: base >= 4 && < 5
16− , wai >= 1.3 && < 1.4
16+ , wai >= 1.3 && < 1.5
1717 , warp >= 1.3 && < 1.4
1818 , http-types >= 0.7
1919 , transformers >= 0.2.2 && < 0.4
wai-handler-scgi/wai-handler-scgi.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-handler-scgi
2−version: 1.3.0.1
2+version: 1.3.0.2
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -14,7 +14,7 @@ description: Wai handler to SCGI
1414
1515library
1616 build-depends: base >= 4 && < 5
17− , wai >= 1.3 && < 1.4
17+ , wai >= 1.3 && < 1.5
1818 , wai-extra >= 1.3 && < 1.4
1919 , bytestring >= 0.9.1.4
2020 exposed-modules: Network.Wai.Handler.SCGI
wai-handler-webkit/wai-handler-webkit.cabal+3−3
@@ -1,5 +1,5 @@
11name: wai-handler-webkit
2−version: 1.3.0
2+version: 1.3.0.1
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -16,8 +16,8 @@ homepage: http://www.yesodweb.com/book/web-application-interface
1616
1717library
1818 build-depends: base >= 4 && < 5
19− , wai >= 1.3 && < 1.4
20− , warp >= 1.3 && < 1.4
19+ , wai >= 1.3 && < 1.5
20+ , warp >= 1.3 && < 1.5
2121 ghc-options: -Wall
2222 exposed-modules: Network.Wai.Handler.Webkit
2323 c-sources: webkit.cpp
wai-test/wai-test.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-test
2−version: 1.3.0.2
2+version: 1.3.0.3
33license: MIT
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -14,7 +14,7 @@ description: Unit test framework (built on HUnit) for WAI applications.
1414
1515library
1616 build-depends: base >= 4 && < 5
17− , wai >= 1.3 && < 1.4
17+ , wai >= 1.3 && < 1.5
1818 , bytestring >= 0.9.1.4
1919 , text >= 0.7 && < 0.12
2020 , blaze-builder >= 0.2.1.4 && < 0.4
wai-websockets/wai-websockets.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai-websockets
2−Version: 1.3.1.1
2+Version: 1.3.1.2
33Synopsis: Provide a bridge betweeen WAI and the websockets package.
44License: MIT
55License-file: LICENSE
@@ -20,7 +20,7 @@ Library
2020 Build-Depends: base >= 3 && < 5
2121 , bytestring >= 0.9.1.4
2222 , conduit >= 0.5 && < 1.1
23− , wai >= 1.3 && < 1.4
23+ , wai >= 1.3 && < 1.5
2424 , enumerator >= 0.4.8 && < 0.5
2525 , network-enumerator >= 0.1.2 && < 0.2
2626 , blaze-builder >= 0.2.1.4 && < 0.4
wai/Network/Wai.hs+12
@@ -43,6 +43,7 @@ module Network.Wai
4343 , Application
4444 , Middleware
4545 , FilePart (..)
46+ , RequestBodyLength (..)
4647 -- * Response body smart constructors
4748 , responseLBS
4849 , responseStatus
@@ -61,6 +62,7 @@ import Data.Text (Text)
6162import Data.ByteString.Lazy.Char8 () -- makes it easier to use responseLBS
6263import Blaze.ByteString.Builder (fromByteString)
6364import Data.Vault (Vault)
65+import Data.Word (Word64)
6466
6567-- | Information on the request sent by the client. This abstracts away the
6668-- details of the underlying implementation.
@@ -98,6 +100,10 @@ data Request = Request
98100 , requestBody :: C.Source (C.ResourceT IO) B.ByteString
99101 -- | A location for arbitrary data to be shared by applications and middleware.
100102 , vault :: Vault
103+ -- | The size of the request body. In the case of a chunked request body, this may be unknown.
104+ --
105+ -- Since 1.4.0
106+ , requestBodyLength :: RequestBodyLength
101107 }
102108 deriving (Typeable)
103109
@@ -175,3 +181,9 @@ type Application = Request -> C.ResourceT IO Response
175181-- Here, instead of taking a standard 'Application' as its first argument, the
176182-- middleware takes a function which consumes the session information as well.
177183type Middleware = Application -> Application
184+
185+-- | The size of the request body. In the case of chunked bodies, the size will
186+-- not be known.
187+--
188+-- Since 1.4.0
189+data RequestBodyLength = ChunkedBody | KnownLength Word64
wai/wai.cabal+1−1
@@ -1,5 +1,5 @@
11Name: wai
2−Version: 1.3.0.3
2+Version: 1.4.0
33Synopsis: Web Application Interface.
44Description: Provides a common protocol for communication between web applications and web servers.
55License: MIT
warp-tls/warp-tls.cabal+1−1
@@ -15,7 +15,7 @@ Description: SSL support for Warp via the TLS package
1515Library
1616 Build-Depends: base >= 4 && < 5
1717 , bytestring >= 0.9
18− , wai >= 1.3 && < 1.4
18+ , wai >= 1.3 && < 1.5
1919 , warp >= 1.3.5 && < 1.4
2020 , transformers >= 0.2
2121 , conduit >= 0.5 && < 1.1
warp/Network/Wai/Handler/Warp/Request.hs+7
@@ -1,5 +1,6 @@
11{-# LANGUAGE BangPatterns #-}
22{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE CPP #-}
34
45module Network.Wai.Handler.Warp.Request where
56
@@ -98,6 +99,12 @@ parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
9899 , remoteHost = remoteHost'
99100 , requestBody = rbody
100101 , vault = mempty
102+#if MIN_VERSION_wai(1, 4, 0)
103+ , requestBodyLength =
104+ if chunked
105+ then ChunkedBody
106+ else KnownLength $ fromIntegral len0
107+#endif
101108 }, getSource)
102109
103110{-# INLINE takeUntil #-}
warp/warp.cabal+3−3
@@ -1,5 +1,5 @@
11Name: warp
2−Version: 1.3.7.3
2+Version: 1.3.7.4
33Synopsis: A fast, light-weight web server for WAI applications.
44License: MIT
55License-file: LICENSE
@@ -35,7 +35,7 @@ Library
3535 , transformers >= 0.2.2 && < 0.4
3636 , unix-compat >= 0.2
3737 , void
38− , wai >= 1.3 && < 1.4
38+ , wai >= 1.3 && < 1.5
3939 if flag(network-bytestring)
4040 Build-Depends: network >= 2.2.1.5 && < 2.2.3
4141 , network-bytestring >= 0.1.3 && < 0.1.4
@@ -83,7 +83,7 @@ Test-Suite spec
8383 , transformers >= 0.2.2 && < 0.4
8484 , unix-compat >= 0.2
8585 , void
86− , wai >= 1.3 && < 1.4
86+ , wai
8787 , network
8888 , HUnit
8989 , QuickCheck