ocsigen / ocsigenserver

Web server in OCaml.
http://ocsigen.org/ocsigenserver/
Other
100 stars 30 forks source link

Ocsigen_lib.Url.parse: doesn't fail on random string. #106

Open dannywillems opened 8 years ago

dannywillems commented 8 years ago

When sending a random string (for example q7fPbXDbpCLdP5acC7WfCTmeYr2QFnglLhjgCPrYfd), Ocsigen_lib.Url.parse doesn't fail and says nothing.

It would be better to throw an exception in this case.

vasilisp commented 8 years ago

That's probably OK. The http:// or https:// is optional, and q7fPbXDbpCLdP5acC7WfCTmeYr2QFnglLhjgCPrYfd looks like a valid hostname without a port and path (both optional). Do you have an example that is definitely not a URL?

dinosaure commented 8 years ago

May be a good way is to replace Url by ocaml-uri - but, yes lot of works :( ?

vasilisp commented 8 years ago

We need to intervene in the Url module (sooner rather than later) to get rid of the Ocamlnet dependency (Netstring_pcre). It may well be the case that ocaml-uri is all we need.

dinosaure commented 8 years ago

Yes, I know this problem :) . I can try to replace Url_base and Url by ocaml-uri and keep the same interface - to keep the compatibility with Eliom - if you want. But ocaml-uri adds some dependencies (like re, sexplib and stringext). And I think, @balat does not want that - but, may be, I'm wrong.

dannywillems commented 8 years ago

@vasilisp I retried and the function doesn't terminate (I added a print before and after and the after is not printed). I found the issue when I was sending a random string representing a state (in OAuth2) instead of the redirect URL.