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
93208196
Commit
93208196
authored
Aug 20, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Make WinHttpQueryHeaders behave the same way for all query types.
Based on a patch by Mikko Rasa.
parent
bfdfae1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
36 deletions
+29
-36
request.c
dlls/winhttp/request.c
+29
-36
No files found.
dlls/winhttp/request.c
View file @
93208196
...
...
@@ -602,12 +602,12 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
if
(
!
(
p
=
headers
))
return
FALSE
;
for
(
len
=
0
;
*
p
;
p
++
)
if
(
*
p
!=
'\r'
)
len
++
;
if
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
>
*
buflen
||
!
buffer
)
if
(
!
buffer
||
(
len
+
1
)
*
sizeof
(
WCHAR
)
>
*
buflen
)
{
len
++
;
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
if
(
buffer
)
else
{
for
(
p
=
headers
,
q
=
buffer
;
*
p
;
p
++
,
q
++
)
{
...
...
@@ -637,12 +637,12 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
if
(
!
headers
)
return
FALSE
;
len
=
strlenW
(
headers
)
*
sizeof
(
WCHAR
);
if
(
len
+
sizeof
(
WCHAR
)
>
*
buflen
||
!
buffer
)
if
(
!
buffer
||
len
+
sizeof
(
WCHAR
)
>
*
buflen
)
{
len
+=
sizeof
(
WCHAR
);
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
if
(
buffer
)
else
{
memcpy
(
buffer
,
headers
,
len
+
sizeof
(
WCHAR
)
);
TRACE
(
"returning data: %s
\n
"
,
debugstr_wn
(
buffer
,
len
/
sizeof
(
WCHAR
)));
...
...
@@ -653,43 +653,38 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
return
ret
;
}
case
WINHTTP_QUERY_VERSION
:
{
DWORD
len
=
(
strlenW
(
request
->
version
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
len
>
*
buflen
)
len
=
strlenW
(
request
->
version
)
*
sizeof
(
WCHAR
);
if
(
!
buffer
||
len
+
sizeof
(
WCHAR
)
>
*
buflen
)
{
len
+=
sizeof
(
WCHAR
);
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
*
buflen
=
len
;
return
FALSE
;
}
else
if
(
buffer
)
else
{
strcpyW
(
buffer
,
request
->
version
);
TRACE
(
"returning string: %s
\n
"
,
debugstr_w
(
buffer
));
ret
=
TRUE
;
}
*
buflen
=
len
-
sizeof
(
WCHAR
)
;
*
buflen
=
len
;
return
ret
;
}
case
WINHTTP_QUERY_STATUS_TEXT
:
{
DWORD
len
=
(
strlenW
(
request
->
status_text
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
len
>
*
buflen
)
len
=
strlenW
(
request
->
status_text
)
*
sizeof
(
WCHAR
);
if
(
!
buffer
||
len
+
sizeof
(
WCHAR
)
>
*
buflen
)
{
len
+=
sizeof
(
WCHAR
);
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
*
buflen
=
len
;
return
FALSE
;
}
else
if
(
buffer
)
else
{
strcpyW
(
buffer
,
request
->
status_text
);
TRACE
(
"returning string: %s
\n
"
,
debugstr_w
(
buffer
));
ret
=
TRUE
;
}
*
buflen
=
len
-
sizeof
(
WCHAR
)
;
*
buflen
=
len
;
return
ret
;
}
default:
{
if
(
attr
>=
sizeof
(
attribute_table
)
/
sizeof
(
attribute_table
[
0
])
||
!
attribute_table
[
attr
])
{
FIXME
(
"attribute %u not implemented
\n
"
,
attr
);
...
...
@@ -697,7 +692,7 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
}
TRACE
(
"attribute %s
\n
"
,
debugstr_w
(
attribute_table
[
attr
]));
header_index
=
get_header_index
(
request
,
attribute_table
[
attr
],
requested_index
,
request_only
);
}
break
;
}
if
(
header_index
>=
0
)
...
...
@@ -712,13 +707,13 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
if
(
index
)
*
index
+=
1
;
if
(
level
&
WINHTTP_QUERY_FLAG_NUMBER
)
{
int
*
number
=
buffer
;
if
(
sizeof
(
int
)
>
*
buflen
)
if
(
!
buffer
||
sizeof
(
int
)
>
*
buflen
)
{
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
if
(
number
)
else
{
int
*
number
=
buffer
;
*
number
=
atoiW
(
header
->
value
);
TRACE
(
"returning number: %d
\n
"
,
*
number
);
ret
=
TRUE
;
...
...
@@ -728,11 +723,11 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
else
if
(
level
&
WINHTTP_QUERY_FLAG_SYSTEMTIME
)
{
SYSTEMTIME
*
st
=
buffer
;
if
(
sizeof
(
SYSTEMTIME
)
>
*
buflen
)
if
(
!
buffer
||
sizeof
(
SYSTEMTIME
)
>
*
buflen
)
{
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
if
(
st
&&
(
ret
=
WinHttpTimeToSystemTime
(
header
->
value
,
st
)))
else
if
((
ret
=
WinHttpTimeToSystemTime
(
header
->
value
,
st
)))
{
TRACE
(
"returning time: %04d/%02d/%02d - %d - %02d:%02d:%02d.%02d
\n
"
,
st
->
wYear
,
st
->
wMonth
,
st
->
wDay
,
st
->
wDayOfWeek
,
...
...
@@ -742,21 +737,19 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
}
else
if
(
header
->
value
)
{
WCHAR
*
string
=
buffer
;
DWORD
len
=
(
strlenW
(
header
->
value
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
len
>
*
buflen
)
len
=
strlenW
(
header
->
value
)
*
sizeof
(
WCHAR
);
if
(
!
buffer
||
len
+
sizeof
(
WCHAR
)
>
*
buflen
)
{
len
+=
sizeof
(
WCHAR
);
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
*
buflen
=
len
;
return
FALSE
;
}
else
if
(
string
)
else
{
strcpyW
(
string
,
header
->
value
);
TRACE
(
"returning string: %s
\n
"
,
debugstr_w
(
string
));
strcpyW
(
buffer
,
header
->
value
);
TRACE
(
"returning string: %s
\n
"
,
debugstr_w
(
buffer
));
ret
=
TRUE
;
}
*
buflen
=
len
-
sizeof
(
WCHAR
)
;
*
buflen
=
len
;
}
return
ret
;
}
...
...
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