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
c7f93666
Commit
c7f93666
authored
Mar 30, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Mar 31, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Support http_proxy environment variable.
Based on a patch by Mike Hearn.
parent
8c63754d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
28 deletions
+46
-28
internet.c
dlls/wininet/internet.c
+46
-28
No files found.
dlls/wininet/internet.c
View file @
c7f93666
...
...
@@ -336,53 +336,57 @@ BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl,
/***********************************************************************
* INTERNET_ConfigureProxy
FromReg
* INTERNET_ConfigureProxy
*
* FIXME:
* The proxy may be specified in the form 'http=proxy.my.org'
* Presumably that means there can be ftp=ftpproxy.my.org too.
*/
static
BOOL
INTERNET_ConfigureProxy
FromReg
(
LPWININETAPPINFOW
lpwai
)
static
BOOL
INTERNET_ConfigureProxy
(
LPWININETAPPINFOW
lpwai
)
{
HKEY
key
;
DWORD
r
,
keytype
,
len
,
enabled
;
LPCSTR
lpszInternetSettings
=
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Internet Settings"
;
DWORD
type
,
len
,
enabled
=
0
;
LPCSTR
envproxy
;
static
const
WCHAR
szInternetSettings
[]
=
{
'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'
,
0
};
static
const
WCHAR
szProxyServer
[]
=
{
'P'
,
'r'
,
'o'
,
'x'
,
'y'
,
'S'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
szProxyEnable
[]
=
{
'P'
,
'r'
,
'o'
,
'x'
,
'y'
,
'E'
,
'n'
,
'a'
,
'b'
,
'l'
,
'e'
,
0
};
r
=
RegOpenKeyA
(
HKEY_CURRENT_USER
,
lpszInternetSettings
,
&
key
);
if
(
r
!=
ERROR_SUCCESS
)
return
FALSE
;
if
(
RegOpenKeyW
(
HKEY_CURRENT_USER
,
szInternetSettings
,
&
key
))
return
FALSE
;
len
=
sizeof
enabled
;
r
=
RegQueryValueExA
(
key
,
"ProxyEnable"
,
NULL
,
&
keytype
,
(
BYTE
*
)
&
enabled
,
&
len
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
enabled
)
if
(
!
RegQueryValueExW
(
key
,
szProxyEnable
,
NULL
,
&
type
,
(
BYTE
*
)
&
enabled
,
&
len
)
&&
(
type
==
REG_DWORD
))
{
if
(
enabled
)
{
TRACE
(
"Proxy is enabled.
\n
"
);
/* figure out how much memory the proxy setting takes */
r
=
RegQueryValueExW
(
key
,
szProxyServer
,
NULL
,
&
keytype
,
NULL
,
&
len
);
if
(
(
r
==
ERROR_SUCCESS
)
&&
len
&&
(
keytype
==
REG_SZ
)
)
if
(
!
RegQueryValueExW
(
key
,
szProxyServer
,
NULL
,
&
type
,
NULL
,
&
len
)
&&
len
&&
(
type
==
REG_SZ
))
{
LPWSTR
szProxy
,
p
;
static
const
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
'='
,
0
};
szProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
RegQueryValueExW
(
key
,
szProxyServer
,
NULL
,
&
keytype
,
(
BYTE
*
)
szProxy
,
&
len
);
if
(
!
(
szProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
{
RegCloseKey
(
key
);
return
FALSE
;
}
RegQueryValueExW
(
key
,
szProxyServer
,
NULL
,
&
type
,
(
BYTE
*
)
szProxy
,
&
len
);
/* find the http proxy, and strip away everything else */
p
=
strstrW
(
szProxy
,
szHttp
);
if
(
p
)
if
(
p
)
{
p
+=
lstrlenW
(
szHttp
);
p
+=
lstrlenW
(
szHttp
);
lstrcpyW
(
szProxy
,
p
);
}
p
=
strchrW
(
szProxy
,
' '
);
if
(
p
)
*
p
=
0
;
if
(
p
)
*
p
=
0
;
lpwai
->
dwAccessType
=
INTERNET_OPEN_TYPE_PROXY
;
lpwai
->
lpszProxy
=
szProxy
;
...
...
@@ -390,13 +394,27 @@ static BOOL INTERNET_ConfigureProxyFromReg( LPWININETAPPINFOW lpwai )
TRACE
(
"http proxy = %s
\n
"
,
debugstr_w
(
lpwai
->
lpszProxy
));
}
else
ERR
(
"Couldn't read proxy server settings
.
\n
"
);
ERR
(
"Couldn't read proxy server settings from registry
.
\n
"
);
}
else
TRACE
(
"Proxy is not enabled.
\n
"
);
RegCloseKey
(
key
);
}
else
if
((
envproxy
=
getenv
(
"http_proxy"
)))
{
WCHAR
*
envproxyW
;
len
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
envproxy
,
-
1
,
NULL
,
0
);
if
(
!
(
envproxyW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
))))
return
FALSE
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
envproxy
,
-
1
,
envproxyW
,
len
);
lpwai
->
dwAccessType
=
INTERNET_OPEN_TYPE_PROXY
;
lpwai
->
lpszProxy
=
envproxyW
;
TRACE
(
"http proxy (from environment) = %s
\n
"
,
debugstr_w
(
lpwai
->
lpszProxy
));
enabled
=
1
;
}
if
(
!
enabled
)
TRACE
(
"Proxy is not enabled.
\n
"
);
return
enabled
;
RegCloseKey
(
key
);
return
(
enabled
>
0
);
}
/***********************************************************************
...
...
@@ -582,7 +600,7 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
lstrcpyW
(
lpwai
->
lpszAgent
,
lpszAgent
);
}
if
(
dwAccessType
==
INTERNET_OPEN_TYPE_PRECONFIG
)
INTERNET_ConfigureProxy
FromReg
(
lpwai
);
INTERNET_ConfigureProxy
(
lpwai
);
else
if
(
NULL
!=
lpszProxy
)
{
lpwai
->
lpszProxy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
...
...
@@ -1922,7 +1940,7 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
{
TRACE
(
"Getting global proxy info
\n
"
);
memset
(
&
wai
,
0
,
sizeof
(
WININETAPPINFOW
));
INTERNET_ConfigureProxy
FromReg
(
&
wai
);
INTERNET_ConfigureProxy
(
&
wai
);
lpwai
=
&
wai
;
}
...
...
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