winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2009
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
1067 discussions
Start a n
N
ew thread
Juan Lang : winhttp: Use a helper function to set connect_t' s servername and port.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: de12987d7f61bc21c6345df7cbaeafbeeaa09d23 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=de12987d7f61bc21c6345df7c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:03:26 2009 -0700 winhttp: Use a helper function to set connect_t's servername and port. --- dlls/winhttp/session.c | 91 ++++++++++++++++++++++++++++++++---------------- 1 files changed, 61 insertions(+), 30 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 3b5f6e6..5d2466e 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -316,6 +316,65 @@ static BOOL should_bypass_proxy(session_t *session, LPCWSTR server) return ret; } +static +BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port ) +{ + session_t *session = connect->session; + BOOL ret = TRUE; + + if (session->proxy_server && !should_bypass_proxy(session, server)) + { + LPCWSTR colon; + + if ((colon = strchrW( session->proxy_server, ':' ))) + { + if (!connect->servername || strncmpiW( connect->servername, + session->proxy_server, colon - session->proxy_server - 1 )) + { + heap_free( connect->servername ); + if (!(connect->servername = heap_alloc( + (colon - session->proxy_server + 1) * sizeof(WCHAR) ))) + { + ret = FALSE; + goto end; + } + memcpy( connect->servername, session->proxy_server, + (colon - session->proxy_server) * sizeof(WCHAR) ); + connect->servername[colon - session->proxy_server] = 0; + if (*(colon + 1)) + connect->serverport = atoiW( colon + 1 ); + else + connect->serverport = INTERNET_DEFAULT_HTTP_PORT; + } + } + else + { + if (!connect->servername || strcmpiW( connect->servername, + session->proxy_server )) + { + heap_free( connect->servername ); + if (!(connect->servername = strdupW( session->proxy_server ))) + { + ret = FALSE; + goto end; + } + connect->serverport = INTERNET_DEFAULT_HTTP_PORT; + } + } + } + else if (server) + { + if (!(connect->servername = strdupW( server ))) + { + ret = FALSE; + goto end; + } + connect->serverport = port; + } +end: + return ret; +} + /*********************************************************************** * WinHttpConnect (winhttp.@) */ @@ -363,36 +422,8 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO if (server && !(connect->hostname = strdupW( server ))) goto end; connect->hostport = port; - if (session->proxy_server && !should_bypass_proxy(session, server)) - { - LPCWSTR colon; - - if ((colon = strchrW( session->proxy_server, ':' ))) - { - if (!(connect->servername = heap_alloc( - (colon - session->proxy_server + 1) * sizeof(WCHAR) ))) - goto end; - memcpy( connect->servername, session->proxy_server, - (colon - session->proxy_server) * sizeof(WCHAR) ); - connect->servername[colon - session->proxy_server] = 0; - if (*(colon + 1)) - connect->serverport = atoiW( colon + 1 ); - else - connect->serverport = INTERNET_DEFAULT_HTTP_PORT; - } - else - { - if (!(connect->servername = strdupW( session->proxy_server ))) - goto end; - connect->serverport = INTERNET_DEFAULT_HTTP_PORT; - } - } - else if (server) - { - if (!(connect->servername = strdupW( server ))) - goto end; - connect->serverport = port; - } + if (!set_server_for_hostname( connect, server, port )) + goto end; if (!(hconnect = alloc_handle( &connect->hdr ))) goto end; connect->hdr.handle = hconnect;
1
0
0
0
Juan Lang : winhttp: Connect to the proxy port rather than the host port.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 85579ebb4c9ece576f885482ef5ffeea3f49095a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=85579ebb4c9ece576f885482e…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:03:10 2009 -0700 winhttp: Connect to the proxy port rather than the host port. --- dlls/winhttp/request.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index a0a7a4c..37dd556 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -768,7 +768,7 @@ static BOOL open_connection( request_t *request ) if (netconn_connected( &request->netconn )) return TRUE; connect = request->connect; - port = connect->hostport ? connect->hostport : (request->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); + port = connect->serverport ? connect->serverport : (request->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, connect->servername, strlenW(connect->servername) + 1 );
1
0
0
0
Juan Lang : winhttp: When connecting via a proxy include full hostname and scheme in path.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 6fad52bd14fa0522cad877047a374680ca60ca9b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6fad52bd14fa0522cad877047…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:02:48 2009 -0700 winhttp: When connecting via a proxy include full hostname and scheme in path. --- dlls/winhttp/request.c | 54 ++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 48 insertions(+), 6 deletions(-) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index af1d5ad..a0a7a4c 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -474,6 +474,47 @@ BOOL WINAPI WinHttpAddRequestHeaders( HINTERNET hrequest, LPCWSTR headers, DWORD return ret; } +static WCHAR *build_request_path( request_t *request ) +{ + WCHAR *ret; + + if (strcmpiW( request->connect->hostname, request->connect->servername )) + { + static const WCHAR http[] = { 'h','t','t','p',0 }; + static const WCHAR https[] = { 'h','t','t','p','s',0 }; + static const WCHAR fmt[] = { '%','s',':','/','/','%','s',0 }; + LPCWSTR scheme = request->netconn.secure ? https : http; + int len; + + len = strlenW( scheme ) + strlenW( request->connect->hostname ); + /* 3 characters for '://', 1 for NUL. */ + len += 4; + if (request->connect->hostport) + { + /* 1 for ':' between host and port, up to 5 for port */ + len += 6; + } + if (request->path) + len += strlenW( request->path ); + if ((ret = heap_alloc( len * sizeof(WCHAR) ))) + { + sprintfW( ret, fmt, scheme, request->connect->hostname ); + if (request->connect->hostport) + { + static const WCHAR colonFmt[] = { ':','%','d',0 }; + + sprintfW( ret + strlenW( ret ), colonFmt, + request->connect->hostport ); + } + if (request->path) + strcatW( ret, request->path ); + } + } + else + ret = request->path; + return ret; +} + static WCHAR *build_request_string( request_t *request ) { static const WCHAR space[] = {' ',0}; @@ -481,7 +522,7 @@ static WCHAR *build_request_string( request_t *request ) static const WCHAR colon[] = {':',' ',0}; static const WCHAR twocrlf[] = {'\r','\n','\r','\n',0}; - WCHAR *ret; + WCHAR *path, *ret; const WCHAR **headers, **p; unsigned int len, i = 0, j; @@ -489,9 +530,10 @@ static WCHAR *build_request_string( request_t *request ) len = request->num_headers * 4 + 7; if (!(headers = heap_alloc( len * sizeof(LPCWSTR) ))) return NULL; + path = build_request_path( request ); headers[i++] = request->verb; headers[i++] = space; - headers[i++] = request->path; + headers[i++] = path; headers[i++] = space; headers[i++] = request->version; @@ -516,13 +558,13 @@ static WCHAR *build_request_string( request_t *request ) len++; if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) - { - heap_free( headers ); - return NULL; - } + goto out; *ret = 0; for (p = headers; *p; p++) strcatW( ret, *p ); +out: + if (path != request->path) + heap_free( path ); heap_free( headers ); return ret; }
1
0
0
0
Juan Lang : winhttp: Set connect_t' s servername and port based on proxy settings.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 0080a7f8a2a80621559c7a33f078f63987f92ba4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0080a7f8a2a80621559c7a33f…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:02:29 2009 -0700 winhttp: Set connect_t's servername and port based on proxy settings. --- dlls/winhttp/session.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 114 insertions(+), 2 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index c26e577..3b5f6e6 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -232,6 +232,90 @@ static const object_vtbl_t connect_vtbl = NULL }; +static BOOL domain_matches(LPCWSTR server, LPCWSTR domain) +{ + static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 }; + BOOL ret = FALSE; + + if (!strcmpiW( domain, localW ) && !strchrW( server, '.' )) + ret = TRUE; + else if (*domain == '*') + { + if (domain[1] == '.') + { + LPCWSTR dot; + + /* For a hostname to match a wildcard, the last domain must match + * the wildcard exactly. E.g. if the wildcard is *.a.b, and the + * hostname is
www.foo.a.b
, it matches, but a.b does not. + */ + dot = strchrW( server, '.' ); + if (dot) + { + int len = strlenW( dot + 1 ); + + if (len > strlenW( domain + 2 )) + { + LPCWSTR ptr; + + /* The server's domain is longer than the wildcard, so it + * could be a subdomain. Compare the last portion of the + * server's domain. + */ + ptr = dot + len + 1 - strlenW( domain + 2 ); + if (!strcmpiW( ptr, domain + 2 )) + { + /* This is only a match if the preceding character is + * a '.', i.e. that it is a matching domain. E.g. + * if domain is '*.b.c' and server is '
www.ab.c
' they + * do not match. + */ + ret = *(ptr - 1) == '.'; + } + } + else + ret = !strcmpiW( dot + 1, domain + 2 ); + } + } + } + else + ret = !strcmpiW( server, domain ); + return ret; +} + +/* Matches INTERNET_MAX_USER_NAME_LENGTH in wininet.h, also RFC 1035 */ +#define MAX_HOST_NAME_LENGTH 256 + +static BOOL should_bypass_proxy(session_t *session, LPCWSTR server) +{ + LPCWSTR ptr; + BOOL ret = FALSE; + + ptr = session->proxy_bypass; + do { + LPCWSTR tmp = ptr; + + ptr = strchrW( ptr, ';' ); + if (!ptr) + ptr = strchrW( tmp, ' ' ); + if (ptr) + { + if (ptr - tmp < MAX_HOST_NAME_LENGTH) + { + WCHAR domain[MAX_HOST_NAME_LENGTH]; + + memcpy( domain, tmp, (ptr - tmp) * sizeof(WCHAR) ); + domain[ptr - tmp] = 0; + ret = domain_matches( server, domain ); + } + ptr += 1; + } + else if (*tmp) + ret = domain_matches( server, tmp ); + } while (ptr && !ret); + return ret; +} + /*********************************************************************** * WinHttpConnect (winhttp.@) */ @@ -279,8 +363,36 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO if (server && !(connect->hostname = strdupW( server ))) goto end; connect->hostport = port; - if (server && !(connect->servername = strdupW( server ))) goto end; - connect->serverport = port; + if (session->proxy_server && !should_bypass_proxy(session, server)) + { + LPCWSTR colon; + + if ((colon = strchrW( session->proxy_server, ':' ))) + { + if (!(connect->servername = heap_alloc( + (colon - session->proxy_server + 1) * sizeof(WCHAR) ))) + goto end; + memcpy( connect->servername, session->proxy_server, + (colon - session->proxy_server) * sizeof(WCHAR) ); + connect->servername[colon - session->proxy_server] = 0; + if (*(colon + 1)) + connect->serverport = atoiW( colon + 1 ); + else + connect->serverport = INTERNET_DEFAULT_HTTP_PORT; + } + else + { + if (!(connect->servername = strdupW( session->proxy_server ))) + goto end; + connect->serverport = INTERNET_DEFAULT_HTTP_PORT; + } + } + else if (server) + { + if (!(connect->servername = strdupW( server ))) + goto end; + connect->serverport = port; + } if (!(hconnect = alloc_handle( &connect->hdr ))) goto end; connect->hdr.handle = hconnect;
1
0
0
0
Juan Lang : winhttp: Honor WINHTTP_ACCESS_TYPE_DEFAULT_PROXY in WinHttpOpen .
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 5575957657f2e256d91fc5b895a033f428b5f63c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5575957657f2e256d91fc5b89…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:01:48 2009 -0700 winhttp: Honor WINHTTP_ACCESS_TYPE_DEFAULT_PROXY in WinHttpOpen. --- dlls/winhttp/session.c | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 8a9a039..c26e577 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -168,13 +168,35 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST session->hdr.vtbl = &session_vtbl; session->hdr.flags = flags; session->hdr.refs = 1; - session->access = access; session->hdr.redirect_policy = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP; list_init( &session->cookie_cache ); if (agent && !(session->agent = strdupW( agent ))) goto end; - if (proxy && !(session->proxy_server = strdupW( proxy ))) goto end; - if (bypass && !(session->proxy_bypass = strdupW( bypass ))) goto end; + if (access == WINHTTP_ACCESS_TYPE_DEFAULT_PROXY) + { + WINHTTP_PROXY_INFO info; + + WinHttpGetDefaultProxyConfiguration( &info ); + session->access = info.dwAccessType; + if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy ))) + { + GlobalFree( (LPWSTR)info.lpszProxy ); + GlobalFree( (LPWSTR)info.lpszProxyBypass ); + goto end; + } + if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass ))) + { + GlobalFree( (LPWSTR)info.lpszProxy ); + GlobalFree( (LPWSTR)info.lpszProxyBypass ); + goto end; + } + } + else if (access == WINHTTP_ACCESS_TYPE_NAMED_PROXY) + { + session->access = access; + if (proxy && !(session->proxy_server = strdupW( proxy ))) goto end; + if (bypass && !(session->proxy_bypass = strdupW( bypass ))) goto end; + } if (!(handle = alloc_handle( &session->hdr ))) goto end; session->hdr.handle = handle;
1
0
0
0
Juan Lang : winhttp: Support getting the default proxy settings from the http_proxy environment variable .
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 51e54a8b75d8e9ce8e282633ff8dde13c3119669 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=51e54a8b75d8e9ce8e282633f…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:01:26 2009 -0700 winhttp: Support getting the default proxy settings from the http_proxy environment variable. --- dlls/winhttp/session.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 17a0a5f..8a9a039 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -21,6 +21,7 @@ #include "wine/debug.h" #include <stdarg.h> +#include <stdlib.h> #include "windef.h" #include "winbase.h" @@ -686,6 +687,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) LONG l; HKEY key; BOOL direct = TRUE; + char *envproxy; TRACE("%p\n", info); @@ -749,6 +751,9 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) direct = FALSE; info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; + TRACE("http proxy (from registry) = %s, bypass = %s\n", + debugstr_w(info->lpszProxy), + debugstr_w(info->lpszProxyBypass)); } } } @@ -757,6 +762,23 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) } RegCloseKey( key ); } + else if ((envproxy = getenv( "http_proxy" ))) + { + WCHAR *envproxyW; + int len; + + len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 ); + if ((envproxyW = GlobalAlloc( 0, len * sizeof(WCHAR)))) + { + MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len ); + direct = FALSE; + info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; + info->lpszProxy = envproxyW; + info->lpszProxyBypass = NULL; + TRACE("http proxy (from environment) = %s\n", + debugstr_w(info->lpszProxy)); + } + } if (direct) { info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
1
0
0
0
Juan Lang : winhttp: Implement WinHttpGetDefaultProxyConfiguration.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: fd9aa244d3a6010932caf759ce79114a13f39add URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fd9aa244d3a6010932caf759c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 13:00:38 2009 -0700 winhttp: Implement WinHttpGetDefaultProxyConfiguration. --- dlls/winhttp/session.c | 91 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 87 insertions(+), 4 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 863b226..17a0a5f 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -669,17 +669,100 @@ struct winhttp_settings_header DWORD flags; /* one of WINHTTP_PROXY_TYPE_* */ }; +static inline void copy_char_to_wchar_sz(const BYTE *src, DWORD len, WCHAR *dst) +{ + const BYTE *begin; + + for (begin = src; src - begin < len; src++, dst++) + *dst = *src; + *dst = 0; +} + /*********************************************************************** * WinHttpGetDefaultProxyConfiguration (winhttp.@) */ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) { - FIXME("%p\n", info); + LONG l; + HKEY key; + BOOL direct = TRUE; - info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY; - info->lpszProxy = NULL; - info->lpszProxyBypass = NULL; + TRACE("%p\n", info); + l = RegOpenKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, KEY_READ, &key ); + if (!l) + { + DWORD type, size = 0; + + l = RegQueryValueExW( key, WinHttpSettings, NULL, &type, NULL, &size ); + if (!l && type == REG_BINARY && + size >= sizeof(struct winhttp_settings_header) + 2 * sizeof(DWORD)) + { + BYTE *buf = heap_alloc( size ); + + if (buf) + { + struct winhttp_settings_header *hdr = + (struct winhttp_settings_header *)buf; + DWORD *len = (DWORD *)(hdr + 1); + + l = RegQueryValueExW( key, WinHttpSettings, NULL, NULL, buf, + &size ); + if (!l && hdr->magic == WINHTTPSETTINGS_MAGIC && + hdr->unknown == 0) + { + if (hdr->flags & WINHTTP_PROXY_TYPE_PROXY) + { + BOOL sane = FALSE; + + /* Sanity-check length of proxy string */ + if ((BYTE *)len - buf + *len <= size) + { + sane = TRUE; + info->lpszProxy = GlobalAlloc( 0, + (*len + 1) * sizeof(WCHAR) ); + if (info->lpszProxy) + copy_char_to_wchar_sz( (BYTE *)(len + 1), + *len, (LPWSTR)info->lpszProxy ); + len = (DWORD *)((BYTE *)(len + 1) + *len); + } + if (sane) + { + /* Sanity-check length of proxy bypass string */ + if ((BYTE *)len - buf + *len <= size) + { + info->lpszProxyBypass = GlobalAlloc( 0, + (*len + 1) * sizeof(WCHAR) ); + if (info->lpszProxyBypass) + copy_char_to_wchar_sz( (BYTE *)(len + 1), + *len, (LPWSTR)info->lpszProxyBypass ); + } + else + { + sane = FALSE; + GlobalFree( (LPWSTR)info->lpszProxy ); + info->lpszProxy = NULL; + } + } + if (sane) + { + direct = FALSE; + info->dwAccessType = + WINHTTP_ACCESS_TYPE_NAMED_PROXY; + } + } + } + heap_free( buf ); + } + } + RegCloseKey( key ); + } + if (direct) + { + info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY; + info->lpszProxy = NULL; + info->lpszProxyBypass = NULL; + } return TRUE; }
1
0
0
0
Juan Lang : winhttp: Implement WinHttpSetDefaultProxyConfiguration.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 3469a021be5aee6c67b606e1a46da48cc52fdf46 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3469a021be5aee6c67b606e1a…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 12:53:14 2009 -0700 winhttp: Implement WinHttpSetDefaultProxyConfiguration. --- dlls/winhttp/Makefile.in | 2 +- dlls/winhttp/session.c | 123 +++++++++++++++++++++++++++++++++++++++++- dlls/winhttp/tests/winhttp.c | 5 -- 3 files changed, 122 insertions(+), 8 deletions(-) diff --git a/dlls/winhttp/Makefile.in b/dlls/winhttp/Makefile.in index 78d3814..7a61dc9 100644 --- a/dlls/winhttp/Makefile.in +++ b/dlls/winhttp/Makefile.in @@ -5,7 +5,7 @@ VPATH = @srcdir@ MODULE = winhttp.dll IMPORTLIB = winhttp IMPORTS = shlwapi kernel32 -DELAYIMPORTS = crypt32 +DELAYIMPORTS = crypt32 advapi32 EXTRALIBS = @SOCKETLIBS@ C_SRCS = \ diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index e8c1677..863b226 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -26,6 +26,7 @@ #include "winbase.h" #include "winhttp.h" #include "wincrypt.h" +#include "winreg.h" #include "winhttp_private.h" @@ -648,6 +649,26 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url ) return FALSE; } +static const WCHAR Connections[] = { + 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', + 'C','o','n','n','e','c','t','i','o','n','s',0 }; +static const WCHAR WinHttpSettings[] = { + 'W','i','n','H','t','t','p','S','e','t','t','i','n','g','s',0 }; +static const DWORD WINHTTPSETTINGS_MAGIC = 0x18; +static const DWORD WINHTTP_PROXY_TYPE_DIRECT = 1; +static const DWORD WINHTTP_PROXY_TYPE_PROXY = 2; + +struct winhttp_settings_header +{ + DWORD magic; + DWORD unknown; /* always zero? */ + DWORD flags; /* one of WINHTTP_PROXY_TYPE_* */ +}; + /*********************************************************************** * WinHttpGetDefaultProxyConfiguration (winhttp.@) */ @@ -703,8 +724,106 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO */ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) { - FIXME("%p\n", info); - return TRUE; + LONG l; + HKEY key; + BOOL ret = FALSE; + const WCHAR *src; + + TRACE("%p\n", info); + + if (!info) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + switch (info->dwAccessType) + { + case WINHTTP_ACCESS_TYPE_NO_PROXY: + break; + case WINHTTP_ACCESS_TYPE_NAMED_PROXY: + if (!info->lpszProxy) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + /* Only ASCII characters are allowed */ + for (src = info->lpszProxy; *src; src++) + if (*src > 0x7f) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + if (info->lpszProxyBypass) + { + for (src = info->lpszProxyBypass; *src; src++) + if (*src > 0x7f) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + } + break; + default: + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + l = RegCreateKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, NULL, 0, + KEY_WRITE, NULL, &key, NULL ); + if (!l) + { + DWORD size = sizeof(struct winhttp_settings_header) + 2 * sizeof(DWORD); + BYTE *buf; + + if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY) + { + size += strlenW( info->lpszProxy ); + if (info->lpszProxyBypass) + size += strlenW( info->lpszProxyBypass ); + } + buf = heap_alloc( size ); + if (buf) + { + struct winhttp_settings_header *hdr = + (struct winhttp_settings_header *)buf; + DWORD *len = (DWORD *)(hdr + 1); + + hdr->magic = WINHTTPSETTINGS_MAGIC; + hdr->unknown = 0; + if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY) + { + BYTE *dst; + + hdr->flags = WINHTTP_PROXY_TYPE_PROXY; + *len++ = strlenW( info->lpszProxy ); + for (dst = (BYTE *)len, src = info->lpszProxy; *src; + src++, dst++) + *dst = *src; + len = (DWORD *)dst; + if (info->lpszProxyBypass) + { + *len++ = strlenW( info->lpszProxyBypass ); + for (dst = (BYTE *)len, src = info->lpszProxyBypass; *src; + src++, dst++) + *dst = *src; + } + else + *len++ = 0; + } + else + { + hdr->flags = WINHTTP_PROXY_TYPE_DIRECT; + *len++ = 0; + *len++ = 0; + } + l = RegSetValueExW( key, WinHttpSettings, 0, REG_BINARY, buf, size ); + if (!l) + ret = TRUE; + heap_free( buf ); + } + RegCloseKey( key ); + } + return ret; } /*********************************************************************** diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 9dced9d..5a1db48 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -902,7 +902,6 @@ static void test_set_default_proxy_config(void) SetLastError(0xdeadbeef); ret = WinHttpSetDefaultProxyConfiguration(NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); @@ -911,7 +910,6 @@ static void test_set_default_proxy_config(void) info.lpszProxy = info.lpszProxyBypass = NULL; SetLastError(0xdeadbeef); ret = WinHttpSetDefaultProxyConfiguration(&info); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); @@ -920,13 +918,11 @@ static void test_set_default_proxy_config(void) info.lpszProxy = info.lpszProxyBypass = NULL; SetLastError(0xdeadbeef); ret = WinHttpSetDefaultProxyConfiguration(&info); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); info.lpszProxyBypass = normalString; SetLastError(0xdeadbeef); ret = WinHttpSetDefaultProxyConfiguration(&info); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); @@ -934,7 +930,6 @@ static void test_set_default_proxy_config(void) info.lpszProxy = wideString; SetLastError(0xdeadbeef); ret = WinHttpSetDefaultProxyConfiguration(&info); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
1
0
0
0
Juan Lang : winhttp: Add tests for WinHttpSetDefaultProxyConfiguration.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 461b1240153beed83e631ba3c28ba30eaa16d9a7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=461b1240153beed83e631ba3c…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Jul 14 12:36:41 2009 -0700 winhttp: Add tests for WinHttpSetDefaultProxyConfiguration. --- dlls/winhttp/session.c | 3 +- dlls/winhttp/tests/Makefile.in | 2 +- dlls/winhttp/tests/winhttp.c | 130 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 3 deletions(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 55f9779..e8c1677 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -703,8 +703,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO */ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info ) { - FIXME("%p [%u, %s, %s]\n", info, info->dwAccessType, debugstr_w(info->lpszProxy), - debugstr_w(info->lpszProxyBypass)); + FIXME("%p\n", info); return TRUE; } diff --git a/dlls/winhttp/tests/Makefile.in b/dlls/winhttp/tests/Makefile.in index 561efac..670ee1a 100644 --- a/dlls/winhttp/tests/Makefile.in +++ b/dlls/winhttp/tests/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = winhttp.dll -IMPORTS = winhttp kernel32 +IMPORTS = winhttp advapi32 kernel32 CTESTS = \ notification.c \ diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 74e1c9a..9dced9d 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -24,6 +24,7 @@ #include <winbase.h> #include <winhttp.h> #include <wincrypt.h> +#include <winreg.h> #include "wine/test.h" @@ -817,6 +818,134 @@ static void test_request_parameter_defaults(void) WinHttpCloseHandle(ses); } +static const WCHAR Connections[] = { + 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', + 'C','o','n','n','e','c','t','i','o','n','s',0 }; +static const WCHAR WinHttpSettings[] = { + 'W','i','n','H','t','t','p','S','e','t','t','i','n','g','s',0 }; + +static DWORD get_default_proxy_reg_value( BYTE *buf, DWORD len, DWORD *type ) +{ + LONG l; + HKEY key; + DWORD ret = 0; + + l = RegOpenKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, KEY_READ, &key ); + if (!l) + { + DWORD size = 0; + + l = RegQueryValueExW( key, WinHttpSettings, NULL, type, NULL, &size ); + if (!l) + { + if (size <= len) + l = RegQueryValueExW( key, WinHttpSettings, NULL, type, buf, + &size ); + if (!l) + ret = size; + } + RegCloseKey( key ); + } + return ret; +} + +static void set_default_proxy_reg_value( BYTE *buf, DWORD len, DWORD type ) +{ + LONG l; + HKEY key; + + l = RegCreateKeyExW( HKEY_LOCAL_MACHINE, Connections, 0, NULL, 0, + KEY_WRITE, NULL, &key, NULL ); + if (!l) + { + RegSetValueExW( key, WinHttpSettings, 0, type, buf, len ); + RegCloseKey( key ); + } +} + +static void test_set_default_proxy_config(void) +{ + static const WCHAR wideString[] = { 0x226f, 0x575b, 0 }; + static const WCHAR normalString[] = { 'f','o','o',0 }; + DWORD type, len; + BYTE *saved_proxy_settings = NULL; + WINHTTP_PROXY_INFO info; + BOOL ret; + + /* FIXME: it would be simpler to read the current settings using + * WinHttpGetDefaultProxyConfiguration and save them using + * WinHttpSetDefaultProxyConfiguration, but they appear to have a bug. + * + * If a proxy is configured in the registry, e.g. via 'proxcfg -p "foo"', + * the access type reported by WinHttpGetDefaultProxyConfiguration is 1, + * WINHTTP_ACCESS_TYPE_NO_PROXY, whereas it should be + * WINHTTP_ACCESS_TYPE_NAMED_PROXY. + * If WinHttpSetDefaultProxyConfiguration is called with dwAccessType = 1, + * the lpszProxy and lpszProxyBypass values are ignored. + * Thus, if a proxy is set with proxycfg, then calling + * WinHttpGetDefaultProxyConfiguration followed by + * WinHttpSetDefaultProxyConfiguration results in the proxy settings + * getting deleted from the registry. + * + * Instead I read the current registry value and restore it directly. + */ + len = get_default_proxy_reg_value( NULL, 0, &type ); + if (len) + { + saved_proxy_settings = HeapAlloc( GetProcessHeap(), 0, len ); + len = get_default_proxy_reg_value( saved_proxy_settings, len, &type ); + } + + SetLastError(0xdeadbeef); + ret = WinHttpSetDefaultProxyConfiguration(NULL); + todo_wine + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + + /* test with invalid access type */ + info.dwAccessType = 0xdeadbeef; + info.lpszProxy = info.lpszProxyBypass = NULL; + SetLastError(0xdeadbeef); + ret = WinHttpSetDefaultProxyConfiguration(&info); + todo_wine + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + + /* at a minimum, the proxy server must be set */ + info.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; + info.lpszProxy = info.lpszProxyBypass = NULL; + SetLastError(0xdeadbeef); + ret = WinHttpSetDefaultProxyConfiguration(&info); + todo_wine + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + info.lpszProxyBypass = normalString; + SetLastError(0xdeadbeef); + ret = WinHttpSetDefaultProxyConfiguration(&info); + todo_wine + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + + /* the proxy server can't have wide characters */ + info.lpszProxy = wideString; + SetLastError(0xdeadbeef); + ret = WinHttpSetDefaultProxyConfiguration(&info); + todo_wine + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + + info.lpszProxy = normalString; + SetLastError(0xdeadbeef); + ret = WinHttpSetDefaultProxyConfiguration(&info); + ok(ret, "WinHttpSetDefaultProxyConfiguration failed: %d\n", GetLastError()); + + set_default_proxy_reg_value( saved_proxy_settings, len, type ); +} + START_TEST (winhttp) { test_OpenRequest(); @@ -827,4 +956,5 @@ START_TEST (winhttp) test_secure_connection(); test_request_parameter_defaults(); test_QueryOption(); + test_set_default_proxy_config(); }
1
0
0
0
Vladimir Pankratov : comctl32: Fix division by zero.
by Alexandre Julliard
15 Jul '09
15 Jul '09
Module: wine Branch: master Commit: 585e8dfbb4adac0ff1f5dd995ff92a2c4a0e288b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=585e8dfbb4adac0ff1f5dd995…
Author: Vladimir Pankratov <scriptkid(a)mail.ru> Date: Tue Jul 14 14:01:23 2009 +0500 comctl32: Fix division by zero. --- dlls/comctl32/toolbar.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index c6cf83e..0d11b2b 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -4846,7 +4846,7 @@ TOOLBAR_SetRows (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPRECT lprc) if (seps) FIXME("Separators unhandled\n"); /* Round up so more per line, i.e., less rows */ - idealWrap = (infoPtr->nNumButtons - hidden + (rows-1)) / rows; + idealWrap = (infoPtr->nNumButtons - hidden + (rows-1)) / (rows ? rows : 1); /* Calculate ideal wrap point if we are allowed to grow, but cannot achieve the requested number of rows. */
1
0
0
0
← Newer
1
...
40
41
42
43
44
45
46
...
107
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Results per page:
10
25
50
100
200