-
Notifications
You must be signed in to change notification settings - Fork 56
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
Uri.of_string does not actually invoke pct_decode #31
Comments
This is expected behavior: > let s = "udp%3A//tracker.openbittorrent.com%3A80/%3A?%3A#%3A";;
val s : string = "udp%3A//tracker.openbittorrent.com%3A80/%3A?%3A#%3A"
> let uri = Uri.of_string s;;
val uri : Uri.t = udp%3A//tracker.openbittorrent.com%3A80/%3A?:#:
> Uri.path uri;;
- : string = "udp://tracker.openbittorrent.com:80/:" This is because ":" is not a valid character in the path component of a URI. If you know you have a URI which has syntactic components percent-encoded, you should first percent decode it before parsing it with If the URI was percent-encoded because it was being passed as a component of another URI, this percent decoding will happen automatically and you can do something like: let uri = match Uri.(get_query_param (of_string request_uri)) "target" with
| None -> raise Not_found
| Some t -> Uri.of_string t I think this behavior makes sense but I'm interested in hearing your opinion. Please note, there is also a rather nasty percent-encoding bug which I intend to fix soon (later today?). |
Dear David, Thanks very much for your reply! I am rather ignorant about the technicalities (** Convert a percent-encoded string into a URI structure *) which is confusing IMHO. Thanks again! On 28 Dec 2013, at 16:30, David Sheets [email protected] wrote:
|
Oh, I see. That is quite confusing. I will explain more clearly what |
Is this expected behaviour?
The text was updated successfully, but these errors were encountered: