Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ac26517a
Commit
ac26517a
authored
Jan 24, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Correctly detect https connections and custom port numbers in HTTP_HandleRedirect.
parent
9526499b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
41 deletions
+26
-41
http.c
dlls/wininet/http.c
+26
-41
No files found.
dlls/wininet/http.c
View file @
ac26517a
...
...
@@ -3788,8 +3788,10 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
WCHAR
protocol
[
INTERNET_MAX_SCHEME_LENGTH
];
WCHAR
hostName
[
INTERNET_MAX_HOST_NAME_LENGTH
];
WCHAR
userName
[
INTERNET_MAX_USER_NAME_LENGTH
];
static
WCHAR
szHttp
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
WCHAR
szHttps
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
BOOL
custom_port
=
FALSE
;
static
WCHAR
httpW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
WCHAR
httpsW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
userName
[
0
]
=
0
;
hostName
[
0
]
=
0
;
...
...
@@ -3811,50 +3813,33 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
if
(
!
InternetCrackUrlW
(
lpszUrl
,
strlenW
(
lpszUrl
),
0
,
&
urlComponents
))
return
INTERNET_GetLastError
();
if
(
!
strncmpW
(
szHttp
,
urlComponents
.
lpszScheme
,
strlenW
(
szHttp
))
&&
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_SECURE
))
{
TRACE
(
"redirect from secure page to non-secure page
\n
"
);
/* FIXME: warn about from secure redirect to non-secure page */
request
->
hdr
.
dwFlags
&=
~
INTERNET_FLAG_SECURE
;
}
if
(
!
strncmpW
(
szHttps
,
urlComponents
.
lpszScheme
,
strlenW
(
szHttps
))
&&
!
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_SECURE
))
{
TRACE
(
"redirect from non-secure page to secure page
\n
"
);
/* FIXME: notify about redirect to secure page */
request
->
hdr
.
dwFlags
|=
INTERNET_FLAG_SECURE
;
}
if
(
!
strcmpiW
(
protocol
,
httpW
))
{
if
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_SECURE
)
{
TRACE
(
"redirect from secure page to non-secure page
\n
"
);
/* FIXME: warn about from secure redirect to non-secure page */
request
->
hdr
.
dwFlags
&=
~
INTERNET_FLAG_SECURE
;
}
if
(
urlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
{
if
(
lstrlenW
(
protocol
)
>
4
)
/*https*/
urlComponents
.
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
else
/*http*/
if
(
urlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
urlComponents
.
nPort
=
INTERNET_DEFAULT_HTTP_PORT
;
}
else
if
(
urlComponents
.
nPort
!=
INTERNET_DEFAULT_HTTP_PORT
)
custom_port
=
TRUE
;
}
else
if
(
!
strcmpiW
(
protocol
,
httpsW
))
{
if
(
!
(
request
->
hdr
.
dwFlags
&
INTERNET_FLAG_SECURE
))
{
TRACE
(
"redirect from non-secure page to secure page
\n
"
);
/* FIXME: notify about redirect to secure page */
request
->
hdr
.
dwFlags
|=
INTERNET_FLAG_SECURE
;
}
#if 0
/*
* This upsets redirects to binary files on sourceforge.net
* and gives an html page instead of the target file
* Examination of the HTTP request sent by native wininet.dll
* reveals that it doesn't send a referrer in that case.
* Maybe there's a flag that enables this, or maybe a referrer
* shouldn't be added in case of a redirect.
*/
if
(
urlComponents
.
nPort
==
INTERNET_INVALID_PORT_NUMBER
)
urlComponents
.
nPort
=
INTERNET_DEFAULT_HTTPS_PORT
;
else
if
(
urlComponents
.
nPort
!=
INTERNET_DEFAULT_HTTPS_PORT
)
custom_port
=
TRUE
;
}
/* consider the current host as the referrer */
if (session->lpszServerName && *session->lpszServerName)
HTTP_ProcessHeader(request, HTTP_REFERER, session->lpszServerName,
HTTP_ADDHDR_FLAG_REQ|HTTP_ADDREQ_FLAG_REPLACE|
HTTP_ADDHDR_FLAG_ADD_IF_NEW);
#endif
heap_free
(
session
->
hostName
);
if
(
urlComponents
.
nPort
!=
INTERNET_DEFAULT_HTTP_PORT
&&
urlComponents
.
nPort
!=
INTERNET_DEFAULT_HTTPS_PORT
)
{
if
(
custom_port
)
{
int
len
;
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
':'
,
'%'
,
'u'
,
0
};
len
=
lstrlenW
(
hostName
);
...
...
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