Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: WPAD - WinHttpGetProxyForUrl - WINHTTP_PROXY_INFO - Default proxy port?


This question is answered.


Permlink Replies: 2 - Last Post: Dec 7, 2015 10:34 PM Last Post By: Ted Lyngmo
Ted Lyngmo

Posts: 117
Registered: 10/3/06
WPAD - WinHttpGetProxyForUrl - WINHTTP_PROXY_INFO - Default proxy port?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 7, 2015 2:35 PM
Hi!

I'm using WinHttpGetProxyForUrl() and wonder if there's a default port that I should use should the respons lack the port part?

From [https://msdn.microsoft.com/en-us/library/windows/desktop/aa383912(v=vs.85).aspx]

"The proxy server list contains one or more of the following strings separated by semicolons or whitespace."

([<scheme>=][<scheme>"://"]<server>[":"<port>])

The only mandatory field is <server> so I've made "http" the default scheme and 8080 the default port - but I don't know if that's correct.

Also, although <port> usually refers to a number - could it also contain a service name (http or something)?

Br,
Ted
--
Windows 7 32bit | Borland C++ Builder 4
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: WPAD - WinHttpGetProxyForUrl - WINHTTP_PROXY_INFO - Default proxy port?
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 7, 2015 3:00 PM   in response to: Ted Lyngmo in response to: Ted Lyngmo
Ted wrote:

I'm using WinHttpGetProxyForUrl() and wonder if there's a default
port that I should use should the respons lack the port part?

The default port is dictated by the scheme. The default HTTP port is 80,
the default HTTPS port is 443, etc.

The only mandatory field is <server> so I've made "http" the default
scheme

That is fine, considering that WinHttpGetProxyForUrl() is part of the WinHTTP
library and only supports HTTP(S) urls.

and 8080 the default port - but I don't know if that's correct.

Not strictly, no. But some HTTP proxies do run on 8080, so it is not an
uncommon default to use.

Also, although <port> usually refers to a number - could it also
contain a service name (http or something)?

No. The service name is specified in the <scheme>, the <port> is always
numeric.

--
Remy Lebeau (TeamB)
Ted Lyngmo

Posts: 117
Registered: 10/3/06
Re: WPAD - WinHttpGetProxyForUrl - WINHTTP_PROXY_INFO - Default proxy port?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 7, 2015 10:34 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Ted wrote:

I'm using WinHttpGetProxyForUrl() and wonder if there's a default
port that I should use should the respons lack the port part?

The default port is dictated by the scheme. The default HTTP port is 80,
the default HTTPS port is 443, etc.

That makes sense. So, I could do getservbyname(schema) to get the default port?

I'm now guessing that the default schema is the same schema used in the URL I called WinHttpGetProxyForUrl() for?

The only mandatory field is <server> so I've made "http" the default
scheme

That is fine, considering that WinHttpGetProxyForUrl() is part of the WinHTTP
library and only supports HTTP(S) urls.

Ok, no need to overdo it with getservbyname(schema) then I guess:-)

Also, although <port> usually refers to a number - could it also
contain a service name (http or something)?

No. The service name is specified in the <scheme>, the <port> is always
numeric.

Great, thanks Remy!

Br,
Ted
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02