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
de12987d
Commit
de12987d
authored
Jul 14, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Jul 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Use a helper function to set connect_t's servername and port.
parent
85579ebb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
30 deletions
+61
-30
session.c
dlls/winhttp/session.c
+61
-30
No files found.
dlls/winhttp/session.c
View file @
de12987d
...
...
@@ -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
;
...
...
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