wininet: Move InternetQueryOption(INTERNET_OPTION_URL) to vtbl.
This commit is contained in:
parent
e2933c20d6
commit
0e010d83a1
|
@ -1405,6 +1405,8 @@ static void HTTPREQ_CloseConnection(WININETHANDLEHEADER *hdr)
|
||||||
|
|
||||||
static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||||
{
|
{
|
||||||
|
WININETHTTPREQW *req = (WININETHTTPREQW*)hdr;
|
||||||
|
|
||||||
switch(option) {
|
switch(option) {
|
||||||
case INTERNET_OPTION_HANDLE_TYPE:
|
case INTERNET_OPTION_HANDLE_TYPE:
|
||||||
TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
|
TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
|
||||||
|
@ -1415,6 +1417,38 @@ static DWORD HTTPREQ_QueryOption(WININETHANDLEHEADER *hdr, DWORD option, void *b
|
||||||
*size = sizeof(DWORD);
|
*size = sizeof(DWORD);
|
||||||
*(DWORD*)buffer = INTERNET_HANDLE_TYPE_HTTP_REQUEST;
|
*(DWORD*)buffer = INTERNET_HANDLE_TYPE_HTTP_REQUEST;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
||||||
|
case INTERNET_OPTION_URL: {
|
||||||
|
WCHAR url[INTERNET_MAX_URL_LENGTH];
|
||||||
|
HTTPHEADERW *host;
|
||||||
|
DWORD len;
|
||||||
|
|
||||||
|
static const WCHAR formatW[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
|
||||||
|
static const WCHAR hostW[] = {'H','o','s','t',0};
|
||||||
|
|
||||||
|
TRACE("INTERNET_OPTION_URL\n");
|
||||||
|
|
||||||
|
host = HTTP_GetHeader(req, hostW);
|
||||||
|
sprintfW(url, formatW, host->lpszValue, req->lpszPath);
|
||||||
|
TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
|
||||||
|
|
||||||
|
if(unicode) {
|
||||||
|
len = (strlenW(url)+1) * sizeof(WCHAR);
|
||||||
|
if(*size < len)
|
||||||
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
|
||||||
|
*size = len;
|
||||||
|
strcpyW(buffer, url);
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}else {
|
||||||
|
len = WideCharToMultiByte(CP_ACP, 0, url, -1, buffer, *size, NULL, NULL);
|
||||||
|
if(len > *size)
|
||||||
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
|
||||||
|
*size = len;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FIXME("Not implemented option %d\n", option);
|
FIXME("Not implemented option %d\n", option);
|
||||||
|
|
|
@ -1868,54 +1868,6 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case INTERNET_OPTION_URL:
|
|
||||||
{
|
|
||||||
TRACE("INTERNET_OPTION_URL\n");
|
|
||||||
|
|
||||||
if (!lpwhh)
|
|
||||||
{
|
|
||||||
WARN("Invalid hInternet handle\n");
|
|
||||||
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (lpwhh->htype == WH_HHTTPREQ)
|
|
||||||
{
|
|
||||||
LPWININETHTTPREQW lpreq = (LPWININETHTTPREQW) lpwhh;
|
|
||||||
WCHAR url[1023];
|
|
||||||
static const WCHAR szFmt[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
|
|
||||||
static const WCHAR szHost[] = {'H','o','s','t',0};
|
|
||||||
DWORD sizeRequired;
|
|
||||||
LPHTTPHEADERW Host;
|
|
||||||
|
|
||||||
Host = HTTP_GetHeader(lpreq,szHost);
|
|
||||||
sprintfW(url,szFmt,Host->lpszValue,lpreq->lpszPath);
|
|
||||||
TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
|
|
||||||
if(!bIsUnicode)
|
|
||||||
{
|
|
||||||
sizeRequired = WideCharToMultiByte(CP_ACP,0,url,-1,
|
|
||||||
lpBuffer,*lpdwBufferLength,NULL,NULL);
|
|
||||||
if (sizeRequired > *lpdwBufferLength)
|
|
||||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
else
|
|
||||||
bSuccess = TRUE;
|
|
||||||
*lpdwBufferLength = sizeRequired;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sizeRequired = (lstrlenW(url)+1) * sizeof(WCHAR);
|
|
||||||
if (*lpdwBufferLength < sizeRequired)
|
|
||||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpyW(lpBuffer, url);
|
|
||||||
bSuccess = TRUE;
|
|
||||||
}
|
|
||||||
*lpdwBufferLength = sizeRequired;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case INTERNET_OPTION_USER_AGENT:
|
case INTERNET_OPTION_USER_AGENT:
|
||||||
FIXME("INTERNET_OPTION_USER_AGENT\n");
|
FIXME("INTERNET_OPTION_USER_AGENT\n");
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue