Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2098006d
Commit
2098006d
authored
Mar 01, 2011
by
Juan Lang
Committed by
Alexandre Julliard
Mar 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: De-Hungarian HTTP request member names.
parent
8e050391
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
213 additions
and
213 deletions
+213
-213
dialogs.c
dlls/wininet/dialogs.c
+3
-3
http.c
dlls/wininet/http.c
+196
-196
internet.h
dlls/wininet/internet.h
+14
-14
No files found.
dlls/wininet/dialogs.c
View file @
2098006d
...
@@ -74,7 +74,7 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
...
@@ -74,7 +74,7 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
if
(
NULL
==
request
)
if
(
NULL
==
request
)
return
FALSE
;
return
FALSE
;
session
=
request
->
lpHttpS
ession
;
session
=
request
->
s
ession
;
if
(
NULL
==
session
)
if
(
NULL
==
session
)
goto
done
;
goto
done
;
...
@@ -111,7 +111,7 @@ static BOOL WININET_GetServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
...
@@ -111,7 +111,7 @@ static BOOL WININET_GetServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
if
(
NULL
==
request
)
if
(
NULL
==
request
)
return
FALSE
;
return
FALSE
;
session
=
request
->
lpHttpS
ession
;
session
=
request
->
s
ession
;
if
(
NULL
==
session
)
if
(
NULL
==
session
)
goto
done
;
goto
done
;
...
@@ -250,7 +250,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
...
@@ -250,7 +250,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
if
(
!
request
)
if
(
!
request
)
return
FALSE
;
return
FALSE
;
session
=
request
->
lpHttpS
ession
;
session
=
request
->
s
ession
;
if
(
NULL
==
session
||
session
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
if
(
NULL
==
session
||
session
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
{
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
...
dlls/wininet/http.c
View file @
2098006d
...
@@ -237,7 +237,7 @@ static LPHTTPHEADERW HTTP_GetHeader(http_request_t *req, LPCWSTR head)
...
@@ -237,7 +237,7 @@ static LPHTTPHEADERW HTTP_GetHeader(http_request_t *req, LPCWSTR head)
if
(
HeaderIndex
==
-
1
)
if
(
HeaderIndex
==
-
1
)
return
NULL
;
return
NULL
;
else
else
return
&
req
->
pC
ustHeaders
[
HeaderIndex
];
return
&
req
->
c
ustHeaders
[
HeaderIndex
];
}
}
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB
...
@@ -291,16 +291,16 @@ static DWORD set_content_length( http_request_t *request )
...
@@ -291,16 +291,16 @@ static DWORD set_content_length( http_request_t *request )
WCHAR
encoding
[
20
];
WCHAR
encoding
[
20
];
DWORD
size
;
DWORD
size
;
size
=
sizeof
(
request
->
dwC
ontentLength
);
size
=
sizeof
(
request
->
c
ontentLength
);
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_FLAG_NUMBER
|
HTTP_QUERY_CONTENT_LENGTH
,
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_FLAG_NUMBER
|
HTTP_QUERY_CONTENT_LENGTH
,
&
request
->
dwC
ontentLength
,
&
size
,
NULL
)
!=
ERROR_SUCCESS
)
&
request
->
c
ontentLength
,
&
size
,
NULL
)
!=
ERROR_SUCCESS
)
request
->
dwC
ontentLength
=
~
0u
;
request
->
c
ontentLength
=
~
0u
;
size
=
sizeof
(
encoding
);
size
=
sizeof
(
encoding
);
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_TRANSFER_ENCODING
,
encoding
,
&
size
,
NULL
)
==
ERROR_SUCCESS
&&
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_TRANSFER_ENCODING
,
encoding
,
&
size
,
NULL
)
==
ERROR_SUCCESS
&&
!
strcmpiW
(
encoding
,
szChunked
))
!
strcmpiW
(
encoding
,
szChunked
))
{
{
request
->
dwC
ontentLength
=
~
0u
;
request
->
c
ontentLength
=
~
0u
;
request
->
read_chunked
=
TRUE
;
request
->
read_chunked
=
TRUE
;
}
}
...
@@ -310,11 +310,11 @@ static DWORD set_content_length( http_request_t *request )
...
@@ -310,11 +310,11 @@ static DWORD set_content_length( http_request_t *request )
static
const
WCHAR
gzipW
[]
=
{
'g'
,
'z'
,
'i'
,
'p'
,
0
};
static
const
WCHAR
gzipW
[]
=
{
'g'
,
'z'
,
'i'
,
'p'
,
0
};
encoding_idx
=
HTTP_GetCustomHeaderIndex
(
request
,
szContent_Encoding
,
0
,
FALSE
);
encoding_idx
=
HTTP_GetCustomHeaderIndex
(
request
,
szContent_Encoding
,
0
,
FALSE
);
if
(
encoding_idx
!=
-
1
&&
!
strcmpiW
(
request
->
pC
ustHeaders
[
encoding_idx
].
lpszValue
,
gzipW
))
if
(
encoding_idx
!=
-
1
&&
!
strcmpiW
(
request
->
c
ustHeaders
[
encoding_idx
].
lpszValue
,
gzipW
))
init_gzip_stream
(
request
);
init_gzip_stream
(
request
);
}
}
return
request
->
dwC
ontentLength
;
return
request
->
c
ontentLength
;
}
}
/***********************************************************************
/***********************************************************************
...
@@ -388,33 +388,33 @@ static void HTTP_FixURL(http_request_t *request)
...
@@ -388,33 +388,33 @@ static void HTTP_FixURL(http_request_t *request)
static
const
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
0
};
/* If we don't have a path we set it to root */
/* If we don't have a path we set it to root */
if
(
NULL
==
request
->
lpszP
ath
)
if
(
NULL
==
request
->
p
ath
)
request
->
lpszP
ath
=
heap_strdupW
(
szSlash
);
request
->
p
ath
=
heap_strdupW
(
szSlash
);
else
/* remove \r and \n*/
else
/* remove \r and \n*/
{
{
int
nLen
=
strlenW
(
request
->
lpszP
ath
);
int
nLen
=
strlenW
(
request
->
p
ath
);
while
((
nLen
>
0
)
&&
((
request
->
lpszPath
[
nLen
-
1
]
==
'\r'
)
||
(
request
->
lpszP
ath
[
nLen
-
1
]
==
'\n'
)))
while
((
nLen
>
0
)
&&
((
request
->
path
[
nLen
-
1
]
==
'\r'
)
||
(
request
->
p
ath
[
nLen
-
1
]
==
'\n'
)))
{
{
nLen
--
;
nLen
--
;
request
->
lpszP
ath
[
nLen
]
=
'\0'
;
request
->
p
ath
[
nLen
]
=
'\0'
;
}
}
/* Replace '\' with '/' */
/* Replace '\' with '/' */
while
(
nLen
>
0
)
{
while
(
nLen
>
0
)
{
nLen
--
;
nLen
--
;
if
(
request
->
lpszPath
[
nLen
]
==
'\\'
)
request
->
lpszP
ath
[
nLen
]
=
'/'
;
if
(
request
->
path
[
nLen
]
==
'\\'
)
request
->
p
ath
[
nLen
]
=
'/'
;
}
}
}
}
if
(
CSTR_EQUAL
!=
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
if
(
CSTR_EQUAL
!=
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
request
->
lpszPath
,
strlenW
(
request
->
lpszP
ath
),
szHttp
,
strlenW
(
szHttp
)
)
request
->
path
,
strlenW
(
request
->
p
ath
),
szHttp
,
strlenW
(
szHttp
)
)
&&
request
->
lpszP
ath
[
0
]
!=
'/'
)
/* not an absolute path ?? --> fix it !! */
&&
request
->
p
ath
[
0
]
!=
'/'
)
/* not an absolute path ?? --> fix it !! */
{
{
WCHAR
*
fixurl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
WCHAR
*
fixurl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
request
->
lpszP
ath
)
+
2
)
*
sizeof
(
WCHAR
));
(
strlenW
(
request
->
p
ath
)
+
2
)
*
sizeof
(
WCHAR
));
*
fixurl
=
'/'
;
*
fixurl
=
'/'
;
strcpyW
(
fixurl
+
1
,
request
->
lpszP
ath
);
strcpyW
(
fixurl
+
1
,
request
->
p
ath
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszP
ath
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
p
ath
);
request
->
lpszP
ath
=
fixurl
;
request
->
p
ath
=
fixurl
;
}
}
}
}
...
@@ -445,16 +445,16 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR ve
...
@@ -445,16 +445,16 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR ve
/* Append custom request headers */
/* Append custom request headers */
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
{
{
if
(
request
->
pC
ustHeaders
[
i
].
wFlags
&
HDR_ISREQUEST
)
if
(
request
->
c
ustHeaders
[
i
].
wFlags
&
HDR_ISREQUEST
)
{
{
req
[
n
++
]
=
szCrLf
;
req
[
n
++
]
=
szCrLf
;
req
[
n
++
]
=
request
->
pC
ustHeaders
[
i
].
lpszField
;
req
[
n
++
]
=
request
->
c
ustHeaders
[
i
].
lpszField
;
req
[
n
++
]
=
szColon
;
req
[
n
++
]
=
szColon
;
req
[
n
++
]
=
request
->
pC
ustHeaders
[
i
].
lpszValue
;
req
[
n
++
]
=
request
->
c
ustHeaders
[
i
].
lpszValue
;
TRACE
(
"Adding custom header %s (%s)
\n
"
,
TRACE
(
"Adding custom header %s (%s)
\n
"
,
debugstr_w
(
request
->
pC
ustHeaders
[
i
].
lpszField
),
debugstr_w
(
request
->
c
ustHeaders
[
i
].
lpszField
),
debugstr_w
(
request
->
pC
ustHeaders
[
i
].
lpszValue
));
debugstr_w
(
request
->
c
ustHeaders
[
i
].
lpszValue
));
}
}
}
}
...
@@ -485,7 +485,7 @@ static void HTTP_ProcessCookies( http_request_t *request )
...
@@ -485,7 +485,7 @@ static void HTTP_ProcessCookies( http_request_t *request )
while
((
HeaderIndex
=
HTTP_GetCustomHeaderIndex
(
request
,
szSet_Cookie
,
numCookies
,
FALSE
))
!=
-
1
)
while
((
HeaderIndex
=
HTTP_GetCustomHeaderIndex
(
request
,
szSet_Cookie
,
numCookies
,
FALSE
))
!=
-
1
)
{
{
setCookieHeader
=
&
request
->
pC
ustHeaders
[
HeaderIndex
];
setCookieHeader
=
&
request
->
c
ustHeaders
[
HeaderIndex
];
if
(
!
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_COOKIES
)
&&
setCookieHeader
->
lpszValue
)
if
(
!
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_COOKIES
)
&&
setCookieHeader
->
lpszValue
)
{
{
...
@@ -495,9 +495,9 @@ static void HTTP_ProcessCookies( http_request_t *request )
...
@@ -495,9 +495,9 @@ static void HTTP_ProcessCookies( http_request_t *request )
LPHTTPHEADERW
Host
;
LPHTTPHEADERW
Host
;
Host
=
HTTP_GetHeader
(
request
,
hostW
);
Host
=
HTTP_GetHeader
(
request
,
hostW
);
len
=
lstrlenW
(
Host
->
lpszValue
)
+
9
+
lstrlenW
(
request
->
lpszP
ath
);
len
=
lstrlenW
(
Host
->
lpszValue
)
+
9
+
lstrlenW
(
request
->
p
ath
);
buf_url
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
buf_url
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
sprintfW
(
buf_url
,
szFmt
,
Host
->
lpszValue
,
request
->
lpszP
ath
);
sprintfW
(
buf_url
,
szFmt
,
Host
->
lpszValue
,
request
->
p
ath
);
InternetSetCookieW
(
buf_url
,
NULL
,
setCookieHeader
->
lpszValue
);
InternetSetCookieW
(
buf_url
,
NULL
,
setCookieHeader
->
lpszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
buf_url
);
HeapFree
(
GetProcessHeap
(),
0
,
buf_url
);
...
@@ -939,7 +939,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
...
@@ -939,7 +939,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
sec_status
=
InitializeSecurityContextW
(
first
?
&
pAuthInfo
->
cred
:
NULL
,
sec_status
=
InitializeSecurityContextW
(
first
?
&
pAuthInfo
->
cred
:
NULL
,
first
?
NULL
:
&
pAuthInfo
->
ctx
,
first
?
NULL
:
&
pAuthInfo
->
ctx
,
first
?
request
->
lpHttpS
ession
->
serverName
:
NULL
,
first
?
request
->
s
ession
->
serverName
:
NULL
,
context_req
,
0
,
SECURITY_NETWORK_DREP
,
context_req
,
0
,
SECURITY_NETWORK_DREP
,
in
.
pvBuffer
?
&
in_desc
:
NULL
,
in
.
pvBuffer
?
&
in_desc
:
NULL
,
0
,
&
pAuthInfo
->
ctx
,
&
out_desc
,
0
,
&
pAuthInfo
->
ctx
,
&
out_desc
,
...
@@ -1426,10 +1426,10 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
...
@@ -1426,10 +1426,10 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
static
const
WCHAR
slash
[]
=
{
'/'
,
0
};
static
const
WCHAR
slash
[]
=
{
'/'
,
0
};
static
const
WCHAR
format
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
':'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
format
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
':'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
formatSSL
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
':'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
formatSSL
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
':'
,
'%'
,
'd'
,
0
};
http_session_t
*
session
=
req
->
lpHttpS
ession
;
http_session_t
*
session
=
req
->
s
ession
;
size
=
16
;
/* "https://" + sizeof(port#) + ":/\0" */
size
=
16
;
/* "https://" + sizeof(port#) + ":/\0" */
size
+=
strlenW
(
session
->
hostName
)
+
strlenW
(
req
->
lpszP
ath
);
size
+=
strlenW
(
session
->
hostName
)
+
strlenW
(
req
->
p
ath
);
if
(
!
(
url
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
)
)))
return
NULL
;
if
(
!
(
url
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
)
)))
return
NULL
;
...
@@ -1437,8 +1437,8 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
...
@@ -1437,8 +1437,8 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
sprintfW
(
url
,
formatSSL
,
session
->
hostName
,
session
->
hostPort
);
sprintfW
(
url
,
formatSSL
,
session
->
hostName
,
session
->
hostPort
);
else
else
sprintfW
(
url
,
format
,
session
->
hostName
,
session
->
hostPort
);
sprintfW
(
url
,
format
,
session
->
hostName
,
session
->
hostPort
);
if
(
req
->
lpszP
ath
[
0
]
!=
'/'
)
strcatW
(
url
,
slash
);
if
(
req
->
p
ath
[
0
]
!=
'/'
)
strcatW
(
url
,
slash
);
strcatW
(
url
,
req
->
lpszP
ath
);
strcatW
(
url
,
req
->
p
ath
);
}
}
TRACE
(
"url=%s
\n
"
,
debugstr_w
(
url
));
TRACE
(
"url=%s
\n
"
,
debugstr_w
(
url
));
return
url
;
return
url
;
...
@@ -1476,8 +1476,8 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
...
@@ -1476,8 +1476,8 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
if
(
UrlComponents
.
dwHostNameLength
==
0
)
if
(
UrlComponents
.
dwHostNameLength
==
0
)
return
FALSE
;
return
FALSE
;
if
(
!
request
->
lpszP
ath
)
if
(
!
request
->
p
ath
)
request
->
lpszP
ath
=
szNul
;
request
->
p
ath
=
szNul
;
if
(
UrlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
if
(
UrlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
UrlComponents
.
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
UrlComponents
.
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
...
@@ -1497,7 +1497,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
...
@@ -1497,7 +1497,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
static
DWORD
HTTP_ResolveName
(
http_request_t
*
request
)
static
DWORD
HTTP_ResolveName
(
http_request_t
*
request
)
{
{
char
szaddr
[
INET6_ADDRSTRLEN
];
char
szaddr
[
INET6_ADDRSTRLEN
];
http_session_t
*
session
=
request
->
lpHttpS
ession
;
http_session_t
*
session
=
request
->
s
ession
;
const
void
*
addr
;
const
void
*
addr
;
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
...
@@ -1541,7 +1541,7 @@ static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf)
...
@@ -1541,7 +1541,7 @@ static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf)
if
(
!
host_header
)
if
(
!
host_header
)
return
FALSE
;
return
FALSE
;
sprintfW
(
buf
,
formatW
,
host_header
->
lpszValue
,
req
->
lpszP
ath
);
/* FIXME */
sprintfW
(
buf
,
formatW
,
host_header
->
lpszValue
,
req
->
p
ath
);
/* FIXME */
return
TRUE
;
return
TRUE
;
}
}
...
@@ -1567,29 +1567,29 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
...
@@ -1567,29 +1567,29 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
memset
(
&
ft
,
0
,
sizeof
(
FILETIME
));
memset
(
&
ft
,
0
,
sizeof
(
FILETIME
));
if
(
HTTP_GetRequestURL
(
request
,
url
))
{
if
(
HTTP_GetRequestURL
(
request
,
url
))
{
CommitUrlCacheEntryW
(
url
,
request
->
lpszC
acheFile
,
ft
,
ft
,
CommitUrlCacheEntryW
(
url
,
request
->
c
acheFile
,
ft
,
ft
,
NORMAL_CACHE_ENTRY
,
NULL
,
0
,
NULL
,
0
);
NORMAL_CACHE_ENTRY
,
NULL
,
0
,
NULL
,
0
);
}
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszC
acheFile
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
acheFile
);
DeleteCriticalSection
(
&
request
->
read_section
);
DeleteCriticalSection
(
&
request
->
read_section
);
WININET_Release
(
&
request
->
lpHttpS
ession
->
hdr
);
WININET_Release
(
&
request
->
s
ession
->
hdr
);
destroy_authinfo
(
request
->
pA
uthInfo
);
destroy_authinfo
(
request
->
a
uthInfo
);
destroy_authinfo
(
request
->
p
P
roxyAuthInfo
);
destroy_authinfo
(
request
->
proxyAuthInfo
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszP
ath
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
p
ath
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszV
erb
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
v
erb
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszR
awHeaders
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
r
awHeaders
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszV
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
v
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszS
tatusText
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
s
tatusText
);
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
request
->
pC
ustHeaders
[
i
].
lpszField
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
ustHeaders
[
i
].
lpszField
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
pC
ustHeaders
[
i
].
lpszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
ustHeaders
[
i
].
lpszValue
);
}
}
#ifdef HAVE_ZLIB
#ifdef HAVE_ZLIB
...
@@ -1600,7 +1600,7 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
...
@@ -1600,7 +1600,7 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
}
}
#endif
#endif
HeapFree
(
GetProcessHeap
(),
0
,
request
->
pC
ustHeaders
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
ustHeaders
);
}
}
static
void
HTTPREQ_CloseConnection
(
object_header_t
*
hdr
)
static
void
HTTPREQ_CloseConnection
(
object_header_t
*
hdr
)
...
@@ -1653,7 +1653,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
...
@@ -1653,7 +1653,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
switch
(
option
)
{
switch
(
option
)
{
case
INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO
:
case
INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO
:
{
{
http_session_t
*
session
=
req
->
lpHttpS
ession
;
http_session_t
*
session
=
req
->
s
ession
;
INTERNET_DIAGNOSTIC_SOCKET_INFO
*
info
=
buffer
;
INTERNET_DIAGNOSTIC_SOCKET_INFO
*
info
=
buffer
;
FIXME
(
"INTERNET_DIAGNOSTIC_SOCKET_INFO stub
\n
"
);
FIXME
(
"INTERNET_DIAGNOSTIC_SOCKET_INFO stub
\n
"
);
...
@@ -1728,7 +1728,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
...
@@ -1728,7 +1728,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
strcatW
(
url
,
host
->
lpszValue
);
strcatW
(
url
,
host
->
lpszValue
);
if
(
NULL
!=
(
pch
=
strchrW
(
url
+
strlenW
(
httpW
),
':'
)))
if
(
NULL
!=
(
pch
=
strchrW
(
url
+
strlenW
(
httpW
),
':'
)))
*
pch
=
0
;
*
pch
=
0
;
strcatW
(
url
,
req
->
lpszP
ath
);
strcatW
(
url
,
req
->
p
ath
);
TRACE
(
"INTERNET_OPTION_URL: %s
\n
"
,
debugstr_w
(
url
));
TRACE
(
"INTERNET_OPTION_URL: %s
\n
"
,
debugstr_w
(
url
));
...
@@ -1790,25 +1790,25 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
...
@@ -1790,25 +1790,25 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
TRACE
(
"INTERNET_OPTION_DATAFILE_NAME
\n
"
);
TRACE
(
"INTERNET_OPTION_DATAFILE_NAME
\n
"
);
if
(
!
req
->
lpszC
acheFile
)
{
if
(
!
req
->
c
acheFile
)
{
*
size
=
0
;
*
size
=
0
;
return
ERROR_INTERNET_ITEM_NOT_FOUND
;
return
ERROR_INTERNET_ITEM_NOT_FOUND
;
}
}
if
(
unicode
)
{
if
(
unicode
)
{
req_size
=
(
lstrlenW
(
req
->
lpszC
acheFile
)
+
1
)
*
sizeof
(
WCHAR
);
req_size
=
(
lstrlenW
(
req
->
c
acheFile
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
*
size
<
req_size
)
if
(
*
size
<
req_size
)
return
ERROR_INSUFFICIENT_BUFFER
;
return
ERROR_INSUFFICIENT_BUFFER
;
*
size
=
req_size
;
*
size
=
req_size
;
memcpy
(
buffer
,
req
->
lpszC
acheFile
,
*
size
);
memcpy
(
buffer
,
req
->
c
acheFile
,
*
size
);
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
else
{
}
else
{
req_size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
req
->
lpszC
acheFile
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
req_size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
req
->
c
acheFile
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
req_size
>
*
size
)
if
(
req_size
>
*
size
)
return
ERROR_INSUFFICIENT_BUFFER
;
return
ERROR_INSUFFICIENT_BUFFER
;
*
size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
req
->
lpszC
acheFile
,
*
size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
req
->
c
acheFile
,
-
1
,
buffer
,
*
size
,
NULL
,
NULL
);
-
1
,
buffer
,
*
size
,
NULL
,
NULL
);
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
...
@@ -1881,13 +1881,13 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer,
...
@@ -1881,13 +1881,13 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer,
*
(
DWORD
*
)
buffer
);
*
(
DWORD
*
)
buffer
);
case
INTERNET_OPTION_USERNAME
:
case
INTERNET_OPTION_USERNAME
:
HeapFree
(
GetProcessHeap
(),
0
,
req
->
lpHttpS
ession
->
userName
);
HeapFree
(
GetProcessHeap
(),
0
,
req
->
s
ession
->
userName
);
if
(
!
(
req
->
lpHttpS
ession
->
userName
=
heap_strdupW
(
buffer
)))
return
ERROR_OUTOFMEMORY
;
if
(
!
(
req
->
s
ession
->
userName
=
heap_strdupW
(
buffer
)))
return
ERROR_OUTOFMEMORY
;
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
case
INTERNET_OPTION_PASSWORD
:
case
INTERNET_OPTION_PASSWORD
:
HeapFree
(
GetProcessHeap
(),
0
,
req
->
lpHttpS
ession
->
password
);
HeapFree
(
GetProcessHeap
(),
0
,
req
->
s
ession
->
password
);
if
(
!
(
req
->
lpHttpS
ession
->
password
=
heap_strdupW
(
buffer
)))
return
ERROR_OUTOFMEMORY
;
if
(
!
(
req
->
s
ession
->
password
=
heap_strdupW
(
buffer
)))
return
ERROR_OUTOFMEMORY
;
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
case
INTERNET_OPTION_HTTP_DECODING
:
case
INTERNET_OPTION_HTTP_DECODING
:
if
(
size
!=
sizeof
(
BOOL
))
if
(
size
!=
sizeof
(
BOOL
))
...
@@ -1998,13 +1998,13 @@ static DWORD start_next_chunk( http_request_t *req )
...
@@ -1998,13 +1998,13 @@ static DWORD start_next_chunk( http_request_t *req )
{
{
DWORD
chunk_size
=
0
,
res
;
DWORD
chunk_size
=
0
,
res
;
if
(
!
req
->
dwC
ontentLength
)
return
ERROR_SUCCESS
;
if
(
!
req
->
c
ontentLength
)
return
ERROR_SUCCESS
;
if
(
req
->
dwContentLength
==
req
->
dwC
ontentRead
)
if
(
req
->
contentLength
==
req
->
c
ontentRead
)
{
{
/* read terminator for the previous chunk */
/* read terminator for the previous chunk */
if
((
res
=
discard_eol
(
req
))
!=
ERROR_SUCCESS
)
return
res
;
if
((
res
=
discard_eol
(
req
))
!=
ERROR_SUCCESS
)
return
res
;
req
->
dwC
ontentLength
=
~
0u
;
req
->
c
ontentLength
=
~
0u
;
req
->
dwC
ontentRead
=
0
;
req
->
c
ontentRead
=
0
;
}
}
for
(;;)
for
(;;)
{
{
...
@@ -2017,8 +2017,8 @@ static DWORD start_next_chunk( http_request_t *req )
...
@@ -2017,8 +2017,8 @@ static DWORD start_next_chunk( http_request_t *req )
else
if
(
ch
==
';'
||
ch
==
'\r'
||
ch
==
'\n'
)
else
if
(
ch
==
';'
||
ch
==
'\r'
||
ch
==
'\n'
)
{
{
TRACE
(
"reading %u byte chunk
\n
"
,
chunk_size
);
TRACE
(
"reading %u byte chunk
\n
"
,
chunk_size
);
req
->
dwC
ontentLength
=
chunk_size
;
req
->
c
ontentLength
=
chunk_size
;
req
->
dwC
ontentRead
=
0
;
req
->
c
ontentRead
=
0
;
return
discard_eol
(
req
);
return
discard_eol
(
req
);
}
}
remove_data
(
req
,
1
);
remove_data
(
req
,
1
);
...
@@ -2026,7 +2026,7 @@ static DWORD start_next_chunk( http_request_t *req )
...
@@ -2026,7 +2026,7 @@ static DWORD start_next_chunk( http_request_t *req )
if
((
res
=
read_more_data
(
req
,
-
1
))
!=
ERROR_SUCCESS
)
return
res
;
if
((
res
=
read_more_data
(
req
,
-
1
))
!=
ERROR_SUCCESS
)
return
res
;
if
(
!
req
->
read_size
)
if
(
!
req
->
read_size
)
{
{
req
->
dwContentLength
=
req
->
dwC
ontentRead
=
0
;
req
->
contentLength
=
req
->
c
ontentRead
=
0
;
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
}
}
...
@@ -2036,9 +2036,9 @@ static DWORD start_next_chunk( http_request_t *req )
...
@@ -2036,9 +2036,9 @@ static DWORD start_next_chunk( http_request_t *req )
static
BOOL
end_of_read_data
(
http_request_t
*
req
)
static
BOOL
end_of_read_data
(
http_request_t
*
req
)
{
{
if
(
req
->
gzip_stream
)
return
req
->
gzip_stream
->
end_of_data
&&
!
req
->
gzip_stream
->
buf_size
;
if
(
req
->
gzip_stream
)
return
req
->
gzip_stream
->
end_of_data
&&
!
req
->
gzip_stream
->
buf_size
;
if
(
req
->
read_chunked
)
return
(
req
->
dwC
ontentLength
==
0
);
if
(
req
->
read_chunked
)
return
(
req
->
c
ontentLength
==
0
);
if
(
req
->
dwC
ontentLength
==
~
0u
)
return
FALSE
;
if
(
req
->
c
ontentLength
==
~
0u
)
return
FALSE
;
return
(
req
->
dwContentLength
==
req
->
dwC
ontentRead
);
return
(
req
->
contentLength
==
req
->
c
ontentRead
);
}
}
/* fetch some more data into the read buffer (the read section must be held) */
/* fetch some more data into the read buffer (the read section must be held) */
...
@@ -2047,16 +2047,16 @@ static DWORD refill_buffer( http_request_t *req )
...
@@ -2047,16 +2047,16 @@ static DWORD refill_buffer( http_request_t *req )
int
len
=
sizeof
(
req
->
read_buf
);
int
len
=
sizeof
(
req
->
read_buf
);
DWORD
res
;
DWORD
res
;
if
(
req
->
read_chunked
&&
(
req
->
dwContentLength
==
~
0u
||
req
->
dwContentLength
==
req
->
dwC
ontentRead
))
if
(
req
->
read_chunked
&&
(
req
->
contentLength
==
~
0u
||
req
->
contentLength
==
req
->
c
ontentRead
))
{
{
if
((
res
=
start_next_chunk
(
req
))
!=
ERROR_SUCCESS
)
return
res
;
if
((
res
=
start_next_chunk
(
req
))
!=
ERROR_SUCCESS
)
return
res
;
}
}
if
(
req
->
dwContentLength
!=
~
0u
)
len
=
min
(
len
,
req
->
dwContentLength
-
req
->
dwC
ontentRead
);
if
(
req
->
contentLength
!=
~
0u
)
len
=
min
(
len
,
req
->
contentLength
-
req
->
c
ontentRead
);
if
(
len
<=
req
->
read_size
)
return
ERROR_SUCCESS
;
if
(
len
<=
req
->
read_size
)
return
ERROR_SUCCESS
;
if
((
res
=
read_more_data
(
req
,
len
))
!=
ERROR_SUCCESS
)
return
res
;
if
((
res
=
read_more_data
(
req
,
len
))
!=
ERROR_SUCCESS
)
return
res
;
if
(
!
req
->
read_size
)
req
->
dwContentLength
=
req
->
dwC
ontentRead
=
0
;
if
(
!
req
->
read_size
)
req
->
contentLength
=
req
->
c
ontentRead
=
0
;
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
...
@@ -2076,10 +2076,10 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync,
...
@@ -2076,10 +2076,10 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync,
break
;
break
;
}
}
if
(
req
->
dwContentRead
==
req
->
dwC
ontentLength
)
if
(
req
->
contentRead
==
req
->
c
ontentLength
)
break
;
break
;
buf_avail
=
req
->
dwContentLength
==
~
0
?
req
->
read_size
:
min
(
req
->
read_size
,
req
->
dwContentLength
-
req
->
dwC
ontentRead
);
buf_avail
=
req
->
contentLength
==
~
0
?
req
->
read_size
:
min
(
req
->
read_size
,
req
->
contentLength
-
req
->
c
ontentRead
);
zstream
->
next_in
=
req
->
read_buf
+
req
->
read_pos
;
zstream
->
next_in
=
req
->
read_buf
+
req
->
read_pos
;
zstream
->
avail_in
=
buf_avail
;
zstream
->
avail_in
=
buf_avail
;
...
@@ -2087,7 +2087,7 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync,
...
@@ -2087,7 +2087,7 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync,
zstream
->
avail_out
=
size
-
read
;
zstream
->
avail_out
=
size
-
read
;
zres
=
inflate
(
zstream
,
Z_FULL_FLUSH
);
zres
=
inflate
(
zstream
,
Z_FULL_FLUSH
);
read
=
size
-
zstream
->
avail_out
;
read
=
size
-
zstream
->
avail_out
;
req
->
dwC
ontentRead
+=
buf_avail
-
zstream
->
avail_in
;
req
->
c
ontentRead
+=
buf_avail
-
zstream
->
avail_in
;
remove_data
(
req
,
buf_avail
-
zstream
->
avail_in
);
remove_data
(
req
,
buf_avail
-
zstream
->
avail_in
);
if
(
zres
==
Z_STREAM_END
)
{
if
(
zres
==
Z_STREAM_END
)
{
TRACE
(
"end of data
\n
"
);
TRACE
(
"end of data
\n
"
);
...
@@ -2133,9 +2133,9 @@ static DWORD get_avail_data( http_request_t *req )
...
@@ -2133,9 +2133,9 @@ static DWORD get_avail_data( http_request_t *req )
refill_gzip_buffer
(
req
);
refill_gzip_buffer
(
req
);
return
req
->
gzip_stream
->
buf_size
;
return
req
->
gzip_stream
->
buf_size
;
}
}
if
(
req
->
read_chunked
&&
(
req
->
dwContentLength
==
~
0u
||
req
->
dwContentLength
==
req
->
dwC
ontentRead
))
if
(
req
->
read_chunked
&&
(
req
->
contentLength
==
~
0u
||
req
->
contentLength
==
req
->
c
ontentRead
))
return
0
;
return
0
;
return
min
(
req
->
read_size
,
req
->
dwContentLength
-
req
->
dwC
ontentRead
);
return
min
(
req
->
read_size
,
req
->
contentLength
-
req
->
c
ontentRead
);
}
}
static
void
HTTP_ReceiveRequestData
(
http_request_t
*
req
,
BOOL
first_notif
)
static
void
HTTP_ReceiveRequestData
(
http_request_t
*
req
,
BOOL
first_notif
)
...
@@ -2168,7 +2168,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
...
@@ -2168,7 +2168,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
EnterCriticalSection
(
&
req
->
read_section
);
EnterCriticalSection
(
&
req
->
read_section
);
if
(
req
->
read_chunked
&&
(
req
->
dwContentLength
==
~
0u
||
req
->
dwContentLength
==
req
->
dwC
ontentRead
))
if
(
req
->
read_chunked
&&
(
req
->
contentLength
==
~
0u
||
req
->
contentLength
==
req
->
c
ontentRead
))
{
{
if
(
start_next_chunk
(
req
)
!=
ERROR_SUCCESS
)
goto
done
;
if
(
start_next_chunk
(
req
)
!=
ERROR_SUCCESS
)
goto
done
;
}
}
...
@@ -2191,7 +2191,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
...
@@ -2191,7 +2191,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
finished_reading
=
req
->
gzip_stream
->
end_of_data
&&
!
req
->
gzip_stream
->
buf_size
;
finished_reading
=
req
->
gzip_stream
->
end_of_data
&&
!
req
->
gzip_stream
->
buf_size
;
}
else
{
}
else
{
if
(
req
->
dwContentLength
!=
~
0u
)
size
=
min
(
size
,
req
->
dwContentLength
-
req
->
dwC
ontentRead
);
if
(
req
->
contentLength
!=
~
0u
)
size
=
min
(
size
,
req
->
contentLength
-
req
->
c
ontentRead
);
if
(
req
->
read_size
)
{
if
(
req
->
read_size
)
{
bytes_read
=
min
(
req
->
read_size
,
size
);
bytes_read
=
min
(
req
->
read_size
,
size
);
...
@@ -2206,16 +2206,16 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
...
@@ -2206,16 +2206,16 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
/* always return success, even if the network layer returns an error */
/* always return success, even if the network layer returns an error */
}
}
finished_reading
=
!
bytes_read
&&
req
->
dwContentRead
==
req
->
dwC
ontentLength
;
finished_reading
=
!
bytes_read
&&
req
->
contentRead
==
req
->
c
ontentLength
;
req
->
dwC
ontentRead
+=
bytes_read
;
req
->
c
ontentRead
+=
bytes_read
;
}
}
done:
done:
*
read
=
bytes_read
;
*
read
=
bytes_read
;
TRACE
(
"retrieved %u bytes (%u/%u)
\n
"
,
bytes_read
,
req
->
dwContentRead
,
req
->
dwC
ontentLength
);
TRACE
(
"retrieved %u bytes (%u/%u)
\n
"
,
bytes_read
,
req
->
contentRead
,
req
->
c
ontentLength
);
LeaveCriticalSection
(
&
req
->
read_section
);
LeaveCriticalSection
(
&
req
->
read_section
);
if
(
ret
==
ERROR_SUCCESS
&&
req
->
lpszC
acheFile
)
{
if
(
ret
==
ERROR_SUCCESS
&&
req
->
c
acheFile
)
{
BOOL
res
;
BOOL
res
;
DWORD
dwBytesWritten
;
DWORD
dwBytesWritten
;
...
@@ -2325,8 +2325,8 @@ static DWORD HTTPREQ_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffer
...
@@ -2325,8 +2325,8 @@ static DWORD HTTPREQ_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffer
else
else
break
;
break
;
if
(
!
req
->
read_chunked
||
read
==
size
||
req
->
dwContentLength
!=
req
->
dwC
ontentRead
if
(
!
req
->
read_chunked
||
read
==
size
||
req
->
contentLength
!=
req
->
c
ontentRead
||
!
req
->
dwC
ontentLength
||
(
req
->
gzip_stream
&&
req
->
gzip_stream
->
end_of_data
))
||
!
req
->
c
ontentLength
||
(
req
->
gzip_stream
&&
req
->
gzip_stream
->
end_of_data
))
break
;
break
;
LeaveCriticalSection
(
&
req
->
read_section
);
LeaveCriticalSection
(
&
req
->
read_section
);
...
@@ -2434,8 +2434,8 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer
...
@@ -2434,8 +2434,8 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer
else
else
break
;
break
;
if
(
!
req
->
read_chunked
||
read
==
size
||
req
->
dwContentLength
!=
req
->
dwC
ontentRead
if
(
!
req
->
read_chunked
||
read
==
size
||
req
->
contentLength
!=
req
->
c
ontentRead
||
!
req
->
dwC
ontentLength
||
(
req
->
gzip_stream
&&
req
->
gzip_stream
->
end_of_data
))
||
!
req
->
c
ontentLength
||
(
req
->
gzip_stream
&&
req
->
gzip_stream
->
end_of_data
))
break
;
break
;
LeaveCriticalSection
(
&
req
->
read_section
);
LeaveCriticalSection
(
&
req
->
read_section
);
...
@@ -2475,7 +2475,7 @@ static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
...
@@ -2475,7 +2475,7 @@ static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
*
written
=
0
;
*
written
=
0
;
res
=
NETCON_send
(
&
request
->
netConnection
,
buffer
,
size
,
0
,
(
LPINT
)
written
);
res
=
NETCON_send
(
&
request
->
netConnection
,
buffer
,
size
,
0
,
(
LPINT
)
written
);
if
(
res
==
ERROR_SUCCESS
)
if
(
res
==
ERROR_SUCCESS
)
request
->
dwB
ytesWritten
+=
*
written
;
request
->
b
ytesWritten
+=
*
written
;
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
INTERNET_STATUS_REQUEST_SENT
,
written
,
sizeof
(
DWORD
));
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
INTERNET_STATUS_REQUEST_SENT
,
written
,
sizeof
(
DWORD
));
return
res
;
return
res
;
...
@@ -2494,7 +2494,7 @@ static DWORD HTTPREQ_QueryDataAvailable(object_header_t *hdr, DWORD *available,
...
@@ -2494,7 +2494,7 @@ static DWORD HTTPREQ_QueryDataAvailable(object_header_t *hdr, DWORD *available,
TRACE
(
"(%p %p %x %lx)
\n
"
,
req
,
available
,
flags
,
ctx
);
TRACE
(
"(%p %p %x %lx)
\n
"
,
req
,
available
,
flags
,
ctx
);
if
(
req
->
lpHttpS
ession
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
if
(
req
->
s
ession
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
{
WORKREQUEST
workRequest
;
WORKREQUEST
workRequest
;
...
@@ -2527,7 +2527,7 @@ done:
...
@@ -2527,7 +2527,7 @@ done:
{
{
DWORD
extra
;
DWORD
extra
;
if
(
NETCON_query_data_available
(
&
req
->
netConnection
,
&
extra
))
if
(
NETCON_query_data_available
(
&
req
->
netConnection
,
&
extra
))
*
available
=
min
(
*
available
+
extra
,
req
->
dwContentLength
-
req
->
dwC
ontentRead
);
*
available
=
min
(
*
available
+
extra
,
req
->
contentLength
-
req
->
c
ontentRead
);
}
}
LeaveCriticalSection
(
&
req
->
read_section
);
LeaveCriticalSection
(
&
req
->
read_section
);
...
@@ -2581,12 +2581,12 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
...
@@ -2581,12 +2581,12 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
request
->
hdr
.
htype
=
WH_HHTTPREQ
;
request
->
hdr
.
htype
=
WH_HHTTPREQ
;
request
->
hdr
.
dwFlags
=
dwFlags
;
request
->
hdr
.
dwFlags
=
dwFlags
;
request
->
hdr
.
dwContext
=
dwContext
;
request
->
hdr
.
dwContext
=
dwContext
;
request
->
dwC
ontentLength
=
~
0u
;
request
->
c
ontentLength
=
~
0u
;
InitializeCriticalSection
(
&
request
->
read_section
);
InitializeCriticalSection
(
&
request
->
read_section
);
WININET_AddRef
(
&
session
->
hdr
);
WININET_AddRef
(
&
session
->
hdr
);
request
->
lpHttpS
ession
=
session
;
request
->
s
ession
=
session
;
list_add_head
(
&
session
->
hdr
.
children
,
&
request
->
hdr
.
entry
);
list_add_head
(
&
session
->
hdr
.
children
,
&
request
->
hdr
.
entry
);
lpszHostName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
lpszHostName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
...
@@ -2607,18 +2607,18 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
...
@@ -2607,18 +2607,18 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
rc
=
UrlEscapeW
(
lpszObjectName
,
NULL
,
&
len
,
URL_ESCAPE_SPACES_ONLY
);
rc
=
UrlEscapeW
(
lpszObjectName
,
NULL
,
&
len
,
URL_ESCAPE_SPACES_ONLY
);
if
(
rc
!=
E_POINTER
)
if
(
rc
!=
E_POINTER
)
len
=
strlenW
(
lpszObjectName
)
+
1
;
len
=
strlenW
(
lpszObjectName
)
+
1
;
request
->
lpszP
ath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
request
->
p
ath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
rc
=
UrlEscapeW
(
lpszObjectName
,
request
->
lpszP
ath
,
&
len
,
rc
=
UrlEscapeW
(
lpszObjectName
,
request
->
p
ath
,
&
len
,
URL_ESCAPE_SPACES_ONLY
);
URL_ESCAPE_SPACES_ONLY
);
if
(
rc
!=
S_OK
)
if
(
rc
!=
S_OK
)
{
{
ERR
(
"Unable to escape string!(%s) (%d)
\n
"
,
debugstr_w
(
lpszObjectName
),
rc
);
ERR
(
"Unable to escape string!(%s) (%d)
\n
"
,
debugstr_w
(
lpszObjectName
),
rc
);
strcpyW
(
request
->
lpszP
ath
,
lpszObjectName
);
strcpyW
(
request
->
p
ath
,
lpszObjectName
);
}
}
}
else
{
}
else
{
static
const
WCHAR
slashW
[]
=
{
'/'
,
0
};
static
const
WCHAR
slashW
[]
=
{
'/'
,
0
};
request
->
lpszP
ath
=
heap_strdupW
(
slashW
);
request
->
p
ath
=
heap_strdupW
(
slashW
);
}
}
if
(
lpszReferrer
&&
*
lpszReferrer
)
if
(
lpszReferrer
&&
*
lpszReferrer
)
...
@@ -2637,8 +2637,8 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
...
@@ -2637,8 +2637,8 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
}
}
}
}
request
->
lpszV
erb
=
heap_strdupW
(
lpszVerb
&&
*
lpszVerb
?
lpszVerb
:
szGET
);
request
->
v
erb
=
heap_strdupW
(
lpszVerb
&&
*
lpszVerb
?
lpszVerb
:
szGET
);
request
->
lpszV
ersion
=
heap_strdupW
(
lpszVersion
?
lpszVersion
:
g_szHttp1_1
);
request
->
v
ersion
=
heap_strdupW
(
lpszVersion
?
lpszVersion
:
g_szHttp1_1
);
if
(
session
->
hostPort
!=
INTERNET_INVALID_PORT_NUMBER
&&
if
(
session
->
hostPort
!=
INTERNET_INVALID_PORT_NUMBER
&&
session
->
hostPort
!=
INTERNET_DEFAULT_HTTP_PORT
&&
session
->
hostPort
!=
INTERNET_DEFAULT_HTTP_PORT
&&
...
@@ -2747,12 +2747,12 @@ static void HTTP_DrainContent(http_request_t *req)
...
@@ -2747,12 +2747,12 @@ static void HTTP_DrainContent(http_request_t *req)
if
(
!
NETCON_connected
(
&
req
->
netConnection
))
return
;
if
(
!
NETCON_connected
(
&
req
->
netConnection
))
return
;
if
(
req
->
dwC
ontentLength
==
-
1
)
if
(
req
->
c
ontentLength
==
-
1
)
{
{
NETCON_close
(
&
req
->
netConnection
);
NETCON_close
(
&
req
->
netConnection
);
return
;
return
;
}
}
if
(
!
strcmpW
(
req
->
lpszV
erb
,
szHEAD
))
return
;
if
(
!
strcmpW
(
req
->
v
erb
,
szHEAD
))
return
;
do
do
{
{
...
@@ -2864,9 +2864,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2864,9 +2864,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
DWORD
res
=
ERROR_INVALID_PARAMETER
;
DWORD
res
=
ERROR_INVALID_PARAMETER
;
if
(
request_only
)
if
(
request_only
)
headers
=
HTTP_BuildHeaderRequestString
(
request
,
request
->
lpszVerb
,
request
->
lpszPath
,
request
->
lpszV
ersion
);
headers
=
HTTP_BuildHeaderRequestString
(
request
,
request
->
verb
,
request
->
path
,
request
->
v
ersion
);
else
else
headers
=
request
->
lpszR
awHeaders
;
headers
=
request
->
r
awHeaders
;
if
(
headers
)
if
(
headers
)
len
=
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
len
=
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
...
@@ -2896,7 +2896,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2896,7 +2896,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
}
case
HTTP_QUERY_RAW_HEADERS
:
case
HTTP_QUERY_RAW_HEADERS
:
{
{
LPWSTR
*
ppszRawHeaderLines
=
HTTP_Tokenize
(
request
->
lpszR
awHeaders
,
szCrLf
);
LPWSTR
*
ppszRawHeaderLines
=
HTTP_Tokenize
(
request
->
r
awHeaders
,
szCrLf
);
DWORD
i
,
size
=
0
;
DWORD
i
,
size
=
0
;
LPWSTR
pszString
=
lpBuffer
;
LPWSTR
pszString
=
lpBuffer
;
...
@@ -2926,9 +2926,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2926,9 +2926,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
}
}
case
HTTP_QUERY_STATUS_TEXT
:
case
HTTP_QUERY_STATUS_TEXT
:
if
(
request
->
lpszS
tatusText
)
if
(
request
->
s
tatusText
)
{
{
DWORD
len
=
strlenW
(
request
->
lpszS
tatusText
);
DWORD
len
=
strlenW
(
request
->
s
tatusText
);
if
(
len
+
1
>
*
lpdwBufferLength
/
sizeof
(
WCHAR
))
if
(
len
+
1
>
*
lpdwBufferLength
/
sizeof
(
WCHAR
))
{
{
*
lpdwBufferLength
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
*
lpdwBufferLength
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
...
@@ -2936,7 +2936,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2936,7 +2936,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
}
if
(
lpBuffer
)
if
(
lpBuffer
)
{
{
memcpy
(
lpBuffer
,
request
->
lpszS
tatusText
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
lpBuffer
,
request
->
s
tatusText
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
TRACE
(
"returning data: %s
\n
"
,
debugstr_wn
(
lpBuffer
,
len
));
TRACE
(
"returning data: %s
\n
"
,
debugstr_wn
(
lpBuffer
,
len
));
}
}
*
lpdwBufferLength
=
len
*
sizeof
(
WCHAR
);
*
lpdwBufferLength
=
len
*
sizeof
(
WCHAR
);
...
@@ -2944,9 +2944,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2944,9 +2944,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
}
break
;
break
;
case
HTTP_QUERY_VERSION
:
case
HTTP_QUERY_VERSION
:
if
(
request
->
lpszV
ersion
)
if
(
request
->
v
ersion
)
{
{
DWORD
len
=
strlenW
(
request
->
lpszV
ersion
);
DWORD
len
=
strlenW
(
request
->
v
ersion
);
if
(
len
+
1
>
*
lpdwBufferLength
/
sizeof
(
WCHAR
))
if
(
len
+
1
>
*
lpdwBufferLength
/
sizeof
(
WCHAR
))
{
{
*
lpdwBufferLength
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
*
lpdwBufferLength
=
(
len
+
1
)
*
sizeof
(
WCHAR
);
...
@@ -2954,7 +2954,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2954,7 +2954,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
}
if
(
lpBuffer
)
if
(
lpBuffer
)
{
{
memcpy
(
lpBuffer
,
request
->
lpszV
ersion
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
lpBuffer
,
request
->
v
ersion
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
TRACE
(
"returning data: %s
\n
"
,
debugstr_wn
(
lpBuffer
,
len
));
TRACE
(
"returning data: %s
\n
"
,
debugstr_wn
(
lpBuffer
,
len
));
}
}
*
lpdwBufferLength
=
len
*
sizeof
(
WCHAR
);
*
lpdwBufferLength
=
len
*
sizeof
(
WCHAR
);
...
@@ -2974,7 +2974,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
...
@@ -2974,7 +2974,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
}
}
if
(
index
>=
0
)
if
(
index
>=
0
)
lphttpHdr
=
&
request
->
pC
ustHeaders
[
index
];
lphttpHdr
=
&
request
->
c
ustHeaders
[
index
];
/* Ensure header satisfies requested attributes */
/* Ensure header satisfies requested attributes */
if
(
!
lphttpHdr
||
if
(
!
lphttpHdr
||
...
@@ -3256,7 +3256,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
...
@@ -3256,7 +3256,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
{
{
static
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
WCHAR
szHttps
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
static
WCHAR
szHttps
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
http_session_t
*
session
=
request
->
lpHttpS
ession
;
http_session_t
*
session
=
request
->
s
ession
;
URL_COMPONENTSW
urlComponents
;
URL_COMPONENTSW
urlComponents
;
DWORD
url_length
=
0
;
DWORD
url_length
=
0
;
LPWSTR
orig_url
;
LPWSTR
orig_url
;
...
@@ -3272,7 +3272,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
...
@@ -3272,7 +3272,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
urlComponents
.
dwUserNameLength
=
0
;
urlComponents
.
dwUserNameLength
=
0
;
urlComponents
.
lpszPassword
=
NULL
;
urlComponents
.
lpszPassword
=
NULL
;
urlComponents
.
dwPasswordLength
=
0
;
urlComponents
.
dwPasswordLength
=
0
;
urlComponents
.
lpszUrlPath
=
request
->
lpszP
ath
;
urlComponents
.
lpszUrlPath
=
request
->
p
ath
;
urlComponents
.
dwUrlPathLength
=
0
;
urlComponents
.
dwUrlPathLength
=
0
;
urlComponents
.
lpszExtraInfo
=
NULL
;
urlComponents
.
lpszExtraInfo
=
NULL
;
urlComponents
.
dwExtraInfoLength
=
0
;
urlComponents
.
dwExtraInfoLength
=
0
;
...
@@ -3316,7 +3316,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
...
@@ -3316,7 +3316,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
*/
*/
static
DWORD
HTTP_HandleRedirect
(
http_request_t
*
request
,
LPCWSTR
lpszUrl
)
static
DWORD
HTTP_HandleRedirect
(
http_request_t
*
request
,
LPCWSTR
lpszUrl
)
{
{
http_session_t
*
session
=
request
->
lpHttpS
ession
;
http_session_t
*
session
=
request
->
s
ession
;
appinfo_t
*
hIC
=
session
->
appInfo
;
appinfo_t
*
hIC
=
session
->
appInfo
;
BOOL
using_proxy
=
hIC
->
proxy
&&
hIC
->
proxy
[
0
];
BOOL
using_proxy
=
hIC
->
proxy
&&
hIC
->
proxy
[
0
];
WCHAR
path
[
INTERNET_MAX_URL_LENGTH
];
WCHAR
path
[
INTERNET_MAX_URL_LENGTH
];
...
@@ -3441,8 +3441,8 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
...
@@ -3441,8 +3441,8 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
TRACE
(
"Redirect through proxy
\n
"
);
TRACE
(
"Redirect through proxy
\n
"
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszP
ath
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
p
ath
);
request
->
lpszP
ath
=
NULL
;
request
->
p
ath
=
NULL
;
if
(
*
path
)
if
(
*
path
)
{
{
DWORD
needed
=
0
;
DWORD
needed
=
0
;
...
@@ -3451,13 +3451,13 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
...
@@ -3451,13 +3451,13 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
rc
=
UrlEscapeW
(
path
,
NULL
,
&
needed
,
URL_ESCAPE_SPACES_ONLY
);
rc
=
UrlEscapeW
(
path
,
NULL
,
&
needed
,
URL_ESCAPE_SPACES_ONLY
);
if
(
rc
!=
E_POINTER
)
if
(
rc
!=
E_POINTER
)
needed
=
strlenW
(
path
)
+
1
;
needed
=
strlenW
(
path
)
+
1
;
request
->
lpszP
ath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
*
sizeof
(
WCHAR
));
request
->
p
ath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
*
sizeof
(
WCHAR
));
rc
=
UrlEscapeW
(
path
,
request
->
lpszP
ath
,
&
needed
,
rc
=
UrlEscapeW
(
path
,
request
->
p
ath
,
&
needed
,
URL_ESCAPE_SPACES_ONLY
);
URL_ESCAPE_SPACES_ONLY
);
if
(
rc
!=
S_OK
)
if
(
rc
!=
S_OK
)
{
{
ERR
(
"Unable to escape string!(%s) (%d)
\n
"
,
debugstr_w
(
path
),
rc
);
ERR
(
"Unable to escape string!(%s) (%d)
\n
"
,
debugstr_w
(
path
),
rc
);
strcpyW
(
request
->
lpszP
ath
,
path
);
strcpyW
(
request
->
p
ath
,
path
);
}
}
}
}
...
@@ -3506,7 +3506,7 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request)
...
@@ -3506,7 +3506,7 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request)
DWORD
res
;
DWORD
res
;
static
const
WCHAR
szConnect
[]
=
{
'C'
,
'O'
,
'N'
,
'N'
,
'E'
,
'C'
,
'T'
,
0
};
static
const
WCHAR
szConnect
[]
=
{
'C'
,
'O'
,
'N'
,
'N'
,
'E'
,
'C'
,
'T'
,
0
};
static
const
WCHAR
szFormat
[]
=
{
'%'
,
's'
,
':'
,
'%'
,
'd'
,
0
};
static
const
WCHAR
szFormat
[]
=
{
'%'
,
's'
,
':'
,
'%'
,
'd'
,
0
};
http_session_t
*
session
=
request
->
lpHttpS
ession
;
http_session_t
*
session
=
request
->
s
ession
;
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -3544,9 +3544,9 @@ static void HTTP_InsertCookies(http_request_t *request)
...
@@ -3544,9 +3544,9 @@ static void HTTP_InsertCookies(http_request_t *request)
DWORD
nCookieSize
,
size
;
DWORD
nCookieSize
,
size
;
LPHTTPHEADERW
Host
=
HTTP_GetHeader
(
request
,
hostW
);
LPHTTPHEADERW
Host
=
HTTP_GetHeader
(
request
,
hostW
);
size
=
(
strlenW
(
Host
->
lpszValue
)
+
strlenW
(
szUrlForm
)
+
strlenW
(
request
->
lpszP
ath
))
*
sizeof
(
WCHAR
);
size
=
(
strlenW
(
Host
->
lpszValue
)
+
strlenW
(
szUrlForm
)
+
strlenW
(
request
->
p
ath
))
*
sizeof
(
WCHAR
);
if
(
!
(
lpszUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
;
if
(
!
(
lpszUrl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
;
sprintfW
(
lpszUrl
,
szUrlForm
,
Host
->
lpszValue
,
request
->
lpszP
ath
);
sprintfW
(
lpszUrl
,
szUrlForm
,
Host
->
lpszValue
,
request
->
p
ath
);
if
(
InternetGetCookieW
(
lpszUrl
,
NULL
,
NULL
,
&
nCookieSize
))
if
(
InternetGetCookieW
(
lpszUrl
,
NULL
,
NULL
,
&
nCookieSize
))
{
{
...
@@ -3598,24 +3598,24 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3598,24 +3598,24 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
assert
(
request
->
hdr
.
htype
==
WH_HHTTPREQ
);
assert
(
request
->
hdr
.
htype
==
WH_HHTTPREQ
);
/* if the verb is NULL default to GET */
/* if the verb is NULL default to GET */
if
(
!
request
->
lpszV
erb
)
if
(
!
request
->
v
erb
)
request
->
lpszV
erb
=
heap_strdupW
(
szGET
);
request
->
v
erb
=
heap_strdupW
(
szGET
);
if
(
dwContentLength
||
strcmpW
(
request
->
lpszV
erb
,
szGET
))
if
(
dwContentLength
||
strcmpW
(
request
->
v
erb
,
szGET
))
{
{
sprintfW
(
contentLengthStr
,
szContentLength
,
dwContentLength
);
sprintfW
(
contentLengthStr
,
szContentLength
,
dwContentLength
);
HTTP_HttpAddRequestHeadersW
(
request
,
contentLengthStr
,
-
1L
,
HTTP_ADDREQ_FLAG_REPLACE
);
HTTP_HttpAddRequestHeadersW
(
request
,
contentLengthStr
,
-
1L
,
HTTP_ADDREQ_FLAG_REPLACE
);
request
->
dwB
ytesToWrite
=
dwContentLength
;
request
->
b
ytesToWrite
=
dwContentLength
;
}
}
if
(
request
->
lpHttpS
ession
->
appInfo
->
agent
)
if
(
request
->
s
ession
->
appInfo
->
agent
)
{
{
WCHAR
*
agent_header
;
WCHAR
*
agent_header
;
static
const
WCHAR
user_agent
[]
=
{
'U'
,
's'
,
'e'
,
'r'
,
'-'
,
'A'
,
'g'
,
'e'
,
'n'
,
't'
,
':'
,
' '
,
'%'
,
's'
,
'\r'
,
'\n'
,
0
};
static
const
WCHAR
user_agent
[]
=
{
'U'
,
's'
,
'e'
,
'r'
,
'-'
,
'A'
,
'g'
,
'e'
,
'n'
,
't'
,
':'
,
' '
,
'%'
,
's'
,
'\r'
,
'\n'
,
0
};
int
len
;
int
len
;
len
=
strlenW
(
request
->
lpHttpS
ession
->
appInfo
->
agent
)
+
strlenW
(
user_agent
);
len
=
strlenW
(
request
->
s
ession
->
appInfo
->
agent
)
+
strlenW
(
user_agent
);
agent_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
agent_header
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
sprintfW
(
agent_header
,
user_agent
,
request
->
lpHttpS
ession
->
appInfo
->
agent
);
sprintfW
(
agent_header
,
user_agent
,
request
->
s
ession
->
appInfo
->
agent
);
HTTP_HttpAddRequestHeadersW
(
request
,
agent_header
,
strlenW
(
agent_header
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
HTTP_HttpAddRequestHeadersW
(
request
,
agent_header
,
strlenW
(
agent_header
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
HeapFree
(
GetProcessHeap
(),
0
,
agent_header
);
HeapFree
(
GetProcessHeap
(),
0
,
agent_header
);
...
@@ -3625,7 +3625,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3625,7 +3625,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
static
const
WCHAR
pragma_nocache
[]
=
{
'P'
,
'r'
,
'a'
,
'g'
,
'm'
,
'a'
,
':'
,
' '
,
'n'
,
'o'
,
'-'
,
'c'
,
'a'
,
'c'
,
'h'
,
'e'
,
'\r'
,
'\n'
,
0
};
static
const
WCHAR
pragma_nocache
[]
=
{
'P'
,
'r'
,
'a'
,
'g'
,
'm'
,
'a'
,
':'
,
' '
,
'n'
,
'o'
,
'-'
,
'c'
,
'a'
,
'c'
,
'h'
,
'e'
,
'\r'
,
'\n'
,
0
};
HTTP_HttpAddRequestHeadersW
(
request
,
pragma_nocache
,
strlenW
(
pragma_nocache
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
HTTP_HttpAddRequestHeadersW
(
request
,
pragma_nocache
,
strlenW
(
pragma_nocache
),
HTTP_ADDREQ_FLAG_ADD_IF_NEW
);
}
}
if
((
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_CACHE_WRITE
)
&&
!
strcmpW
(
request
->
lpszV
erb
,
szPost
))
if
((
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_CACHE_WRITE
)
&&
!
strcmpW
(
request
->
v
erb
,
szPost
))
{
{
static
const
WCHAR
cache_control
[]
=
{
'C'
,
'a'
,
'c'
,
'h'
,
'e'
,
'-'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
':'
,
static
const
WCHAR
cache_control
[]
=
{
'C'
,
'a'
,
'c'
,
'h'
,
'e'
,
'-'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
':'
,
' '
,
'n'
,
'o'
,
'-'
,
'c'
,
'a'
,
'c'
,
'h'
,
'e'
,
'\r'
,
'\n'
,
0
};
' '
,
'n'
,
'o'
,
'-'
,
'c'
,
'a'
,
'c'
,
'h'
,
'e'
,
'\r'
,
'\n'
,
0
};
...
@@ -3643,16 +3643,16 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3643,16 +3643,16 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
/* like native, just in case the caller forgot to call InternetReadFile
/* like native, just in case the caller forgot to call InternetReadFile
* for all the data */
* for all the data */
HTTP_DrainContent
(
request
);
HTTP_DrainContent
(
request
);
request
->
dwC
ontentRead
=
0
;
request
->
c
ontentRead
=
0
;
if
(
redirected
)
{
if
(
redirected
)
{
request
->
dwC
ontentLength
=
~
0u
;
request
->
c
ontentLength
=
~
0u
;
request
->
dwB
ytesToWrite
=
0
;
request
->
b
ytesToWrite
=
0
;
}
}
if
(
TRACE_ON
(
wininet
))
if
(
TRACE_ON
(
wininet
))
{
{
LPHTTPHEADERW
Host
=
HTTP_GetHeader
(
request
,
hostW
);
LPHTTPHEADERW
Host
=
HTTP_GetHeader
(
request
,
hostW
);
TRACE
(
"Going to url %s %s
\n
"
,
debugstr_w
(
Host
->
lpszValue
),
debugstr_w
(
request
->
lpszP
ath
));
TRACE
(
"Going to url %s %s
\n
"
,
debugstr_w
(
Host
->
lpszValue
),
debugstr_w
(
request
->
p
ath
));
}
}
HTTP_FixURL
(
request
);
HTTP_FixURL
(
request
);
...
@@ -3660,8 +3660,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3660,8 +3660,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
{
{
HTTP_ProcessHeader
(
request
,
szConnection
,
szKeepAlive
,
HTTP_ADDHDR_FLAG_REQ
|
HTTP_ADDHDR_FLAG_REPLACE
);
HTTP_ProcessHeader
(
request
,
szConnection
,
szKeepAlive
,
HTTP_ADDHDR_FLAG_REQ
|
HTTP_ADDHDR_FLAG_REPLACE
);
}
}
HTTP_InsertAuthorization
(
request
,
request
->
pA
uthInfo
,
szAuthorization
);
HTTP_InsertAuthorization
(
request
,
request
->
a
uthInfo
,
szAuthorization
);
HTTP_InsertAuthorization
(
request
,
request
->
p
P
roxyAuthInfo
,
szProxy_Authorization
);
HTTP_InsertAuthorization
(
request
,
request
->
proxyAuthInfo
,
szProxy_Authorization
);
if
(
!
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_COOKIES
))
if
(
!
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_NO_COOKIES
))
HTTP_InsertCookies
(
request
);
HTTP_InsertCookies
(
request
);
...
@@ -3673,14 +3673,14 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3673,14 +3673,14 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
HTTP_ADDREQ_FLAG_ADD
|
HTTP_ADDHDR_FLAG_REPLACE
);
HTTP_ADDREQ_FLAG_ADD
|
HTTP_ADDHDR_FLAG_REPLACE
);
}
}
if
(
request
->
lpHttpSession
->
appInfo
->
proxy
&&
request
->
lpHttpS
ession
->
appInfo
->
proxy
[
0
])
if
(
request
->
session
->
appInfo
->
proxy
&&
request
->
s
ession
->
appInfo
->
proxy
[
0
])
{
{
WCHAR
*
url
=
HTTP_BuildProxyRequestUrl
(
request
);
WCHAR
*
url
=
HTTP_BuildProxyRequestUrl
(
request
);
requestString
=
HTTP_BuildHeaderRequestString
(
request
,
request
->
lpszVerb
,
url
,
request
->
lpszV
ersion
);
requestString
=
HTTP_BuildHeaderRequestString
(
request
,
request
->
verb
,
url
,
request
->
v
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
url
);
HeapFree
(
GetProcessHeap
(),
0
,
url
);
}
}
else
else
requestString
=
HTTP_BuildHeaderRequestString
(
request
,
request
->
lpszVerb
,
request
->
lpszPath
,
request
->
lpszV
ersion
);
requestString
=
HTTP_BuildHeaderRequestString
(
request
,
request
->
verb
,
request
->
path
,
request
->
v
ersion
);
TRACE
(
"Request header -> %s
\n
"
,
debugstr_w
(
requestString
)
);
TRACE
(
"Request header -> %s
\n
"
,
debugstr_w
(
requestString
)
);
...
@@ -3714,7 +3714,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3714,7 +3714,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
res
=
NETCON_send
(
&
request
->
netConnection
,
ascii_req
,
len
,
0
,
&
cnt
);
res
=
NETCON_send
(
&
request
->
netConnection
,
ascii_req
,
len
,
0
,
&
cnt
);
HeapFree
(
GetProcessHeap
(),
0
,
ascii_req
);
HeapFree
(
GetProcessHeap
(),
0
,
ascii_req
);
request
->
dwB
ytesWritten
=
dwOptionalLength
;
request
->
b
ytesWritten
=
dwOptionalLength
;
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
INTERNET_SendCallback
(
&
request
->
hdr
,
request
->
hdr
.
dwContext
,
INTERNET_STATUS_REQUEST_SENT
,
INTERNET_STATUS_REQUEST_SENT
,
...
@@ -3762,10 +3762,10 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3762,10 +3762,10 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
dwStatusCode
==
HTTP_STATUS_REDIRECT_METHOD
)
&&
dwStatusCode
==
HTTP_STATUS_REDIRECT_METHOD
)
&&
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_LOCATION
,
szNewLocation
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
)
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_LOCATION
,
szNewLocation
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
)
{
{
if
(
strcmpW
(
request
->
lpszVerb
,
szGET
)
&&
strcmpW
(
request
->
lpszV
erb
,
szHEAD
))
if
(
strcmpW
(
request
->
verb
,
szGET
)
&&
strcmpW
(
request
->
v
erb
,
szHEAD
))
{
{
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszV
erb
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
v
erb
);
request
->
lpszV
erb
=
heap_strdupW
(
szGET
);
request
->
v
erb
=
heap_strdupW
(
szGET
);
}
}
HTTP_DrainContent
(
request
);
HTTP_DrainContent
(
request
);
if
((
new_url
=
HTTP_GetRedirectURL
(
request
,
szNewLocation
)))
if
((
new_url
=
HTTP_GetRedirectURL
(
request
,
szNewLocation
)))
...
@@ -3794,9 +3794,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3794,9 +3794,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
while
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_WWW_AUTHENTICATE
,
szAuthValue
,
&
dwBufferSize
,
&
dwIndex
)
==
ERROR_SUCCESS
)
while
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_WWW_AUTHENTICATE
,
szAuthValue
,
&
dwBufferSize
,
&
dwIndex
)
==
ERROR_SUCCESS
)
{
{
if
(
HTTP_DoAuthorization
(
request
,
szAuthValue
,
if
(
HTTP_DoAuthorization
(
request
,
szAuthValue
,
&
request
->
pA
uthInfo
,
&
request
->
a
uthInfo
,
request
->
lpHttpS
ession
->
userName
,
request
->
s
ession
->
userName
,
request
->
lpHttpS
ession
->
password
,
request
->
s
ession
->
password
,
Host
->
lpszValue
))
Host
->
lpszValue
))
{
{
HeapFree
(
GetProcessHeap
(),
0
,
requestString
);
HeapFree
(
GetProcessHeap
(),
0
,
requestString
);
...
@@ -3807,8 +3807,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3807,8 +3807,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if
(
!
loop_next
)
{
if
(
!
loop_next
)
{
TRACE
(
"Cleaning wrong authorization data
\n
"
);
TRACE
(
"Cleaning wrong authorization data
\n
"
);
destroy_authinfo
(
request
->
pA
uthInfo
);
destroy_authinfo
(
request
->
a
uthInfo
);
request
->
pA
uthInfo
=
NULL
;
request
->
a
uthInfo
=
NULL
;
}
}
}
}
if
(
dwStatusCode
==
HTTP_STATUS_PROXY_AUTH_REQ
)
if
(
dwStatusCode
==
HTTP_STATUS_PROXY_AUTH_REQ
)
...
@@ -3817,9 +3817,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3817,9 +3817,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
while
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_PROXY_AUTHENTICATE
,
szAuthValue
,
&
dwBufferSize
,
&
dwIndex
)
==
ERROR_SUCCESS
)
while
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_PROXY_AUTHENTICATE
,
szAuthValue
,
&
dwBufferSize
,
&
dwIndex
)
==
ERROR_SUCCESS
)
{
{
if
(
HTTP_DoAuthorization
(
request
,
szAuthValue
,
if
(
HTTP_DoAuthorization
(
request
,
szAuthValue
,
&
request
->
p
P
roxyAuthInfo
,
&
request
->
proxyAuthInfo
,
request
->
lpHttpS
ession
->
appInfo
->
proxyUsername
,
request
->
s
ession
->
appInfo
->
proxyUsername
,
request
->
lpHttpS
ession
->
appInfo
->
proxyPassword
,
request
->
s
ession
->
appInfo
->
proxyPassword
,
NULL
))
NULL
))
{
{
loop_next
=
TRUE
;
loop_next
=
TRUE
;
...
@@ -3829,8 +3829,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3829,8 +3829,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if
(
!
loop_next
)
{
if
(
!
loop_next
)
{
TRACE
(
"Cleaning wrong proxy authorization data
\n
"
);
TRACE
(
"Cleaning wrong proxy authorization data
\n
"
);
destroy_authinfo
(
request
->
p
P
roxyAuthInfo
);
destroy_authinfo
(
request
->
proxyAuthInfo
);
request
->
p
P
roxyAuthInfo
=
NULL
;
request
->
proxyAuthInfo
=
NULL
;
}
}
}
}
}
}
...
@@ -3851,13 +3851,13 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
...
@@ -3851,13 +3851,13 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
goto
lend
;
goto
lend
;
}
}
b
=
CreateUrlCacheEntryW
(
url
,
request
->
dwContentLength
>
0
?
request
->
dwC
ontentLength
:
0
,
NULL
,
cacheFileName
,
0
);
b
=
CreateUrlCacheEntryW
(
url
,
request
->
contentLength
>
0
?
request
->
c
ontentLength
:
0
,
NULL
,
cacheFileName
,
0
);
if
(
b
)
{
if
(
b
)
{
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszC
acheFile
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
acheFile
);
CloseHandle
(
request
->
hCacheFile
);
CloseHandle
(
request
->
hCacheFile
);
request
->
lpszC
acheFile
=
heap_strdupW
(
cacheFileName
);
request
->
c
acheFile
=
heap_strdupW
(
cacheFileName
);
request
->
hCacheFile
=
CreateFileW
(
request
->
lpszC
acheFile
,
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
request
->
hCacheFile
=
CreateFileW
(
request
->
c
acheFile
,
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
request
->
hCacheFile
==
INVALID_HANDLE_VALUE
)
{
if
(
request
->
hCacheFile
==
INVALID_HANDLE_VALUE
)
{
WARN
(
"Could not create file: %u
\n
"
,
GetLastError
());
WARN
(
"Could not create file: %u
\n
"
,
GetLastError
());
...
@@ -3874,9 +3874,9 @@ lend:
...
@@ -3874,9 +3874,9 @@ lend:
/* TODO: send notification for P3P header */
/* TODO: send notification for P3P header */
if
(
request
->
lpHttpS
ession
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
if
(
request
->
s
ession
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
{
if
(
res
==
ERROR_SUCCESS
&&
request
->
dwBytesWritten
==
request
->
dwB
ytesToWrite
)
if
(
res
==
ERROR_SUCCESS
&&
request
->
bytesWritten
==
request
->
b
ytesToWrite
)
HTTP_ReceiveRequestData
(
request
,
TRUE
);
HTTP_ReceiveRequestData
(
request
,
TRUE
);
else
else
{
{
...
@@ -3945,10 +3945,10 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
...
@@ -3945,10 +3945,10 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
dwBufferSize
=
sizeof
(
szNewLocation
);
dwBufferSize
=
sizeof
(
szNewLocation
);
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_LOCATION
,
szNewLocation
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
)
if
(
HTTP_HttpQueryInfoW
(
request
,
HTTP_QUERY_LOCATION
,
szNewLocation
,
&
dwBufferSize
,
NULL
)
==
ERROR_SUCCESS
)
{
{
if
(
strcmpW
(
request
->
lpszVerb
,
szGET
)
&&
strcmpW
(
request
->
lpszV
erb
,
szHEAD
))
if
(
strcmpW
(
request
->
verb
,
szGET
)
&&
strcmpW
(
request
->
v
erb
,
szHEAD
))
{
{
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszV
erb
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
v
erb
);
request
->
lpszV
erb
=
heap_strdupW
(
szGET
);
request
->
v
erb
=
heap_strdupW
(
szGET
);
}
}
HTTP_DrainContent
(
request
);
HTTP_DrainContent
(
request
);
if
((
new_url
=
HTTP_GetRedirectURL
(
request
,
szNewLocation
)))
if
((
new_url
=
HTTP_GetRedirectURL
(
request
,
szNewLocation
)))
...
@@ -4042,7 +4042,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest,
...
@@ -4042,7 +4042,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest,
}
}
request
->
hdr
.
dwFlags
|=
dwFlags
;
request
->
hdr
.
dwFlags
|=
dwFlags
;
if
(
request
->
lpHttpS
ession
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
if
(
request
->
s
ession
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
{
WORKREQUEST
work
;
WORKREQUEST
work
;
struct
WORKREQ_HTTPENDREQUESTW
*
work_endrequest
;
struct
WORKREQ_HTTPENDREQUESTW
*
work_endrequest
;
...
@@ -4154,7 +4154,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
...
@@ -4154,7 +4154,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
goto
lend
;
goto
lend
;
}
}
session
=
request
->
lpHttpS
ession
;
session
=
request
->
s
ession
;
assert
(
session
->
hdr
.
htype
==
WH_HHTTPSESSION
);
assert
(
session
->
hdr
.
htype
==
WH_HHTTPSESSION
);
hIC
=
session
->
appInfo
;
hIC
=
session
->
appInfo
;
assert
(
hIC
->
hdr
.
htype
==
WH_HINIT
);
assert
(
hIC
->
hdr
.
htype
==
WH_HINIT
);
...
@@ -4252,7 +4252,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
...
@@ -4252,7 +4252,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
goto
lend
;
goto
lend
;
}
}
session
=
request
->
lpHttpS
ession
;
session
=
request
->
s
ession
;
if
(
NULL
==
session
||
session
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
if
(
NULL
==
session
||
session
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
{
{
res
=
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
;
res
=
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
;
...
@@ -4517,7 +4517,7 @@ static DWORD HTTP_OpenConnection(http_request_t *request)
...
@@ -4517,7 +4517,7 @@ static DWORD HTTP_OpenConnection(http_request_t *request)
goto
lend
;
goto
lend
;
if
((
res
=
HTTP_ResolveName
(
request
))
!=
ERROR_SUCCESS
)
goto
lend
;
if
((
res
=
HTTP_ResolveName
(
request
))
!=
ERROR_SUCCESS
)
goto
lend
;
session
=
request
->
lpHttpS
ession
;
session
=
request
->
s
ession
;
hIC
=
session
->
appInfo
;
hIC
=
session
->
appInfo
;
switch
(
session
->
socketAddress
.
ss_family
)
switch
(
session
->
socketAddress
.
ss_family
)
...
@@ -4608,11 +4608,11 @@ static void HTTP_clear_response_headers( http_request_t *request )
...
@@ -4608,11 +4608,11 @@ static void HTTP_clear_response_headers( http_request_t *request )
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
for
(
i
=
0
;
i
<
request
->
nCustHeaders
;
i
++
)
{
{
if
(
!
request
->
pC
ustHeaders
[
i
].
lpszField
)
if
(
!
request
->
c
ustHeaders
[
i
].
lpszField
)
continue
;
continue
;
if
(
!
request
->
pC
ustHeaders
[
i
].
lpszValue
)
if
(
!
request
->
c
ustHeaders
[
i
].
lpszValue
)
continue
;
continue
;
if
(
request
->
pC
ustHeaders
[
i
].
wFlags
&
HDR_ISREQUEST
)
if
(
request
->
c
ustHeaders
[
i
].
wFlags
&
HDR_ISREQUEST
)
continue
;
continue
;
HTTP_DeleteCustomHeader
(
request
,
i
);
HTTP_DeleteCustomHeader
(
request
,
i
);
i
--
;
i
--
;
...
@@ -4690,14 +4690,14 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
...
@@ -4690,14 +4690,14 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
{
{
WARN
(
"No status line at head of response (%s)
\n
"
,
debugstr_w
(
buffer
));
WARN
(
"No status line at head of response (%s)
\n
"
,
debugstr_w
(
buffer
));
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszV
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
v
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszS
tatusText
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
s
tatusText
);
request
->
lpszV
ersion
=
heap_strdupW
(
g_szHttp1_0
);
request
->
v
ersion
=
heap_strdupW
(
g_szHttp1_0
);
request
->
lpszS
tatusText
=
heap_strdupW
(
szOK
);
request
->
s
tatusText
=
heap_strdupW
(
szOK
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszR
awHeaders
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
r
awHeaders
);
request
->
lpszR
awHeaders
=
heap_strdupW
(
szDefaultHeader
);
request
->
r
awHeaders
=
heap_strdupW
(
szDefaultHeader
);
bSuccess
=
TRUE
;
bSuccess
=
TRUE
;
goto
lend
;
goto
lend
;
...
@@ -4708,11 +4708,11 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
...
@@ -4708,11 +4708,11 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
HTTP_ProcessHeader
(
request
,
szStatus
,
status_code
,
HTTP_ProcessHeader
(
request
,
szStatus
,
status_code
,
HTTP_ADDHDR_FLAG_REPLACE
);
HTTP_ADDHDR_FLAG_REPLACE
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszV
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
v
ersion
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszS
tatusText
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
s
tatusText
);
request
->
lpszV
ersion
=
heap_strdupW
(
buffer
);
request
->
v
ersion
=
heap_strdupW
(
buffer
);
request
->
lpszS
tatusText
=
heap_strdupW
(
status_text
);
request
->
s
tatusText
=
heap_strdupW
(
status_text
);
/* Restore the spaces */
/* Restore the spaces */
*
(
status_code
-
1
)
=
' '
;
*
(
status_code
-
1
)
=
' '
;
...
@@ -4787,8 +4787,8 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
...
@@ -4787,8 +4787,8 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
memcpy
(
&
lpszRawHeaders
[
cchRawHeaders
],
szCrLf
,
sizeof
(
szCrLf
));
memcpy
(
&
lpszRawHeaders
[
cchRawHeaders
],
szCrLf
,
sizeof
(
szCrLf
));
HeapFree
(
GetProcessHeap
(),
0
,
request
->
lpszR
awHeaders
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
r
awHeaders
);
request
->
lpszR
awHeaders
=
lpszRawHeaders
;
request
->
r
awHeaders
=
lpszRawHeaders
;
TRACE
(
"raw headers: %s
\n
"
,
debugstr_w
(
lpszRawHeaders
));
TRACE
(
"raw headers: %s
\n
"
,
debugstr_w
(
lpszRawHeaders
));
bSuccess
=
TRUE
;
bSuccess
=
TRUE
;
...
@@ -4890,7 +4890,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
...
@@ -4890,7 +4890,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
{
{
if
(
dwModifier
&
HTTP_ADDHDR_FLAG_ADD_IF_NEW
)
if
(
dwModifier
&
HTTP_ADDHDR_FLAG_ADD_IF_NEW
)
return
ERROR_HTTP_INVALID_HEADER
;
return
ERROR_HTTP_INVALID_HEADER
;
lphttpHdr
=
&
request
->
pC
ustHeaders
[
index
];
lphttpHdr
=
&
request
->
c
ustHeaders
[
index
];
}
}
else
if
(
value
)
else
if
(
value
)
{
{
...
@@ -5021,13 +5021,13 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField,
...
@@ -5021,13 +5021,13 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField,
for
(
index
=
0
;
index
<
request
->
nCustHeaders
;
index
++
)
for
(
index
=
0
;
index
<
request
->
nCustHeaders
;
index
++
)
{
{
if
(
strcmpiW
(
request
->
pC
ustHeaders
[
index
].
lpszField
,
lpszField
))
if
(
strcmpiW
(
request
->
c
ustHeaders
[
index
].
lpszField
,
lpszField
))
continue
;
continue
;
if
(
request_only
&&
!
(
request
->
pC
ustHeaders
[
index
].
wFlags
&
HDR_ISREQUEST
))
if
(
request_only
&&
!
(
request
->
c
ustHeaders
[
index
].
wFlags
&
HDR_ISREQUEST
))
continue
;
continue
;
if
(
!
request_only
&&
(
request
->
pC
ustHeaders
[
index
].
wFlags
&
HDR_ISREQUEST
))
if
(
!
request_only
&&
(
request
->
c
ustHeaders
[
index
].
wFlags
&
HDR_ISREQUEST
))
continue
;
continue
;
if
(
requested_index
==
0
)
if
(
requested_index
==
0
)
...
@@ -5057,18 +5057,18 @@ static DWORD HTTP_InsertCustomHeader(http_request_t *request, LPHTTPHEADERW lpHd
...
@@ -5057,18 +5057,18 @@ static DWORD HTTP_InsertCustomHeader(http_request_t *request, LPHTTPHEADERW lpHd
TRACE
(
"--> %s: %s
\n
"
,
debugstr_w
(
lpHdr
->
lpszField
),
debugstr_w
(
lpHdr
->
lpszValue
));
TRACE
(
"--> %s: %s
\n
"
,
debugstr_w
(
lpHdr
->
lpszField
),
debugstr_w
(
lpHdr
->
lpszValue
));
count
=
request
->
nCustHeaders
+
1
;
count
=
request
->
nCustHeaders
+
1
;
if
(
count
>
1
)
if
(
count
>
1
)
lph
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
request
->
pC
ustHeaders
,
sizeof
(
HTTPHEADERW
)
*
count
);
lph
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
request
->
c
ustHeaders
,
sizeof
(
HTTPHEADERW
)
*
count
);
else
else
lph
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
HTTPHEADERW
)
*
count
);
lph
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
HTTPHEADERW
)
*
count
);
if
(
!
lph
)
if
(
!
lph
)
return
ERROR_OUTOFMEMORY
;
return
ERROR_OUTOFMEMORY
;
request
->
pC
ustHeaders
=
lph
;
request
->
c
ustHeaders
=
lph
;
request
->
pC
ustHeaders
[
count
-
1
].
lpszField
=
heap_strdupW
(
lpHdr
->
lpszField
);
request
->
c
ustHeaders
[
count
-
1
].
lpszField
=
heap_strdupW
(
lpHdr
->
lpszField
);
request
->
pC
ustHeaders
[
count
-
1
].
lpszValue
=
heap_strdupW
(
lpHdr
->
lpszValue
);
request
->
c
ustHeaders
[
count
-
1
].
lpszValue
=
heap_strdupW
(
lpHdr
->
lpszValue
);
request
->
pC
ustHeaders
[
count
-
1
].
wFlags
=
lpHdr
->
wFlags
;
request
->
c
ustHeaders
[
count
-
1
].
wFlags
=
lpHdr
->
wFlags
;
request
->
pC
ustHeaders
[
count
-
1
].
wCount
=
lpHdr
->
wCount
;
request
->
c
ustHeaders
[
count
-
1
].
wCount
=
lpHdr
->
wCount
;
request
->
nCustHeaders
++
;
request
->
nCustHeaders
++
;
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
...
@@ -5089,12 +5089,12 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
...
@@ -5089,12 +5089,12 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
return
FALSE
;
return
FALSE
;
request
->
nCustHeaders
--
;
request
->
nCustHeaders
--
;
HeapFree
(
GetProcessHeap
(),
0
,
request
->
pC
ustHeaders
[
index
].
lpszField
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
ustHeaders
[
index
].
lpszField
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
pC
ustHeaders
[
index
].
lpszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
request
->
c
ustHeaders
[
index
].
lpszValue
);
memmove
(
&
request
->
pCustHeaders
[
index
],
&
request
->
pC
ustHeaders
[
index
+
1
],
memmove
(
&
request
->
custHeaders
[
index
],
&
request
->
c
ustHeaders
[
index
+
1
],
(
request
->
nCustHeaders
-
index
)
*
sizeof
(
HTTPHEADERW
)
);
(
request
->
nCustHeaders
-
index
)
*
sizeof
(
HTTPHEADERW
)
);
memset
(
&
request
->
pC
ustHeaders
[
request
->
nCustHeaders
],
0
,
sizeof
(
HTTPHEADERW
)
);
memset
(
&
request
->
c
ustHeaders
[
request
->
nCustHeaders
],
0
,
sizeof
(
HTTPHEADERW
)
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -5109,7 +5109,7 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
...
@@ -5109,7 +5109,7 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
static
BOOL
HTTP_VerifyValidHeader
(
http_request_t
*
request
,
LPCWSTR
field
)
static
BOOL
HTTP_VerifyValidHeader
(
http_request_t
*
request
,
LPCWSTR
field
)
{
{
/* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */
/* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */
if
(
!
strcmpW
(
request
->
lpszV
ersion
,
g_szHttp1_0
)
&&
!
strcmpiW
(
field
,
szAccept_Encoding
))
if
(
!
strcmpW
(
request
->
v
ersion
,
g_szHttp1_0
)
&&
!
strcmpiW
(
field
,
szAccept_Encoding
))
return
ERROR_HTTP_INVALID_HEADER
;
return
ERROR_HTTP_INVALID_HEADER
;
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
...
...
dlls/wininet/internet.h
View file @
2098006d
...
@@ -263,25 +263,25 @@ typedef struct gzip_stream_t gzip_stream_t;
...
@@ -263,25 +263,25 @@ typedef struct gzip_stream_t gzip_stream_t;
typedef
struct
typedef
struct
{
{
object_header_t
hdr
;
object_header_t
hdr
;
http_session_t
*
lpHttpS
ession
;
http_session_t
*
s
ession
;
LPWSTR
lpszP
ath
;
LPWSTR
p
ath
;
LPWSTR
lpszV
erb
;
LPWSTR
v
erb
;
LPWSTR
lpszR
awHeaders
;
LPWSTR
r
awHeaders
;
WININET_NETCONNECTION
netConnection
;
WININET_NETCONNECTION
netConnection
;
LPWSTR
lpszV
ersion
;
LPWSTR
v
ersion
;
LPWSTR
lpszS
tatusText
;
LPWSTR
s
tatusText
;
DWORD
dwB
ytesToWrite
;
DWORD
b
ytesToWrite
;
DWORD
dwB
ytesWritten
;
DWORD
b
ytesWritten
;
HTTPHEADERW
*
pC
ustHeaders
;
HTTPHEADERW
*
c
ustHeaders
;
DWORD
nCustHeaders
;
DWORD
nCustHeaders
;
HANDLE
hCacheFile
;
HANDLE
hCacheFile
;
LPWSTR
lpszC
acheFile
;
LPWSTR
c
acheFile
;
struct
HttpAuthInfo
*
pA
uthInfo
;
struct
HttpAuthInfo
*
a
uthInfo
;
struct
HttpAuthInfo
*
p
P
roxyAuthInfo
;
struct
HttpAuthInfo
*
proxyAuthInfo
;
CRITICAL_SECTION
read_section
;
/* section to protect the following fields */
CRITICAL_SECTION
read_section
;
/* section to protect the following fields */
DWORD
dwContentLength
;
/* total number of bytes to be read */
DWORD
contentLength
;
/* total number of bytes to be read */
DWORD
dwContentRead
;
/* bytes of the content read so far */
DWORD
contentRead
;
/* bytes of the content read so far */
BOOL
read_chunked
;
/* are we reading in chunked mode? */
BOOL
read_chunked
;
/* are we reading in chunked mode? */
DWORD
read_pos
;
/* current read position in read_buf */
DWORD
read_pos
;
/* current read position in read_buf */
DWORD
read_size
;
/* valid data size in read_buf */
DWORD
read_size
;
/* valid data size in read_buf */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment