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
5be7064d
Commit
5be7064d
authored
Dec 22, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Dec 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Split the code for sending an http request into its own function.
parent
7081e848
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
37 deletions
+48
-37
http.c
dlls/urlmon/http.c
+48
-37
No files found.
dlls/urlmon/http.c
View file @
5be7064d
...
...
@@ -80,13 +80,54 @@ static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
return
ret
;
}
static
ULONG
send_http_request
(
HttpProtocol
*
This
)
{
INTERNET_BUFFERSW
send_buffer
=
{
sizeof
(
INTERNET_BUFFERSW
)};
BOOL
res
;
send_buffer
.
lpcszHeader
=
This
->
full_header
;
send_buffer
.
dwHeadersLength
=
send_buffer
.
dwHeadersTotal
=
strlenW
(
This
->
full_header
);
if
(
This
->
base
.
bind_info
.
dwBindVerb
!=
BINDVERB_GET
)
{
switch
(
This
->
base
.
bind_info
.
stgmedData
.
tymed
)
{
case
TYMED_HGLOBAL
:
/* Native does not use GlobalLock/GlobalUnlock, so we won't either */
send_buffer
.
lpvBuffer
=
This
->
base
.
bind_info
.
stgmedData
.
u
.
hGlobal
;
send_buffer
.
dwBufferLength
=
send_buffer
.
dwBufferTotal
=
This
->
base
.
bind_info
.
cbstgmedData
;
break
;
case
TYMED_ISTREAM
:
{
LARGE_INTEGER
offset
;
send_buffer
.
dwBufferTotal
=
This
->
base
.
bind_info
.
cbstgmedData
;
if
(
!
This
->
base
.
post_stream
)
{
This
->
base
.
post_stream
=
This
->
base
.
bind_info
.
stgmedData
.
u
.
pstm
;
IStream_AddRef
(
This
->
base
.
post_stream
);
}
offset
.
QuadPart
=
0
;
IStream_Seek
(
This
->
base
.
post_stream
,
offset
,
STREAM_SEEK_SET
,
NULL
);
break
;
}
default:
FIXME
(
"Unsupported This->base.bind_info.stgmedData.tymed %d
\n
"
,
This
->
base
.
bind_info
.
stgmedData
.
tymed
);
}
}
if
(
This
->
base
.
post_stream
)
res
=
HttpSendRequestExW
(
This
->
base
.
request
,
&
send_buffer
,
NULL
,
0
,
0
);
else
res
=
HttpSendRequestW
(
This
->
base
.
request
,
send_buffer
.
lpcszHeader
,
send_buffer
.
dwHeadersLength
,
send_buffer
.
lpvBuffer
,
send_buffer
.
dwBufferLength
);
return
res
?
0
:
GetLastError
();
}
#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(HttpProtocol, base, iface)
static
HRESULT
HttpProtocol_open_request
(
Protocol
*
prot
,
IUri
*
uri
,
DWORD
request_flags
,
HINTERNET
internet_session
,
IInternetBindInfo
*
bind_info
)
{
HttpProtocol
*
This
=
ASYNCPROTOCOL_THIS
(
prot
);
INTERNET_BUFFERSW
send_buffer
=
{
sizeof
(
INTERNET_BUFFERSW
)};
LPWSTR
addl_header
=
NULL
,
post_cookie
=
NULL
;
IServiceProvider
*
service_provider
=
NULL
;
IHttpNegotiate2
*
http_negotiate2
=
NULL
;
...
...
@@ -95,7 +136,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
const
WCHAR
**
accept_types
;
BYTE
security_id
[
512
];
DWORD
len
=
0
,
port
;
ULONG
num
;
ULONG
num
,
error
;
BOOL
res
,
b
;
HRESULT
hres
;
...
...
@@ -236,48 +277,18 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
}
}
send_buffer
.
lpcszHeader
=
This
->
full_header
;
send_buffer
.
dwHeadersLength
=
send_buffer
.
dwHeadersTotal
=
strlenW
(
This
->
full_header
);
if
(
This
->
base
.
bind_info
.
dwBindVerb
!=
BINDVERB_GET
)
{
switch
(
This
->
base
.
bind_info
.
stgmedData
.
tymed
)
{
case
TYMED_HGLOBAL
:
/* Native does not use GlobalLock/GlobalUnlock, so we won't either */
send_buffer
.
lpvBuffer
=
This
->
base
.
bind_info
.
stgmedData
.
u
.
hGlobal
;
send_buffer
.
dwBufferLength
=
send_buffer
.
dwBufferTotal
=
This
->
base
.
bind_info
.
cbstgmedData
;
break
;
case
TYMED_ISTREAM
:
{
LARGE_INTEGER
offset
;
send_buffer
.
dwBufferTotal
=
This
->
base
.
bind_info
.
cbstgmedData
;
This
->
base
.
post_stream
=
This
->
base
.
bind_info
.
stgmedData
.
u
.
pstm
;
IStream_AddRef
(
This
->
base
.
post_stream
);
offset
.
QuadPart
=
0
;
IStream_Seek
(
This
->
base
.
post_stream
,
offset
,
STREAM_SEEK_SET
,
NULL
);
break
;
}
default:
FIXME
(
"Unsupported This->base.bind_info.stgmedData.tymed %d
\n
"
,
This
->
base
.
bind_info
.
stgmedData
.
tymed
);
}
}
b
=
TRUE
;
res
=
InternetSetOptionW
(
This
->
base
.
request
,
INTERNET_OPTION_HTTP_DECODING
,
&
b
,
sizeof
(
b
));
if
(
!
res
)
WARN
(
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %08x
\n
"
,
GetLastError
());
if
(
This
->
base
.
post_stream
)
res
=
HttpSendRequestExW
(
This
->
base
.
request
,
&
send_buffer
,
NULL
,
0
,
0
);
else
res
=
HttpSendRequestW
(
This
->
base
.
request
,
send_buffer
.
lpcszHeader
,
send_buffer
.
dwHeadersLength
,
send_buffer
.
lpvBuffer
,
send_buffer
.
dwBufferLength
);
if
(
!
res
&&
GetLastError
()
!=
ERROR_IO_PENDING
)
{
WARN
(
"HttpSendRequest failed: %d
\n
"
,
GetLastError
());
return
INET_E_DOWNLOAD_FAILURE
;
}
error
=
send_http_request
(
This
);
if
(
error
==
ERROR_IO_PENDING
||
error
==
ERROR_SUCCESS
)
return
S_OK
;
WARN
(
"HttpSendRequest failed: %d
\n
"
,
error
);
return
INET_E_DOWNLOAD_FAILURE
;
}
static
HRESULT
HttpProtocol_end_request
(
Protocol
*
protocol
)
...
...
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