Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Query string isn't escaped #16

Open
ozten opened this issue Jul 26, 2013 · 0 comments
Open

Query string isn't escaped #16

ozten opened this issue Jul 26, 2013 · 0 comments

Comments

@ozten
Copy link
Contributor

ozten commented Jul 26, 2013

If you send a properly escaped url into url::Url and pass that into http_client, then the actual request will not be escaped.

Example:

let search_url = "http://localhost:8002/search/code?q=" +
        query.replace(" ", "%20");
let u: Url = url::from_str(search_url).get();
uv_http_request(u, options);

the debug output will be

Actual

rust: ~"http_client: writing request header: ~\"GET /search/code?q=navigator.id.get OR navigator.id.request HTTP/1.0

Expected

rust: ~"http_client: writing request header: ~\"GET /search/code?q=navigator.id.get%20OR%20navigator.id.request HTTP/1.0

I'm not sure if this fix is in Url or http-client.

Url looks like

{scheme: ~"http", user: None, host: ~"localhost", port: Some(~"8002"), path: ~"/search/code", query: ~[(~"q", ~"navigator.id.get OR navigator.id.request")], fragment: None}

I'm thinking http-client should escape query string before sending it.

ozten added a commit to ozten/rust-http-client that referenced this issue Jul 26, 2013
metajack added a commit that referenced this issue Aug 4, 2013
Escape query string values. Fixes Issue #16.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant