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
2f99450c
Commit
2f99450c
authored
May 31, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Make resolving hostnames thread-safe.
parent
7cdc50fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
http.c
dlls/wininet/http.c
+3
-1
utility.c
dlls/wininet/utility.c
+14
-0
No files found.
dlls/wininet/http.c
View file @
2f99450c
...
@@ -1346,6 +1346,8 @@ static BOOL HTTP_ResolveName(LPWININETHTTPREQW lpwhr)
...
@@ -1346,6 +1346,8 @@ static BOOL HTTP_ResolveName(LPWININETHTTPREQW lpwhr)
INTERNET_SendCallback
(
&
lpwhr
->
hdr
,
lpwhr
->
hdr
.
dwContext
,
INTERNET_SendCallback
(
&
lpwhr
->
hdr
,
lpwhr
->
hdr
.
dwContext
,
INTERNET_STATUS_NAME_RESOLVED
,
INTERNET_STATUS_NAME_RESOLVED
,
szaddr
,
strlen
(
szaddr
)
+
1
);
szaddr
,
strlen
(
szaddr
)
+
1
);
TRACE
(
"resolved %s to %s
\n
"
,
debugstr_w
(
lpwhs
->
lpszServerName
),
szaddr
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -3607,7 +3609,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
...
@@ -3607,7 +3609,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
if
(
!
NETCON_create
(
&
lpwhr
->
netConnection
,
lpwhs
->
socketAddress
.
sin_family
,
if
(
!
NETCON_create
(
&
lpwhr
->
netConnection
,
lpwhs
->
socketAddress
.
sin_family
,
SOCK_STREAM
,
0
))
SOCK_STREAM
,
0
))
{
{
WARN
(
"Socket creation failed
\n
"
);
WARN
(
"Socket creation failed: %u
\n
"
,
INTERNET_GetLastError
()
);
goto
lend
;
goto
lend
;
}
}
...
...
dlls/wininet/utility.c
View file @
2f99450c
...
@@ -40,6 +40,16 @@
...
@@ -40,6 +40,16 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
/* critical section to protect non-reentrant gethostbyname() */
static
CRITICAL_SECTION
cs_gethostbyname
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
cs_gethostbyname
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": cs_gethostbyname"
)
}
};
static
CRITICAL_SECTION
cs_gethostbyname
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
#define TIME_STRING_LEN 30
#define TIME_STRING_LEN 30
time_t
ConvertTimeString
(
LPCWSTR
asctime
)
time_t
ConvertTimeString
(
LPCWSTR
asctime
)
...
@@ -151,12 +161,15 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
...
@@ -151,12 +161,15 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
+
1
);
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
+
1
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
lpszServerName
,
len
,
name
,
sz
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
lpszServerName
,
len
,
name
,
sz
,
NULL
,
NULL
);
name
[
sz
]
=
0
;
name
[
sz
]
=
0
;
EnterCriticalSection
(
&
cs_gethostbyname
);
phe
=
gethostbyname
(
name
);
phe
=
gethostbyname
(
name
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
if
(
NULL
==
phe
)
if
(
NULL
==
phe
)
{
{
TRACE
(
"Failed to get hostname: (%s)
\n
"
,
debugstr_w
(
lpszServerName
)
);
TRACE
(
"Failed to get hostname: (%s)
\n
"
,
debugstr_w
(
lpszServerName
)
);
LeaveCriticalSection
(
&
cs_gethostbyname
);
return
FALSE
;
return
FALSE
;
}
}
...
@@ -165,6 +178,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
...
@@ -165,6 +178,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
psa
->
sin_family
=
phe
->
h_addrtype
;
psa
->
sin_family
=
phe
->
h_addrtype
;
psa
->
sin_port
=
htons
(
nServerPort
);
psa
->
sin_port
=
htons
(
nServerPort
);
LeaveCriticalSection
(
&
cs_gethostbyname
);
return
TRUE
;
return
TRUE
;
}
}
...
...
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