[Wine] How I improved wininet for SSL through a proxy...
wolbrink
wineforum-user at winehq.org
Fri Jun 4 13:24:21 CDT 2010
I'm trying to get my app to use WinInet to connect to a https url through a proxy. I found that the following patch (my code in bold) to http.c improved wininet.dll.so (based on the 2.1-rc2 code) so that my app can talk to some servers. It still doesn't work if the server returns with a CONTINUE. But not all servers are using this. Thankfully the one server my app really depends on doesn't use CONTINUE, so this is a big step forward for me.
Here it is (the original logic I'm enhancing is in blue):
static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *lpwhr, LPCWSTR verb, LPCWSTR path, LPCWSTR version )
{
...
static const WCHAR szZero[] = { '0',0 };
static const WCHAR szConnect[] = {'C','O','N','N','E','C','T',0};
...
if (!strcmpW(szContent_Length, lpwhr->pCustHeaders[i].lpszField) && !strcmpW(verb, szConnect))
{
// CONNECT ... Content-Length: 0 <-- seems to help POST over SSL w/ Proxy
req[n++] = szCrLf;
req[n++] = lpwhr->pCustHeaders[i].lpszField;
req[n++] = szColon;
req[n++] = szZero;
TRACE("Adding custom header %s (%s)\n",
debugstr_w(lpwhr->pCustHeaders[i].lpszField),
debugstr_w(szZero));
}
else {
req[n++] = szCrLf;
req[n++] = lpwhr->pCustHeaders[i].lpszField;
req[n++] = szColon;
req[n++] = lpwhr->pCustHeaders[i].lpszValue;
TRACE("Adding custom header %s (%s)\n",
debugstr_w(lpwhr->pCustHeaders[i].lpszField),
debugstr_w(lpwhr->pCustHeaders[i].lpszValue));
}
...
}
// It's changing the Content-Length header to always be "Content-Length: 0" when the "CONNECT" method is used
More information about the wine-users
mailing list