tags:

views:

339

answers:

2

I am trying to have WinHttp make a “CONNECT” calls (as opposed to a “GET” or “POST”) that looks as follows:

CONNECT www.etrade.com:443 HTTP/1.0
Host: www.etrade.com

However, winhttp always enforces a path after the “CONNECT” verb as follows (at the front of the location):

CONNECT /www.etrade.com:443 HTTP/1.0
Host:  www.etrade.com

Any workaround? or am I doing something wrong? This is in C# .net 3.5 framework, Winhttp 5.1

A: 

Why are you using WinHTTP rather than System.NET?

What (specifically) does your code look like?

What do you hope to accomplish by making a manual CONNECT?

EricLaw -MSFT-
A: 

CONNECT isn't a HTTP verb, it's the start of a HTTPS request ({the SSL connect portion). With WinHTTP, you just use the WINHTTP_FLAG_SECURE on OpenRequest. Something like:

hConnect = WinHttpConnect(
              hSession, 
              "www.etrade.com", 
              443, 
              0
           );
hRequest = WinHttpOpenRequest(
              hConnect,  
              "GET", 
              "/", 
              "HTTP/1.0", 
              WINHTTP_NO_REFERER, 
              WINHTTP_DEFAULT_ACCEPT_TYPES, 
              WINHTTP_FLAG_SECURE
           );

That gets you a CONNECT (for the SSL connection), and then a GET / (for the HTTP portion).

Mark Brackett