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
3f85f455
Commit
3f85f455
authored
Aug 26, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement WinHttpQueryAuthSchemes.
parent
1319b367
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
1 deletion
+97
-1
request.c
dlls/winhttp/request.c
+96
-0
winhttp.spec
dlls/winhttp/winhttp.spec
+1
-1
No files found.
dlls/winhttp/request.c
View file @
3f85f455
...
@@ -1136,3 +1136,99 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, LPCVOID buffer, DWORD to_write
...
@@ -1136,3 +1136,99 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, LPCVOID buffer, DWORD to_write
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
return
ret
;
return
ret
;
}
}
#define ARRAYSIZE(array) (sizeof(array) / sizeof((array)[0]))
static
DWORD
auth_scheme_from_header
(
WCHAR
*
header
)
{
static
const
WCHAR
basic
[]
=
{
'B'
,
'a'
,
's'
,
'i'
,
'c'
};
static
const
WCHAR
ntlm
[]
=
{
'N'
,
'T'
,
'L'
,
'M'
};
static
const
WCHAR
passport
[]
=
{
'P'
,
'a'
,
's'
,
's'
,
'p'
,
'o'
,
'r'
,
't'
};
static
const
WCHAR
digest
[]
=
{
'D'
,
'i'
,
'g'
,
'e'
,
's'
,
't'
};
static
const
WCHAR
negotiate
[]
=
{
'N'
,
'e'
,
'g'
,
'o'
,
't'
,
'i'
,
'a'
,
't'
,
'e'
};
if
(
!
strncmpiW
(
header
,
basic
,
ARRAYSIZE
(
basic
)
)
&&
(
header
[
ARRAYSIZE
(
basic
)]
==
' '
||
!
header
[
ARRAYSIZE
(
basic
)]))
return
WINHTTP_AUTH_SCHEME_BASIC
;
if
(
!
strncmpiW
(
header
,
ntlm
,
ARRAYSIZE
(
ntlm
)
)
&&
(
header
[
ARRAYSIZE
(
ntlm
)]
==
' '
||
!
header
[
ARRAYSIZE
(
ntlm
)]))
return
WINHTTP_AUTH_SCHEME_NTLM
;
if
(
!
strncmpiW
(
header
,
passport
,
ARRAYSIZE
(
passport
)
)
&&
(
header
[
ARRAYSIZE
(
passport
)]
==
' '
||
!
header
[
ARRAYSIZE
(
passport
)]))
return
WINHTTP_AUTH_SCHEME_PASSPORT
;
if
(
!
strncmpiW
(
header
,
digest
,
ARRAYSIZE
(
digest
)
)
&&
(
header
[
ARRAYSIZE
(
digest
)]
==
' '
||
!
header
[
ARRAYSIZE
(
digest
)]))
return
WINHTTP_AUTH_SCHEME_DIGEST
;
if
(
!
strncmpiW
(
header
,
negotiate
,
ARRAYSIZE
(
negotiate
)
)
&&
(
header
[
ARRAYSIZE
(
negotiate
)]
==
' '
||
!
header
[
ARRAYSIZE
(
negotiate
)]))
return
WINHTTP_AUTH_SCHEME_NEGOTIATE
;
return
0
;
}
static
BOOL
query_auth_schemes
(
request_t
*
request
,
DWORD
level
,
LPDWORD
supported
,
LPDWORD
first
)
{
DWORD
index
=
0
;
BOOL
ret
=
FALSE
;
for
(;;)
{
WCHAR
*
buffer
;
DWORD
size
,
scheme
;
size
=
0
;
query_headers
(
request
,
level
,
NULL
,
NULL
,
&
size
,
&
index
);
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
break
;
index
--
;
if
(
!
(
buffer
=
heap_alloc
(
size
)))
return
FALSE
;
if
(
!
query_headers
(
request
,
level
,
NULL
,
buffer
,
&
size
,
&
index
))
{
heap_free
(
buffer
);
return
FALSE
;
}
scheme
=
auth_scheme_from_header
(
buffer
);
if
(
index
==
1
)
*
first
=
scheme
;
*
supported
|=
scheme
;
heap_free
(
buffer
);
ret
=
TRUE
;
}
return
ret
;
}
/***********************************************************************
* WinHttpQueryAuthSchemes (winhttp.@)
*/
BOOL
WINAPI
WinHttpQueryAuthSchemes
(
HINTERNET
hrequest
,
LPDWORD
supported
,
LPDWORD
first
,
LPDWORD
target
)
{
BOOL
ret
=
FALSE
;
request_t
*
request
;
TRACE
(
"%p, %p, %p, %p
\n
"
,
hrequest
,
supported
,
first
,
target
);
if
(
!
(
request
=
(
request_t
*
)
grab_object
(
hrequest
)))
{
set_last_error
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
request
->
hdr
.
type
!=
WINHTTP_HANDLE_TYPE_REQUEST
)
{
release_object
(
&
request
->
hdr
);
set_last_error
(
ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
);
return
FALSE
;
}
if
(
query_auth_schemes
(
request
,
WINHTTP_QUERY_WWW_AUTHENTICATE
,
supported
,
first
))
{
*
target
=
WINHTTP_AUTH_TARGET_SERVER
;
ret
=
TRUE
;
}
else
if
(
query_auth_schemes
(
request
,
WINHTTP_QUERY_PROXY_AUTHENTICATE
,
supported
,
first
))
{
*
target
=
WINHTTP_AUTH_TARGET_PROXY
;
ret
=
TRUE
;
}
release_object
(
&
request
->
hdr
);
return
ret
;
}
dlls/winhttp/winhttp.spec
View file @
3f85f455
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
@ stdcall WinHttpGetProxyForUrl(ptr wstr ptr ptr)
@ stdcall WinHttpGetProxyForUrl(ptr wstr ptr ptr)
@ stdcall WinHttpOpen(wstr long wstr wstr long)
@ stdcall WinHttpOpen(wstr long wstr wstr long)
@ stdcall WinHttpOpenRequest(ptr wstr wstr wstr wstr ptr long)
@ stdcall WinHttpOpenRequest(ptr wstr wstr wstr wstr ptr long)
@ st
ub WinHttpQueryAuthSchemes
@ st
dcall WinHttpQueryAuthSchemes(ptr ptr ptr ptr)
@ stdcall WinHttpQueryDataAvailable(ptr ptr)
@ stdcall WinHttpQueryDataAvailable(ptr ptr)
@ stdcall WinHttpQueryHeaders(ptr long wstr ptr ptr ptr)
@ stdcall WinHttpQueryHeaders(ptr long wstr ptr ptr ptr)
@ stdcall WinHttpQueryOption(ptr long ptr ptr)
@ stdcall WinHttpQueryOption(ptr long ptr ptr)
...
...
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