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
dfa014a5
Commit
dfa014a5
authored
May 17, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
May 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Don't assume maximum URL length in HTTP_DealWithProxy.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3413d017
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
76 deletions
+51
-76
http.c
dlls/wininet/http.c
+26
-27
internet.c
dlls/wininet/internet.c
+24
-48
internet.h
dlls/wininet/internet.h
+1
-1
No files found.
dlls/wininet/http.c
View file @
dfa014a5
...
...
@@ -1788,40 +1788,39 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
{
static
const
WCHAR
protoHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
const
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
szFormat
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
0
};
WCHAR
protoProxy
[
INTERNET_MAX_URL_LENGTH
];
DWORD
protoProxyLen
=
INTERNET_MAX_URL_LENGTH
;
WCHAR
proxy
[
INTERNET_MAX_URL_LENGTH
];
static
WCHAR
szNul
[]
=
{
0
};
URL_COMPONENTSW
UrlComponents
;
server_t
*
new_server
;
URL_COMPONENTSW
UrlComponents
=
{
sizeof
(
UrlComponents
)
};
server_t
*
new_server
=
NULL
;
WCHAR
*
proxy
;
BOOL
is_https
;
memset
(
&
UrlComponents
,
0
,
sizeof
UrlComponents
);
UrlComponents
.
dwStructSize
=
sizeof
UrlComponents
;
UrlComponents
.
dwHostNameLength
=
1
;
if
(
!
INTERNET_FindProxyForProtocol
(
hIC
->
proxy
,
protoHttp
,
protoProxy
,
&
protoProxyLen
))
return
FALSE
;
if
(
CSTR_EQUAL
!=
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
protoProxy
,
strlenW
(
szHttp
),
szHttp
,
strlenW
(
szHttp
))
)
sprintfW
(
proxy
,
szFormat
,
protoProxy
);
else
strcpyW
(
proxy
,
protoProxy
);
if
(
!
InternetCrackUrlW
(
proxy
,
0
,
0
,
&
UrlComponents
)
)
return
FALSE
;
if
(
UrlComponents
.
dwHostNameLength
==
0
)
proxy
=
INTERNET_FindProxyForProtocol
(
hIC
->
proxy
,
protoHttp
);
if
(
!
proxy
)
return
FALSE
;
if
(
CSTR_EQUAL
!=
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
proxy
,
strlenW
(
szHttp
),
szHttp
,
strlenW
(
szHttp
)))
{
WCHAR
*
proxy_url
=
heap_alloc
(
strlenW
(
proxy
)
*
sizeof
(
WCHAR
)
+
sizeof
(
szHttp
));
if
(
!
proxy_url
)
return
FALSE
;
strcpyW
(
proxy_url
,
szHttp
);
strcatW
(
proxy_url
,
proxy
);
heap_free
(
proxy
);
proxy
=
proxy_url
;
}
if
(
!
request
->
path
)
request
->
path
=
szNul
;
UrlComponents
.
dwHostNameLength
=
1
;
if
(
InternetCrackUrlW
(
proxy
,
0
,
0
,
&
UrlComponents
)
&&
UrlComponents
.
dwHostNameLength
)
{
if
(
!
request
->
path
)
request
->
path
=
szNul
;
is_https
=
(
UrlComponents
.
nScheme
==
INTERNET_SCHEME_HTTPS
);
if
(
is_https
&&
UrlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
UrlComponents
.
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
is_https
=
(
UrlComponents
.
nScheme
==
INTERNET_SCHEME_HTTPS
);
if
(
is_https
&&
UrlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
UrlComponents
.
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
new_server
=
get_server
(
substr
(
UrlComponents
.
lpszHostName
,
UrlComponents
.
dwHostNameLength
),
UrlComponents
.
nPort
,
is_https
,
TRUE
);
new_server
=
get_server
(
substr
(
UrlComponents
.
lpszHostName
,
UrlComponents
.
dwHostNameLength
),
UrlComponents
.
nPort
,
is_https
,
TRUE
);
}
heap_free
(
proxy
);
if
(
!
new_server
)
return
FALSE
;
...
...
dlls/wininet/internet.c
View file @
dfa014a5
...
...
@@ -390,15 +390,15 @@ static LONG INTERNET_SaveProxySettings( proxyinfo_t *lpwpi )
* *foundProxyLen is set to the required size in WCHARs, including the
* NULL terminator, and the last error is set to ERROR_INSUFFICIENT_BUFFER.
*/
BOOL
INTERNET_FindProxyForProtocol
(
LPCWSTR
szProxy
,
LPCWSTR
proto
,
WCHAR
*
foundProxy
,
DWORD
*
foundProxyLen
)
WCHAR
*
INTERNET_FindProxyForProtocol
(
LPCWSTR
szProxy
,
LPCWSTR
proto
)
{
LPCWSTR
ptr
;
BOOL
ret
=
FALSE
;
WCHAR
*
ret
=
NULL
;
const
WCHAR
*
ptr
;
TRACE
(
"(%s, %s)
\n
"
,
debugstr_w
(
szProxy
),
debugstr_w
(
proto
));
/* First, look for the specified protocol (proto=scheme://host:port) */
for
(
ptr
=
szProxy
;
!
ret
&&
ptr
&&
*
ptr
;
)
for
(
ptr
=
szProxy
;
ptr
&&
*
ptr
;
)
{
LPCWSTR
end
,
equal
;
...
...
@@ -408,60 +408,36 @@ BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundP
equal
-
ptr
==
strlenW
(
proto
)
&&
!
strncmpiW
(
proto
,
ptr
,
strlenW
(
proto
)))
{
if
(
end
-
equal
>
*
foundProxyLen
)
{
WARN
(
"buffer too short for %s
\n
"
,
debugstr_wn
(
equal
+
1
,
end
-
equal
-
1
));
*
foundProxyLen
=
end
-
equal
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
{
memcpy
(
foundProxy
,
equal
+
1
,
(
end
-
equal
)
*
sizeof
(
WCHAR
));
foundProxy
[
end
-
equal
]
=
0
;
ret
=
TRUE
;
}
ret
=
heap_strndupW
(
equal
+
1
,
end
-
equal
-
1
);
TRACE
(
"found proxy for %s: %s
\n
"
,
debugstr_w
(
proto
),
debugstr_w
(
ret
));
return
ret
;
}
if
(
*
end
==
' '
)
ptr
=
end
+
1
;
else
ptr
=
end
;
}
if
(
!
ret
)
/* It wasn't found: look for no protocol */
for
(
ptr
=
szProxy
;
ptr
&&
*
ptr
;
)
{
/* It wasn't found: look for no protocol */
for
(
ptr
=
szProxy
;
!
ret
&&
ptr
&&
*
ptr
;
)
{
LPCWSTR
end
;
LPCWSTR
end
;
if
(
!
(
end
=
strchrW
(
ptr
,
' '
)))
end
=
ptr
+
strlenW
(
ptr
);
if
(
!
strchrW
(
ptr
,
'='
))
{
if
(
end
-
ptr
+
1
>
*
foundProxyLen
)
{
WARN
(
"buffer too short for %s
\n
"
,
debugstr_wn
(
ptr
,
end
-
ptr
));
*
foundProxyLen
=
end
-
ptr
+
1
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
{
memcpy
(
foundProxy
,
ptr
,
(
end
-
ptr
)
*
sizeof
(
WCHAR
));
foundProxy
[
end
-
ptr
]
=
0
;
ret
=
TRUE
;
}
}
if
(
*
end
==
' '
)
ptr
=
end
+
1
;
else
ptr
=
end
;
if
(
!
(
end
=
strchrW
(
ptr
,
' '
)))
end
=
ptr
+
strlenW
(
ptr
);
if
(
!
strchrW
(
ptr
,
'='
))
{
ret
=
heap_strndupW
(
ptr
,
end
-
ptr
);
TRACE
(
"found proxy for %s: %s
\n
"
,
debugstr_w
(
proto
),
debugstr_w
(
ret
));
return
ret
;
}
if
(
*
end
==
' '
)
ptr
=
end
+
1
;
else
ptr
=
end
;
}
if
(
ret
)
TRACE
(
"found proxy for %s: %s
\n
"
,
debugstr_w
(
proto
),
debugstr_w
(
foundProxy
));
return
ret
;
return
NULL
;
}
/***********************************************************************
...
...
dlls/wininet/internet.h
View file @
dfa014a5
...
...
@@ -450,7 +450,7 @@ VOID SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,
VOID
INTERNET_SendCallback
(
object_header_t
*
hdr
,
DWORD_PTR
dwContext
,
DWORD
dwInternetStatus
,
LPVOID
lpvStatusInfo
,
DWORD
dwStatusInfoLength
)
DECLSPEC_HIDDEN
;
BOOL
INTERNET_FindProxyForProtocol
(
LPCWSTR
szProxy
,
LPCWSTR
proto
,
WCHAR
*
foundProxy
,
DWORD
*
foundProxyLen
)
DECLSPEC_HIDDEN
;
WCHAR
*
INTERNET_FindProxyForProtocol
(
LPCWSTR
szProxy
,
LPCWSTR
proto
)
DECLSPEC_HIDDEN
;
DWORD
create_netconn
(
BOOL
,
server_t
*
,
DWORD
,
BOOL
,
DWORD
,
netconn_t
**
)
DECLSPEC_HIDDEN
;
void
free_netconn
(
netconn_t
*
)
DECLSPEC_HIDDEN
;
...
...
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