
Hi all, I wanted to bring up for discussion some planned changes to the WAI. You can see what I'm proposing on Github[1]. The first thing you might notice is that the Network.Wai module is significantly smaller than it used to be. This is because a number of the constants and data types previously defined in WAI are now provided by the http-types[2] package. Besides the smaller code base, the following changes are also included: * HttpVersion is no longer a ByteString; instead, it is a datatype with two Ints. So HTTP/1.1 becomes HttpVersion 1 1. * pathInfo is renamed to pathInfoRaw, and the new pathInfo is a [Text] value. This represents the *parsed* path info. For example: GET /foo/bar HTTP/1.0 becomes ["foo", "bar"] By including this in the definition of WAI, it's simpler to provide sub-apps. For example: masterApp req = case pathInfo req of "site1":rest -> site1 $ req { pathInfo = req } ... * Similarly, queryString becomes queryStringRaw and queryString is now a [(ByteString, Maybe ByteString)]. This allows the query string to be processed once and the value shared amongst all middlewares and applications. If you are wondering why we use ByteString and not Text, it is because the query string can have any arbitrary encoding. The path info, on the other hand, is (basically) required to be UTF-8. * In place of CIByteString, we now have CIAscii. Besides the slightly nicer name, this is now taking advantage of the newly written ascii[3] and case-insensitive[4] packages. * Header values are given as Ascii values instead of ByteStrings. If anyone has concerns about these changes, please raise them. I'd rather get all the complaints out in the open before releasing a new version. Michael [1] https://github.com/snoyberg/wai/blob/master/Network/Wai.hs [2] http://hackage.haskell.org/package/http-types [3] http://hackage.haskell.org/package/ascii [4] http://hackage.haskell.org/package/case-insensitive

Michael,
I wanted to bring up for discussion some planned changes to the WAI. You can see what I'm proposing on Github[1]. The first thing you might notice is that the Network.Wai module is significantly smaller than it used to be. This is because a number of the constants and data types previously defined in WAI are now provided by the http-types[2] package. Besides the smaller code base, the following changes are also included:
As I personally said to you, I would like to have a way to send a PART of file. So, I hope that ResponseFile is enhanced. --Kazu

On Wed, Mar 16, 2011 at 3:10 AM, Kazu Yamamoto
Michael,
I wanted to bring up for discussion some planned changes to the WAI. You can see what I'm proposing on Github[1]. The first thing you might notice is that the Network.Wai module is significantly smaller than it used to be. This is because a number of the constants and data types previously defined in WAI are now provided by the http-types[2] package. Besides the smaller code base, the following changes are also included:
As I personally said to you, I would like to have a way to send a PART of file. So, I hope that ResponseFile is enhanced.
Good idea. Please look at the most recent commit. It adds a new datatype: data FilePart = FilePart Integer Integer -- offset and count And modified the ResponseFile constructor to also take a Maybe FilePart value. I chose Integer for the offset and count since that is what the sendfile package uses. Does this sound reasonable to everyone? Note: I still need to implement the enumFilePart function in Network.Wai. Michael
participants (2)
-
Kazu Yamamoto
-
Michael Snoyman