{"issue":{"title":"http mangles the query string too much","created_at":"2011-12-23T00:00:26Z","milestone":null,"user":{"id":307277,"login":"erikd","url":"https://api.github.com/users/erikd","gravatar_id":"c6144f7f9344e81cc35ed21b2d29a87c","avatar_url":"https://secure.gravatar.com/avatar/c6144f7f9344e81cc35ed21b2d29a87c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"updated_at":"2011-12-23T09:10:54Z","labels":[],"state":"open","id":2643409,"closed_at":null,"html_url":"https://github.com/snoyberg/http-enumerator/issues/48","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"I have a URL that's getting mangled by parseUrl and renderQuery.\r\n\r\nIf I write a program like:\r\n\r\n    import Network.HTTP.Enumerator\r\n    import qualified Data.ByteString.Lazy as L\r\n    import Network (withSocketsDo)\r\n\r\n    url = \"http://www.mega-nerd.com/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=7|dd=B|st=1|sh=1|df=libsndfile.dat\"\r\n\r\n    main = withSocketsDo $ simpleHttp url >>= L.putStr\r\n\r\nand run it as:\r\n\r\n   runhaskell simpleHttp.hs > a.gif\r\n\r\nI get a different result than if I had done:\r\n\r\n   wget $url -O b.gif\r\n\r\nBasically the problem is that if you just consider the query string part, the parseUrl ---> renderQuery path is not the identity function. \r\n\r\nThe query:\r\n\r\n     ?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=7|dd=B|st=1|sh=1|df=libsndfile.dat\r\n\r\nbecomes:\r\n\r\n    ?ft=6%7Cfrgb%3D55&55&55%7Ctr=0%7Ctrgb%3D0&0&0%7Cwxh=15&20%7Cmd=7%7Cdd%3DB%7Cst%3D1%7Csh%3D1%7Cdf%3Dlibsndfile.dat\r\n\r\nYou could of course say that the CGI script should handle a URI encoded string and I would agree, but I also don't think http-enumerator should be mangling it as much as it does. In fact, I don't http-enumerator should be parsing it into a Query at all, but should leave it as a ByteString (of course in Warp its a completely different matter).\r\n\r\nIf you agree, I can submit a pull request that fixes this. Obviously this will require a significant version bump but I'll leave that to you.\r\n\r\nThis is actually really trivial to fix. I already have a solution in this commit\r\n    https://github.com/erikd/http-enumerator/commit/f4cc35d99863034fd090312798831eb5d3c63f9b\r\n\r\nand I've tested that it fixes my issue.\r\n\r\nCheers,\r\nErik\r\n","number":48,"url":"https://api.github.com/repos/snoyberg/http-enumerator/issues/48","comments":6,"assignee":null},"action":"reopened"}