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
3cf2838a
Commit
3cf2838a
authored
Nov 19, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Store more useful strings in server_t.
parent
e1d26a24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
30 deletions
+37
-30
http.c
dlls/wininet/http.c
+33
-30
internet.h
dlls/wininet/internet.h
+4
-0
No files found.
dlls/wininet/http.c
View file @
3cf2838a
...
...
@@ -248,9 +248,37 @@ void server_release(server_t *server)
if
(
server
->
cert_chain
)
CertFreeCertificateChain
(
server
->
cert_chain
);
heap_free
(
server
->
name
);
heap_free
(
server
->
scheme_host_port
);
heap_free
(
server
);
}
static
BOOL
process_host_port
(
server_t
*
server
)
{
BOOL
default_port
;
size_t
name_len
;
WCHAR
*
buf
;
static
const
WCHAR
httpW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
const
WCHAR
httpsW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
':'
,
'/'
,
'/'
,
'%'
,
's'
,
':'
,
'%'
,
'u'
,
0
};
name_len
=
strlenW
(
server
->
name
);
buf
=
heap_alloc
((
name_len
+
10
/* strlen("://:<port>") */
)
*
sizeof
(
WCHAR
)
+
sizeof
(
httpsW
));
if
(
!
buf
)
return
FALSE
;
sprintfW
(
buf
,
formatW
,
server
->
is_https
?
httpsW
:
httpW
,
server
->
name
,
server
->
port
);
server
->
scheme_host_port
=
buf
;
server
->
host_port
=
server
->
scheme_host_port
+
7
/* strlen("http://") */
;
if
(
server
->
is_https
)
server
->
host_port
++
;
default_port
=
server
->
port
==
(
server
->
is_https
?
INTERNET_DEFAULT_HTTPS_PORT
:
INTERNET_DEFAULT_HTTP_PORT
);
server
->
canon_host_port
=
default_port
?
server
->
name
:
server
->
host_port
;
return
TRUE
;
}
server_t
*
get_server
(
const
WCHAR
*
name
,
INTERNET_PORT
port
,
BOOL
is_https
,
BOOL
do_create
)
{
server_t
*
iter
,
*
server
=
NULL
;
...
...
@@ -276,7 +304,7 @@ server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL
server
->
is_https
=
is_https
;
list_init
(
&
server
->
conn_pool
);
server
->
name
=
heap_strdupW
(
name
);
if
(
server
->
name
)
{
if
(
server
->
name
&&
process_host_port
(
server
)
)
{
list_add_head
(
&
connection_pool
,
&
server
->
entry
);
}
else
{
heap_free
(
server
);
...
...
@@ -3241,27 +3269,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
request
->
verb
=
heap_strdupW
(
lpszVerb
&&
*
lpszVerb
?
lpszVerb
:
szGET
);
request
->
version
=
heap_strdupW
(
lpszVersion
?
lpszVersion
:
g_szHttp1_1
);
if
(
session
->
hostPort
!=
INTERNET_INVALID_PORT_NUMBER
&&
session
->
hostPort
!=
INTERNET_DEFAULT_HTTP_PORT
&&
session
->
hostPort
!=
INTERNET_DEFAULT_HTTPS_PORT
)
{
WCHAR
*
host_name
;
static
const
WCHAR
host_formatW
[]
=
{
'%'
,
's'
,
':'
,
'%'
,
'u'
,
0
};
host_name
=
heap_alloc
((
strlenW
(
session
->
hostName
)
+
7
/* length of ":65535" + 1 */
)
*
sizeof
(
WCHAR
));
if
(
!
host_name
)
{
res
=
ERROR_OUTOFMEMORY
;
goto
lend
;
}
sprintfW
(
host_name
,
host_formatW
,
session
->
hostName
,
session
->
hostPort
);
HTTP_ProcessHeader
(
request
,
hostW
,
host_name
,
HTTP_ADDREQ_FLAG_ADD
|
HTTP_ADDHDR_FLAG_REQ
);
heap_free
(
host_name
);
}
else
HTTP_ProcessHeader
(
request
,
hostW
,
session
->
hostName
,
HTTP_ADDREQ_FLAG_ADD
|
HTTP_ADDHDR_FLAG_REQ
);
HTTP_ProcessHeader
(
request
,
hostW
,
request
->
server
->
canon_host_port
,
HTTP_ADDREQ_FLAG_ADD
|
HTTP_ADDHDR_FLAG_REQ
);
if
(
session
->
hostPort
==
INTERNET_INVALID_PORT_NUMBER
)
session
->
hostPort
=
(
dwFlags
&
INTERNET_FLAG_SECURE
?
...
...
@@ -3275,7 +3283,6 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
INTERNET_STATUS_HANDLE_CREATED
,
&
request
->
hdr
.
hInternet
,
sizeof
(
HINTERNET
));
lend:
TRACE
(
"<-- %u (%p)
\n
"
,
res
,
request
);
if
(
res
!=
ERROR_SUCCESS
)
{
...
...
@@ -4080,22 +4087,18 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len )
static
DWORD
HTTP_SecureProxyConnect
(
http_request_t
*
request
)
{
server_t
*
server
=
request
->
server
;
LPWSTR
lpszPath
;
LPWSTR
requestString
;
INT
len
;
INT
cnt
;
INT
responseLen
;
char
*
ascii_req
;
DWORD
res
;
static
const
WCHAR
szConnect
[]
=
{
'C'
,
'O'
,
'N'
,
'N'
,
'E'
,
'C'
,
'T'
,
0
};
static
const
WCHAR
szFormat
[]
=
{
'%'
,
's'
,
':'
,
'%'
,
'u
'
,
0
};
static
const
WCHAR
connectW
[]
=
{
'C'
,
'O'
,
'N'
,
'N'
,
'E'
,
'C'
,
'T
'
,
0
};
TRACE
(
"
\n
"
);
lpszPath
=
heap_alloc
((
lstrlenW
(
server
->
name
)
+
13
)
*
sizeof
(
WCHAR
));
sprintfW
(
lpszPath
,
szFormat
,
server
->
name
,
server
->
port
);
requestString
=
HTTP_BuildHeaderRequestString
(
request
,
szConnect
,
lpszPath
,
g_szHttp1_1
);
heap_free
(
lpszPath
);
requestString
=
HTTP_BuildHeaderRequestString
(
request
,
connectW
,
server
->
host_port
,
g_szHttp1_1
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
requestString
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
...
...
dlls/wininet/internet.h
View file @
3cf2838a
...
...
@@ -63,6 +63,10 @@ typedef struct {
socklen_t
addr_len
;
char
addr_str
[
INET6_ADDRSTRLEN
];
WCHAR
*
scheme_host_port
;
const
WCHAR
*
host_port
;
const
WCHAR
*
canon_host_port
;
LONG
ref
;
DWORD
security_flags
;
...
...
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