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
7ab46f03
Commit
7ab46f03
authored
Feb 02, 2024
by
Piotr Caban
Committed by
Alexandre Julliard
Feb 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Add support for WINHTTP_AUTOPROXY_HOST_LOWERCASE flag in WinHttpGetProxyForUrl.
parent
9eb644fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
39 deletions
+48
-39
session.c
dlls/winhttp/session.c
+48
-21
winhttp.c
dlls/winhttp/tests/winhttp.c
+0
-3
winhttp_private.h
dlls/winhttp/winhttp_private.h
+0
-15
No files found.
dlls/winhttp/session.c
View file @
7ab46f03
...
@@ -2031,42 +2031,69 @@ BOOL WINAPI InternetDeInitializeAutoProxyDll(LPSTR, DWORD);
...
@@ -2031,42 +2031,69 @@ BOOL WINAPI InternetDeInitializeAutoProxyDll(LPSTR, DWORD);
BOOL
WINAPI
InternetGetProxyInfo
(
LPCSTR
,
DWORD
,
LPSTR
,
DWORD
,
LPSTR
*
,
LPDWORD
);
BOOL
WINAPI
InternetGetProxyInfo
(
LPCSTR
,
DWORD
,
LPSTR
,
DWORD
,
LPSTR
*
,
LPDWORD
);
BOOL
WINAPI
InternetInitializeAutoProxyDll
(
DWORD
,
LPSTR
,
LPSTR
,
void
*
,
struct
AUTO_PROXY_SCRIPT_BUFFER
*
);
BOOL
WINAPI
InternetInitializeAutoProxyDll
(
DWORD
,
LPSTR
,
LPSTR
,
void
*
,
struct
AUTO_PROXY_SCRIPT_BUFFER
*
);
static
BOOL
run_script
(
char
*
script
,
DWORD
size
,
const
WCHAR
*
url
,
WINHTTP_PROXY_INFO
*
info
)
#define MAX_SCHEME_LENGTH 32
static
BOOL
run_script
(
char
*
script
,
DWORD
size
,
const
WCHAR
*
url
,
WINHTTP_PROXY_INFO
*
info
,
DWORD
flags
)
{
{
WCHAR
scheme
[
MAX_SCHEME_LENGTH
+
1
],
buf
[
MAX_HOST_NAME_LENGTH
+
1
],
*
hostname
;
BOOL
ret
;
BOOL
ret
;
char
*
result
,
*
urlA
;
char
*
result
,
*
urlA
,
*
hostnameA
;
DWORD
len
_result
;
DWORD
len
,
len_scheme
,
len_hostname
;
struct
AUTO_PROXY_SCRIPT_BUFFER
buffer
;
struct
AUTO_PROXY_SCRIPT_BUFFER
buffer
;
URL_COMPONENTSW
uc
;
URL_COMPONENTSW
uc
;
memset
(
&
uc
,
0
,
sizeof
(
uc
)
);
uc
.
dwStructSize
=
sizeof
(
uc
);
uc
.
dwSchemeLength
=
-
1
;
uc
.
dwHostNameLength
=
-
1
;
if
(
!
WinHttpCrackUrl
(
url
,
0
,
0
,
&
uc
))
return
FALSE
;
memcpy
(
scheme
,
uc
.
lpszScheme
,
uc
.
dwSchemeLength
*
sizeof
(
WCHAR
)
);
scheme
[
uc
.
dwSchemeLength
]
=
0
;
wcslwr
(
scheme
);
len_scheme
=
WideCharToMultiByte
(
CP_ACP
,
0
,
scheme
,
uc
.
dwSchemeLength
,
NULL
,
0
,
NULL
,
NULL
);
if
(
flags
&
WINHTTP_AUTOPROXY_HOST_LOWERCASE
&&
!
(
flags
&
WINHTTP_AUTOPROXY_HOST_KEEPCASE
))
{
memcpy
(
buf
,
uc
.
lpszHostName
,
uc
.
dwHostNameLength
*
sizeof
(
WCHAR
)
);
buf
[
uc
.
dwHostNameLength
]
=
0
;
wcslwr
(
buf
);
hostname
=
buf
;
}
else
{
hostname
=
uc
.
lpszHostName
;
}
len_hostname
=
WideCharToMultiByte
(
CP_ACP
,
0
,
hostname
,
uc
.
dwHostNameLength
,
NULL
,
0
,
NULL
,
NULL
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
uc
.
lpszHostName
+
uc
.
dwHostNameLength
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
urlA
=
malloc
(
len
+
len_scheme
+
len_hostname
+
3
)))
return
FALSE
;
WideCharToMultiByte
(
CP_ACP
,
0
,
scheme
,
uc
.
dwSchemeLength
,
urlA
,
len_scheme
,
NULL
,
NULL
);
urlA
[
len_scheme
++
]
=
':'
;
urlA
[
len_scheme
++
]
=
'/'
;
urlA
[
len_scheme
++
]
=
'/'
;
WideCharToMultiByte
(
CP_ACP
,
0
,
hostname
,
uc
.
dwHostNameLength
,
urlA
+
len_scheme
,
len_hostname
,
NULL
,
NULL
);
hostnameA
=
urlA
+
len_scheme
;
WideCharToMultiByte
(
CP_ACP
,
0
,
uc
.
lpszHostName
+
uc
.
dwHostNameLength
,
-
1
,
urlA
+
len_scheme
+
len_hostname
,
len
,
NULL
,
NULL
);
buffer
.
dwStructSize
=
sizeof
(
buffer
);
buffer
.
dwStructSize
=
sizeof
(
buffer
);
buffer
.
lpszScriptBuffer
=
script
;
buffer
.
lpszScriptBuffer
=
script
;
buffer
.
dwScriptBufferSize
=
size
;
buffer
.
dwScriptBufferSize
=
size
;
if
(
!
(
urlA
=
strdupWA
(
url
)))
return
FALSE
;
if
(
!
InternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buffer
))
if
(
!
(
ret
=
InternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buffer
)))
{
{
free
(
urlA
);
free
(
urlA
);
return
FALSE
;
return
FALSE
;
}
}
memset
(
&
uc
,
0
,
sizeof
(
uc
)
);
if
((
ret
=
InternetGetProxyInfo
(
urlA
,
strlen
(
urlA
),
hostnameA
,
len_hostname
,
&
result
,
&
len
)))
uc
.
dwStructSize
=
sizeof
(
uc
);
uc
.
dwHostNameLength
=
-
1
;
if
((
ret
=
WinHttpCrackUrl
(
url
,
0
,
0
,
&
uc
)))
{
{
char
*
hostnameA
=
strdupWA_sized
(
uc
.
lpszHostName
,
uc
.
dwHostNameLength
);
ret
=
parse_script_result
(
result
,
info
);
free
(
result
);
if
((
ret
=
InternetGetProxyInfo
(
urlA
,
strlen
(
urlA
),
hostnameA
,
strlen
(
hostnameA
),
&
result
,
&
len_result
)))
{
ret
=
parse_script_result
(
result
,
info
);
free
(
result
);
}
free
(
hostnameA
);
}
}
free
(
urlA
);
free
(
urlA
);
InternetDeInitializeAutoProxyDll
(
NULL
,
0
);
InternetDeInitializeAutoProxyDll
(
NULL
,
0
);
return
ret
;
return
ret
;
...
@@ -2118,7 +2145,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
...
@@ -2118,7 +2145,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
if
((
script
=
download_script
(
pac_url
,
&
size
)))
if
((
script
=
download_script
(
pac_url
,
&
size
)))
{
{
ret
=
run_script
(
script
,
size
,
url
,
info
);
ret
=
run_script
(
script
,
size
,
url
,
info
,
options
->
dwFlags
);
free
(
script
);
free
(
script
);
}
}
...
...
dlls/winhttp/tests/winhttp.c
View file @
7ab46f03
...
@@ -5406,7 +5406,6 @@ static void test_WinHttpGetProxyForUrl(int port)
...
@@ -5406,7 +5406,6 @@ static void test_WinHttpGetProxyForUrl(int port)
ok
(
ret
,
"expected success
\n
"
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
info
.
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
,
ok
(
info
.
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
,
"info.dwAccessType = %lu
\n
"
,
info
.
dwAccessType
);
"info.dwAccessType = %lu
\n
"
,
info
.
dwAccessType
);
todo_wine
ok
(
!
wcscmp
(
info
.
lpszProxy
,
L"http___WINEHQ.ORG_Test.html_WINEHQ.ORG:8080"
)
||
ok
(
!
wcscmp
(
info
.
lpszProxy
,
L"http___WINEHQ.ORG_Test.html_WINEHQ.ORG:8080"
)
||
broken
(
old_winhttp
&&
!
wcscmp
(
info
.
lpszProxy
,
L"HTTP___WINEHQ.ORG_Test.html_WINEHQ.ORG:8080"
)),
broken
(
old_winhttp
&&
!
wcscmp
(
info
.
lpszProxy
,
L"HTTP___WINEHQ.ORG_Test.html_WINEHQ.ORG:8080"
)),
"info.Proxy = %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProxy
));
"info.Proxy = %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProxy
));
...
@@ -5420,7 +5419,6 @@ static void test_WinHttpGetProxyForUrl(int port)
...
@@ -5420,7 +5419,6 @@ static void test_WinHttpGetProxyForUrl(int port)
ok
(
ret
,
"expected success
\n
"
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
info
.
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
,
ok
(
info
.
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
,
"info.dwAccessType = %lu
\n
"
,
info
.
dwAccessType
);
"info.dwAccessType = %lu
\n
"
,
info
.
dwAccessType
);
todo_wine
ok
(
!
wcscmp
(
info
.
lpszProxy
,
L"http___winehq.org_Test.html_winehq.org:8080"
)
||
ok
(
!
wcscmp
(
info
.
lpszProxy
,
L"http___winehq.org_Test.html_winehq.org:8080"
)
||
broken
(
old_winhttp
&&
!
wcscmp
(
info
.
lpszProxy
,
L"HTTP___winehq.org_Test.html_winehq.org:8080"
)),
broken
(
old_winhttp
&&
!
wcscmp
(
info
.
lpszProxy
,
L"HTTP___winehq.org_Test.html_winehq.org:8080"
)),
"info.Proxy = %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProxy
));
"info.Proxy = %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProxy
));
...
@@ -5436,7 +5434,6 @@ static void test_WinHttpGetProxyForUrl(int port)
...
@@ -5436,7 +5434,6 @@ static void test_WinHttpGetProxyForUrl(int port)
ok
(
ret
,
"expected success
\n
"
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
info
.
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
,
ok
(
info
.
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
,
"info.dwAccessType = %lu
\n
"
,
info
.
dwAccessType
);
"info.dwAccessType = %lu
\n
"
,
info
.
dwAccessType
);
todo_wine
ok
(
!
wcscmp
(
info
.
lpszProxy
,
L"http___WINEHQ.ORG_Test.html_WINEHQ.ORG:8080"
),
ok
(
!
wcscmp
(
info
.
lpszProxy
,
L"http___WINEHQ.ORG_Test.html_WINEHQ.ORG:8080"
),
"info.Proxy = %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProxy
));
"info.Proxy = %s
\n
"
,
wine_dbgstr_w
(
info
.
lpszProxy
));
ok
(
!
info
.
lpszProxyBypass
,
"info.ProxyBypass = %s
\n
"
,
ok
(
!
info
.
lpszProxyBypass
,
"info.ProxyBypass = %s
\n
"
,
...
...
dlls/winhttp/winhttp_private.h
View file @
7ab46f03
...
@@ -455,21 +455,6 @@ static inline char *strdupWA( const WCHAR *src )
...
@@ -455,21 +455,6 @@ static inline char *strdupWA( const WCHAR *src )
return
dst
;
return
dst
;
}
}
static
inline
char
*
strdupWA_sized
(
const
WCHAR
*
src
,
DWORD
size
)
{
char
*
dst
=
NULL
;
if
(
src
)
{
int
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
src
,
size
,
NULL
,
0
,
NULL
,
NULL
)
+
1
;
if
((
dst
=
malloc
(
len
)))
{
WideCharToMultiByte
(
CP_ACP
,
0
,
src
,
size
,
dst
,
len
,
NULL
,
NULL
);
dst
[
len
-
1
]
=
0
;
}
}
return
dst
;
}
extern
HINSTANCE
winhttp_instance
;
extern
HINSTANCE
winhttp_instance
;
#define MIN_WEBSOCKET_SEND_BUFFER_SIZE 16
#define MIN_WEBSOCKET_SEND_BUFFER_SIZE 16
...
...
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