Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
050058c5
Commit
050058c5
authored
Jul 26, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Add accept types to the request headers.
parent
9237479d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
request.c
dlls/winhttp/request.c
+9
-2
session.c
dlls/winhttp/session.c
+37
-1
winhttp_private.h
dlls/winhttp/winhttp_private.h
+2
-0
No files found.
dlls/winhttp/request.c
View file @
050058c5
...
...
@@ -1031,8 +1031,13 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len
WCHAR
*
req
=
NULL
;
char
*
req_ascii
;
int
bytes_sent
;
DWORD
len
;
DWORD
len
,
i
,
flags
;
flags
=
WINHTTP_ADDREQ_FLAG_ADD
|
WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
;
for
(
i
=
0
;
i
<
request
->
num_accept_types
;
i
++
)
{
process_header
(
request
,
attr_accept
,
request
->
accept_types
[
i
],
flags
,
TRUE
);
}
if
(
session
->
agent
)
process_header
(
request
,
attr_user_agent
,
session
->
agent
,
WINHTTP_ADDREQ_FLAG_ADD_IF_NEW
,
TRUE
);
...
...
@@ -2422,6 +2427,8 @@ static HRESULT WINAPI winhttp_request_Open(
BSTR
url
,
VARIANT
async
)
{
static
const
WCHAR
typeW
[]
=
{
'*'
,
'/'
,
'*'
,
0
};
static
const
WCHAR
*
acceptW
[]
=
{
typeW
,
NULL
};
struct
winhttp_request
*
request
=
impl_from_IWinHttpRequest
(
iface
);
HINTERNET
hsession
=
NULL
,
hconnect
=
NULL
,
hrequest
;
URL_COMPONENTS
uc
;
...
...
@@ -2461,7 +2468,7 @@ static HRESULT WINAPI winhttp_request_Open(
err
=
get_last_error
();
goto
error
;
}
if
(
!
(
hrequest
=
WinHttpOpenRequest
(
hconnect
,
method
,
path
,
NULL
,
NULL
,
NULL
,
0
)))
if
(
!
(
hrequest
=
WinHttpOpenRequest
(
hconnect
,
method
,
path
,
NULL
,
NULL
,
acceptW
,
0
)))
{
err
=
get_last_error
();
goto
error
;
...
...
dlls/winhttp/session.c
View file @
050058c5
...
...
@@ -527,7 +527,7 @@ end:
static
void
request_destroy
(
object_header_t
*
hdr
)
{
request_t
*
request
=
(
request_t
*
)
hdr
;
DWORD
i
;
unsigned
int
i
;
TRACE
(
"%p
\n
"
,
request
);
...
...
@@ -544,6 +544,8 @@ static void request_destroy( object_header_t *hdr )
heap_free
(
request
->
headers
[
i
].
value
);
}
heap_free
(
request
->
headers
);
for
(
i
=
0
;
i
<
request
->
num_accept_types
;
i
++
)
heap_free
(
request
->
accept_types
[
i
]
);
heap_free
(
request
->
accept_types
);
heap_free
(
request
);
}
...
...
@@ -859,6 +861,39 @@ static const object_vtbl_t request_vtbl =
request_set_option
};
static
BOOL
store_accept_types
(
request_t
*
request
,
const
WCHAR
**
accept_types
)
{
const
WCHAR
**
types
=
accept_types
;
int
i
;
if
(
!
types
)
return
TRUE
;
while
(
*
types
)
{
request
->
num_accept_types
++
;
types
++
;
}
if
(
!
request
->
num_accept_types
)
return
TRUE
;
if
(
!
(
request
->
accept_types
=
heap_alloc
(
request
->
num_accept_types
*
sizeof
(
WCHAR
*
))))
{
request
->
num_accept_types
=
0
;
return
FALSE
;
}
types
=
accept_types
;
for
(
i
=
0
;
i
<
request
->
num_accept_types
;
i
++
)
{
if
(
!
(
request
->
accept_types
[
i
]
=
strdupW
(
*
types
)))
{
for
(;
i
>=
0
;
i
--
)
heap_free
(
request
->
accept_types
[
i
]
);
heap_free
(
request
->
accept_types
);
request
->
accept_types
=
NULL
;
request
->
num_accept_types
=
0
;
return
FALSE
;
}
types
++
;
}
return
TRUE
;
}
/***********************************************************************
* WinHttpOpenRequest (winhttp.@)
*/
...
...
@@ -926,6 +961,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
if
(
!
version
||
!
version
[
0
])
version
=
http1_1
;
if
(
!
(
request
->
version
=
strdupW
(
version
)))
goto
end
;
if
(
!
(
store_accept_types
(
request
,
types
)))
goto
end
;
if
(
!
(
hrequest
=
alloc_handle
(
&
request
->
hdr
)))
goto
end
;
request
->
hdr
.
handle
=
hrequest
;
...
...
dlls/winhttp/winhttp_private.h
View file @
050058c5
...
...
@@ -157,6 +157,8 @@ typedef struct
DWORD
content_read
;
/* bytes read so far */
header_t
*
headers
;
DWORD
num_headers
;
WCHAR
**
accept_types
;
DWORD
num_accept_types
;
}
request_t
;
typedef
struct
_task_header_t
task_header_t
;
...
...
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