Closed tatac1 closed 10 years ago
Thank you very much @tatac1. I added your test case with e6f7fab6f6ce311427789bd879566cb6cd4bf447 but it parses successfuly. Could you please give more information about your fail case?
Thank you for your reply @aycanirican .
This is a my fail case.
λ: import Data.ByteString
λ: import Network.Parser.Rfc2616
λ: import Data.Attoparsec.ByteString
λ: let req = "GET /search?q=haskell HTTP/1.1\r\nHost: www.google.co.jp\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: ja,en-us;q=0.7,en;q=0.3\r\nAccept-Encoding: gzip, deflate\r\nCookie: PREF=ID=7ca99b92f2f9afe9:FF=0:TM=1400941989:LM=1400941989:S=w2rcVppuXeOj6pXi; NID=67=N3XLJvzIIHqfvn_LuNTgBmA59ni-8YNTZ-RFASwaaByYQ9q0wfljtVHijfzQIGVJQ8axRzvOoBI9idcimOPUVI4obXncxIUUVf17AgubzR8KFBQVlXb7n2S0LNV43EPV\r\nConnection: keep-alive\r\n\r\n"
λ: parseTest request req
Fail "?q=haskell HTTP/1.1\r\nHost: www.google.co.jp\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: ja,en-us;q=0.7,en;q=0.3\r\nAccept-Encoding: gzip, deflate\r\nCookie: PREF=ID=7ca99b92f2f9afe9:FF=0:TM=1400941989:LM=1400941989:S=w2rcVppuXeOj6pXi; NID=67=N3XLJvzIIHqfvn_LuNTgBmA59ni-8YNTZ-RFASwaaByYQ9q0wfljtVHijfzQIGVJQ8axRzvOoBI9idcimOPUVI4obXncxIUUVf17AgubzR8KFBQVlXb7n2S0LNV43EPV\r\nConnection: keep-alive\r\n\r\n" ["space","32"] "Failed reading: satisfyElem"
I understand that req
should be parsed like this
λ: parseTest request req
Done "" Request {rqMethod = GET, rqUri = RelativeRef (URI {uriScheme = "", uriAuthority = Nothing, uriPath = "/search", uriQuery = "?q=haskell", uriFragment = ""}), rqVersion = HttpVersion {httpMajor = 1, httpMinor = 1}, rqHeaders = [("Host","www.google.co.jp"),("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"),("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),("Accept-Language","ja,en-us;q=0.7,en;q=0.3"),("Accept-Encoding","gzip, deflate"),("Cookie","PREF=ID=7ca99b92f2f9afe9:FF=0:TM=1400941989:LM=1400941989:S=w2rcVppuXeOj6pXi; NID=67=N3XLJvzIIHqfvn_LuNTgBmA59ni-8YNTZ-RFASwaaByYQ9q0wfljtVHijfzQIGVJQ8axRzvOoBI9idcimOPUVI4obXncxIUUVf17AgubzR8KFBQVlXb7n2S0LNV43EPV"),("Connection","keep-alive")], rqBody = ""}
Thank you. Fixed with f1492e54f1222429f72234e13f4d8193f077c95b.
When parsing The below example request, Network.Parser.Rfc2616.request, fails.
pathAbsolute returns "?q=haskell HTTP/1.1\n" then next parser fails