Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receiveHTTP does not preprocess the incoming URI before it is parsed #76

Open
zkf opened this issue Sep 4, 2014 · 0 comments
Open

receiveHTTP does not preprocess the incoming URI before it is parsed #76

zkf opened this issue Sep 4, 2014 · 0 comments

Comments

@zkf
Copy link

zkf commented Sep 4, 2014

Because of the strict parsing of URIs by Network.URI.parseURIReference, parseRequestHead fails on this "almost valid" URI:

ghci> parseRequestHead ["GET http://fonts.googleapis.com/css?family=Roboto:300|Open+Sans:700|Open+Sans:300&lang=en HTTP/1.1"]
ghci> Left (ErrorParse "parseRequestHead Request command line parse failure: GET http://fonts.googleapis.com/css?family=Roboto:300|Open+Sans:700|Open+Sans:300&lang=en HTTP/1.1")

Replacing the pipe characters with %7C allows the URI to parse.

receiveHTTP, or maybe parseRequestHead, should probably try to escape the characters that are considered invalid for URIs, before sending the string through parseURIReference.

In that regard, escapeURIString isAllowedInURI from Network.URI may be handy.

(Something about "be conservative in what you send, be liberal in what you accept" prompted me to raise this issue.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant