Discussion:
WinHttpOpenRequest: object name encoding
(too old to reply)
Serge Wautier
2007-02-01 16:19:23 UTC
Permalink
Hi All,

When calling WinHttpOpenRequest(), am I supposed to encode the URL myself or
will the API take care of it?

e.g.: can I pass "page.php?arg=hello world" ? Or am I supose to turn it
myself into "page.php?arg=hello%20world" ?

TIA,

Serge
http://www.apptranslator.com
Paul Baker [MVP, Windows - Networking]
2007-02-01 18:51:03 UTC
Permalink
I have not used WinHTTP. You realise you posted to a WinInet newsgroup?

My guess would be that WinHTTP is not going to change your URL in any way.

There are several functions in WinHTTP, WinInet and Shlwapi that will
convert unsafe characters in a URL before and/or after the query character
(?). However, if your query name/values could contain unsafe characters,
then it's already too late when you have a URL.

For example:
page.php?arg=hello paul&serge=world

Is "arg" equal to "hello paul" and "serger" equal to "world" Or
is "arg" equal to "hello paul&serge=world"?

When I use WinInet, I add the name/values one at a time to the URL. I use
safe names and encode the values myself using my own code and the table
documented in Shlwapi!UrlEscape:
http://msdn2.microsoft.com/en-us/library/ms628636.aspx

I don't know if that is correct or not, but that is what I do. I'd like to
hear from someone else on this matter.

Paul
Post by Serge Wautier
Hi All,
When calling WinHttpOpenRequest(), am I supposed to encode the URL myself
or will the API take care of it?
e.g.: can I pass "page.php?arg=hello world" ? Or am I supose to turn it
myself into "page.php?arg=hello%20world" ?
TIA,
Serge
http://www.apptranslator.com
Loading...