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
5436fef8
Commit
5436fef8
authored
Feb 13, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Always use winsock sockets.
parent
5d6d2fda
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
360 deletions
+49
-360
Makefile.in
dlls/wininet/Makefile.in
+2
-2
cookie.c
dlls/wininet/cookie.c
+1
-9
dialogs.c
dlls/wininet/dialogs.c
+1
-6
ftp.c
dlls/wininet/ftp.c
+17
-44
http.c
dlls/wininet/http.c
+5
-17
internet.c
dlls/wininet/internet.c
+2
-16
internet.h
dlls/wininet/internet.h
+0
-23
netconnection.c
dlls/wininet/netconnection.c
+15
-178
urlcache.c
dlls/wininet/urlcache.c
+1
-10
utility.c
dlls/wininet/utility.c
+5
-55
No files found.
dlls/wininet/Makefile.in
View file @
5436fef8
EXTRADEFS
=
-D_WINX32_
MODULE
=
wininet.dll
IMPORTLIB
=
wininet
IMPORTS
=
mpr shlwapi shell32 user32 advapi32
IMPORTS
=
mpr shlwapi shell32 user32
ws2_32
advapi32
DELAYIMPORTS
=
secur32 crypt32 cryptui
EXTRALIBS
=
$(CORESERVICES_LIBS)
$(
SOCKET_LIBS)
$(
Z_LIBS)
EXTRALIBS
=
$(CORESERVICES_LIBS)
$(Z_LIBS)
C_SRCS
=
\
cookie.c
\
...
...
dlls/wininet/cookie.c
View file @
5436fef8
...
...
@@ -20,21 +20,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#endif
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "windef.h"
#include "winbase.h"
...
...
dlls/wininet/dialogs.c
View file @
5436fef8
...
...
@@ -18,12 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#endif
#include "ws2tcpip.h"
#include <stdarg.h>
...
...
dlls/wininet/ftp.c
View file @
5436fef8
...
...
@@ -27,36 +27,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#endif
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#endif
#include <time.h>
#include <assert.h>
...
...
@@ -1286,13 +1262,9 @@ static DWORD FTPFILE_QueryDataAvailable(object_header_t *hdr, DWORD *available,
TRACE
(
"(%p %p %x %lx)
\n
"
,
file
,
available
,
flags
,
ctx
);
#ifdef FIONREAD
retval
=
ioctlsocket
(
file
->
nDataSocket
,
FIONREAD
,
&
unread
);
if
(
!
retval
)
TRACE
(
"%d bytes of queued, but unread data
\n
"
,
unread
);
#else
FIXME
(
"FIONREAD not available
\n
"
);
#endif
*
available
=
unread
;
...
...
@@ -2394,11 +2366,11 @@ static void FTPSESSION_CloseConnection(object_header_t *hdr)
if
(
lpwfs
->
download_in_progress
!=
NULL
)
lpwfs
->
download_in_progress
->
session_deleted
=
TRUE
;
if
(
lpwfs
->
sndSocket
!=
-
1
)
closesocket
(
lpwfs
->
sndSocket
);
if
(
lpwfs
->
sndSocket
!=
-
1
)
closesocket
(
lpwfs
->
sndSocket
);
if
(
lpwfs
->
lstnSocket
!=
-
1
)
closesocket
(
lpwfs
->
lstnSocket
);
if
(
lpwfs
->
lstnSocket
!=
-
1
)
closesocket
(
lpwfs
->
lstnSocket
);
if
(
lpwfs
->
pasvSocket
!=
-
1
)
closesocket
(
lpwfs
->
pasvSocket
);
...
...
@@ -2681,18 +2653,19 @@ lend:
static
LPSTR
FTP_GetNextLine
(
INT
nSocket
,
LPDWORD
dwLen
)
{
struct
pollfd
pfd
;
struct
timeval
tv
=
{
RESPONSE_TIMEOUT
,
0
};
FD_SET
set
;
INT
nRecv
=
0
;
LPSTR
lpszBuffer
=
INTERNET_GetResponseBuffer
();
TRACE
(
"
\n
"
);
pfd
.
fd
=
nSocket
;
pfd
.
events
=
POLLIN
;
FD_ZERO
(
&
set
)
;
FD_SET
(
nSocket
,
&
set
)
;
while
(
nRecv
<
MAX_REPLY_LEN
)
{
if
(
poll
(
&
pfd
,
1
,
RESPONSE_TIMEOUT
*
1000
)
>
0
)
if
(
select
(
nSocket
+
1
,
&
set
,
NULL
,
NULL
,
&
tv
)
>
0
)
{
if
(
sock_recv
(
nSocket
,
&
lpszBuffer
[
nRecv
],
1
,
0
)
<=
0
)
{
...
...
@@ -2992,7 +2965,7 @@ static BOOL FTP_InitListenSocket(ftp_session_t *lpwfs)
TRACE
(
"
\n
"
);
init_winsock
();
lpwfs
->
lstnSocket
=
socket
(
P
F_INET
,
SOCK_STREAM
,
0
);
lpwfs
->
lstnSocket
=
socket
(
A
F_INET
,
SOCK_STREAM
,
0
);
if
(
lpwfs
->
lstnSocket
==
-
1
)
{
TRACE
(
"Unable to create listening socket
\n
"
);
...
...
@@ -3135,10 +3108,10 @@ static BOOL FTP_SendPort(ftp_session_t *lpwfs)
TRACE
(
"
\n
"
);
sprintfW
(
szIPAddress
,
szIPFormat
,
lpwfs
->
lstnSocketAddress
.
sin_addr
.
s
_addr
&
0x000000FF
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
s
_addr
&
0x0000FF00
)
>>
8
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
s
_addr
&
0x00FF0000
)
>>
16
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
s
_addr
&
0xFF000000
)
>>
24
,
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S
_addr
&
0x000000FF
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S
_addr
&
0x0000FF00
)
>>
8
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S
_addr
&
0x00FF0000
)
>>
16
,
(
lpwfs
->
lstnSocketAddress
.
sin_addr
.
S_un
.
S
_addr
&
0xFF000000
)
>>
24
,
lpwfs
->
lstnSocketAddress
.
sin_port
&
0xFF
,
(
lpwfs
->
lstnSocketAddress
.
sin_port
&
0xFF00
)
>>
8
);
...
...
@@ -3211,7 +3184,7 @@ static BOOL FTP_DoPassive(ftp_session_t *lpwfs)
f
[
i
]
=
f
[
i
]
&
0xff
;
dataSocketAddress
=
lpwfs
->
socketAddress
;
pAddr
=
(
char
*
)
&
(
dataSocketAddress
.
sin_addr
.
s
_addr
);
pAddr
=
(
char
*
)
&
(
dataSocketAddress
.
sin_addr
.
S_un
.
S
_addr
);
pPort
=
(
char
*
)
&
(
dataSocketAddress
.
sin_port
);
pAddr
[
0
]
=
f
[
0
];
pAddr
[
1
]
=
f
[
1
];
...
...
@@ -3274,7 +3247,7 @@ static BOOL FTP_SendPortOrPasv(ftp_session_t *lpwfs)
static
BOOL
FTP_GetDataSocket
(
ftp_session_t
*
lpwfs
,
LPINT
nDataSocket
)
{
struct
sockaddr_in
saddr
;
socklen_t
addrlen
=
sizeof
(
s
truct
sock
addr
);
socklen_t
addrlen
=
sizeof
(
saddr
);
TRACE
(
"
\n
"
);
if
(
lpwfs
->
hdr
.
dwFlags
&
INTERNET_FLAG_PASSIVE
)
...
...
dlls/wininet/http.c
View file @
5436fef8
...
...
@@ -28,31 +28,19 @@
*/
#include "config.h"
#include "wine/port.h"
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#ifdef HAVE_ZLIB
# define Z_SOLO
# include <zlib.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <time.h>
#include <assert.h>
#ifdef HAVE_ZLIB
# include <zlib.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "wininet.h"
...
...
dlls/wininet/internet.c
View file @
5436fef8
...
...
@@ -26,28 +26,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#endif
#include "ws2tcpip.h"
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <stdlib.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <assert.h>
#ifdef HAVE_CORESERVICES_CORESERVICES_H
...
...
@@ -3475,7 +3461,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
{
if
(
connect
(
fd
,
(
struct
sockaddr
*
)
&
saddr
,
sa_len
)
==
0
)
rc
=
TRUE
;
close
(
fd
);
close
socket
(
fd
);
}
}
else
...
...
dlls/wininet/internet.h
View file @
5436fef8
...
...
@@ -23,38 +23,15 @@
#ifndef _WINE_INTERNET_H_
#define _WINE_INTERNET_H_
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#include "wine/unicode.h"
#include "wine/list.h"
#include <time.h>
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <sys/types.h>
# include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if !defined(__MINGW32__) && !defined(_MSC_VER)
#define closesocket close
#define ioctlsocket ioctl
#endif
/* __MINGW32__ */
#include "winineti.h"
extern
HMODULE
WININET_hModule
DECLSPEC_HIDDEN
;
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
typedef
struct
{
WCHAR
*
name
;
INTERNET_PORT
port
;
...
...
dlls/wininet/netconnection.c
View file @
5436fef8
/*
* Wininet - networking layer
. Uses unix sockets.
* Wininet - networking layer
*
* Copyright 2002 TransGaming Technologies Inc.
* Copyright 2013 Jacek Caban for CodeWeavers
...
...
@@ -21,55 +21,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#define NONAMELESSUNION
#if defined(__MINGW32__) || defined (_MSC_VER)
#define USE_WINSOCK
#endif
#ifdef USE_WINSOCK
#include <ws2tcpip.h>
#endif
#include <sys/types.h>
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#include <time.h>
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#ifndef USE_WINSOCK
#include <errno.h>
#endif
#include "ws2tcpip.h"
#include <time.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -85,26 +41,8 @@
#include "wine/debug.h"
#include "internet.h"
/* To avoid conflicts with the Unix socket headers. we only need it for
* the error codes anyway. */
#define USE_WS_PREFIX
#include "winsock2.h"
#define RESPONSE_TIMEOUT 30
/* FROM internet.c */
#ifdef MSG_DONTWAIT
#define WINE_MSG_DONTWAIT MSG_DONTWAIT
#else
#define WINE_MSG_DONTWAIT 0
#endif
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
/* FIXME!!!!!!
* This should use winsock - To use winsock the functions will have to change a bit
* as they are designed for unix sockets.
*/
static
DWORD
netconn_verify_cert
(
netconn_t
*
conn
,
PCCERT_CONTEXT
cert
,
HCERTSTORE
store
)
{
BOOL
ret
;
...
...
@@ -321,7 +259,6 @@ static BOOL ensure_cred_handle(void)
return
TRUE
;
}
#ifdef USE_WINSOCK
static
BOOL
winsock_loaded
=
FALSE
;
static
BOOL
WINAPI
winsock_startup
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
...
...
@@ -336,22 +273,17 @@ static BOOL WINAPI winsock_startup(INIT_ONCE *once, void *param, void **context)
ERR
(
"WSAStartup failed: %u
\n
"
,
res
);
return
TRUE
;
}
#endif
void
init_winsock
(
void
)
{
#ifdef USE_WINSOCK
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
InitOnceExecuteOnce
(
&
init_once
,
winsock_startup
,
NULL
,
NULL
);
#endif
}
static
void
set_socket_blocking
(
int
socket
,
blocking_mode_t
mode
)
{
#ifdef USE_WINSOCK
ULONG
arg
=
mode
==
BLOCKING_DISALLOW
;
ioctlsocket
(
socket
,
FIONBIO
,
&
arg
);
#endif
}
static
DWORD
create_netconn_socket
(
server_t
*
server
,
netconn_t
*
netconn
,
DWORD
timeout
)
...
...
@@ -371,25 +303,21 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t
{
res
=
sock_get_error
();
if
(
res
==
WSAEINPROGRESS
||
res
==
WSAEWOULDBLOCK
)
{
struct
pollfd
pfd
;
FD_SET
set
;
int
res
;
socklen_t
len
=
sizeof
(
res
);
TIMEVAL
timeout_timeval
=
{
0
,
timeout
*
1000
};
pfd
.
fd
=
netconn
->
socket
;
pfd
.
events
=
POLLOUT
;
res
=
poll
(
&
pfd
,
1
,
timeout
);
if
(
!
res
)
{
FD_ZERO
(
&
set
);
FD_SET
(
netconn
->
socket
,
&
set
);
res
=
select
(
netconn
->
socket
+
1
,
NULL
,
&
set
,
NULL
,
&
timeout_timeval
);
if
(
!
res
||
res
==
SOCKET_ERROR
)
{
closesocket
(
netconn
->
socket
);
netconn
->
socket
=
-
1
;
return
ERROR_INTERNET_CANNOT_CONNECT
;
}
else
if
(
res
>
0
)
{
int
err
;
socklen_t
len
=
sizeof
(
err
);
if
(
!
getsockopt
(
netconn
->
socket
,
SOL_SOCKET
,
SO_ERROR
,
(
void
*
)
&
err
,
&
len
)
&&
!
err
)
result
=
0
;
}
if
(
!
getsockopt
(
netconn
->
socket
,
SOL_SOCKET
,
SO_ERROR
,
(
void
*
)
&
res
,
&
len
)
&&
!
res
)
result
=
0
;
}
}
if
(
result
==
-
1
)
...
...
@@ -404,12 +332,10 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t
if
(
result
==
-
1
)
return
ERROR_INTERNET_CANNOT_CONNECT
;
#ifdef TCP_NODELAY
flag
=
1
;
result
=
setsockopt
(
netconn
->
socket
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
void
*
)
&
flag
,
sizeof
(
flag
));
if
(
result
<
0
)
WARN
(
"setsockopt(TCP_NODELAY) failed
\n
"
);
#endif
return
ERROR_SUCCESS
;
}
...
...
@@ -480,81 +406,13 @@ void NETCON_unload(void)
if
(
have_compat_cred_handle
)
FreeCredentialsHandle
(
&
compat_cred_handle
);
DeleteCriticalSection
(
&
init_sechandle_cs
);
#ifdef USE_WINSOCK
WSACleanup
();
#endif
}
/* translate a unix error code into a winsock one */
int
sock_get_error
(
void
)
{
#ifdef USE_WINSOCK
return
WSAGetLastError
();
#else
switch
(
errno
)
{
case
EINTR
:
return
WSAEINTR
;
case
EBADF
:
return
WSAEBADF
;
case
EPERM
:
case
EACCES
:
return
WSAEACCES
;
case
EFAULT
:
return
WSAEFAULT
;
case
EINVAL
:
return
WSAEINVAL
;
case
EMFILE
:
return
WSAEMFILE
;
#if EAGAIN != EWOULDBLOCK
case
EAGAIN
:
#endif
case
EWOULDBLOCK
:
return
WSAEWOULDBLOCK
;
case
EINPROGRESS
:
return
WSAEINPROGRESS
;
case
EALREADY
:
return
WSAEALREADY
;
case
ENOTSOCK
:
return
WSAENOTSOCK
;
case
EDESTADDRREQ
:
return
WSAEDESTADDRREQ
;
case
EMSGSIZE
:
return
WSAEMSGSIZE
;
case
EPROTOTYPE
:
return
WSAEPROTOTYPE
;
case
ENOPROTOOPT
:
return
WSAENOPROTOOPT
;
case
EPROTONOSUPPORT
:
return
WSAEPROTONOSUPPORT
;
case
ESOCKTNOSUPPORT
:
return
WSAESOCKTNOSUPPORT
;
case
EOPNOTSUPP
:
return
WSAEOPNOTSUPP
;
case
EPFNOSUPPORT
:
return
WSAEPFNOSUPPORT
;
case
EAFNOSUPPORT
:
return
WSAEAFNOSUPPORT
;
case
EADDRINUSE
:
return
WSAEADDRINUSE
;
case
EADDRNOTAVAIL
:
return
WSAEADDRNOTAVAIL
;
case
ENETDOWN
:
return
WSAENETDOWN
;
case
ENETUNREACH
:
return
WSAENETUNREACH
;
case
ENETRESET
:
return
WSAENETRESET
;
case
ECONNABORTED
:
return
WSAECONNABORTED
;
case
EPIPE
:
case
ECONNRESET
:
return
WSAECONNRESET
;
case
ENOBUFS
:
return
WSAENOBUFS
;
case
EISCONN
:
return
WSAEISCONN
;
case
ENOTCONN
:
return
WSAENOTCONN
;
case
ESHUTDOWN
:
return
WSAESHUTDOWN
;
case
ETOOMANYREFS
:
return
WSAETOOMANYREFS
;
case
ETIMEDOUT
:
return
WSAETIMEDOUT
;
case
ECONNREFUSED
:
return
WSAECONNREFUSED
;
case
ELOOP
:
return
WSAELOOP
;
case
ENAMETOOLONG
:
return
WSAENAMETOOLONG
;
case
EHOSTDOWN
:
return
WSAEHOSTDOWN
;
case
EHOSTUNREACH
:
return
WSAEHOSTUNREACH
;
case
ENOTEMPTY
:
return
WSAENOTEMPTY
;
#ifdef EPROCLIM
case
EPROCLIM
:
return
WSAEPROCLIM
;
#endif
#ifdef EUSERS
case
EUSERS
:
return
WSAEUSERS
;
#endif
#ifdef EDQUOT
case
EDQUOT
:
return
WSAEDQUOT
;
#endif
#ifdef ESTALE
case
ESTALE
:
return
WSAESTALE
;
#endif
#ifdef EREMOTE
case
EREMOTE
:
return
WSAEREMOTE
;
#endif
default:
perror
(
"sock_get_error"
);
return
WSAEFAULT
;
}
#endif
}
int
sock_send
(
int
fd
,
const
void
*
msg
,
size_t
len
,
int
flags
)
...
...
@@ -861,7 +719,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking
tmp_mode
=
buf_len
?
BLOCKING_DISALLOW
:
mode
;
set_socket_blocking
(
conn
->
socket
,
tmp_mode
);
size
=
sock_recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
tmp_mode
==
BLOCKING_ALLOW
?
0
:
WINE_MSG_DONTWAIT
);
size
=
sock_recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
0
);
if
(
size
<
0
)
{
if
(
!
buf_len
)
{
if
(
sock_get_error
()
==
WSAEWOULDBLOCK
)
{
...
...
@@ -902,7 +760,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking
assert
(
buf_len
<
ssl_buf_size
);
set_socket_blocking
(
conn
->
socket
,
mode
);
size
=
sock_recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
mode
==
BLOCKING_ALLOW
?
0
:
WINE_MSG_DONTWAIT
);
size
=
sock_recv
(
conn
->
socket
,
conn
->
ssl_buf
+
buf_len
,
ssl_buf_size
-
buf_len
,
0
);
if
(
size
<
1
)
{
if
(
size
<
0
&&
sock_get_error
()
==
WSAEWOULDBLOCK
)
{
TRACE
(
"would block
\n
"
);
...
...
@@ -974,16 +832,8 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t
{
int
flags
=
0
;
switch
(
mode
)
{
case
BLOCKING_ALLOW
:
break
;
case
BLOCKING_DISALLOW
:
flags
=
WINE_MSG_DONTWAIT
;
break
;
case
BLOCKING_WAITALL
:
if
(
mode
==
BLOCKING_WAITALL
)
flags
=
MSG_WAITALL
;
break
;
}
set_socket_blocking
(
connection
->
socket
,
mode
);
*
recvd
=
sock_recv
(
connection
->
socket
,
buf
,
len
,
flags
);
...
...
@@ -1051,7 +901,6 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
if
(
!
connection
->
secure
)
{
#ifdef FIONREAD
ULONG
unread
;
int
retval
=
ioctlsocket
(
connection
->
socket
,
FIONREAD
,
&
unread
);
if
(
!
retval
)
...
...
@@ -1059,7 +908,6 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
TRACE
(
"%d bytes of queued, but unread data
\n
"
,
unread
);
*
available
+=
unread
;
}
#endif
}
else
{
...
...
@@ -1070,13 +918,6 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
BOOL
NETCON_is_alive
(
netconn_t
*
netconn
)
{
#ifdef MSG_DONTWAIT
ssize_t
len
;
BYTE
b
;
len
=
sock_recv
(
netconn
->
socket
,
&
b
,
1
,
MSG_PEEK
|
MSG_DONTWAIT
);
return
len
==
1
||
(
len
==
-
1
&&
sock_get_error
()
==
WSAEWOULDBLOCK
);
#elif defined(USE_WINSOCK)
int
len
;
char
b
;
...
...
@@ -1085,10 +926,6 @@ BOOL NETCON_is_alive(netconn_t *netconn)
set_socket_blocking
(
netconn
->
socket
,
BLOCKING_ALLOW
);
return
len
==
1
||
(
len
==
-
1
&&
sock_get_error
()
==
WSAEWOULDBLOCK
);
#else
FIXME
(
"not supported on this platform
\n
"
);
return
TRUE
;
#endif
}
LPCVOID
NETCON_GetCert
(
netconn_t
*
connection
)
...
...
dlls/wininet/urlcache.c
View file @
5436fef8
...
...
@@ -22,24 +22,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#endif
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#include <time.h>
#include "windef.h"
...
...
dlls/wininet/utility.c
View file @
5436fef8
...
...
@@ -22,12 +22,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#if defined(__MINGW32__) || defined (_MSC_VER)
#include <ws2tcpip.h>
#endif
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdlib.h>
...
...
@@ -44,20 +39,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wininet
);
#ifndef HAVE_GETADDRINFO
/* 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
};
#endif
#define TIME_STRING_LEN 30
time_t
ConvertTimeString
(
LPCWSTR
asctime
)
...
...
@@ -147,16 +128,11 @@ time_t ConvertTimeString(LPCWSTR asctime)
BOOL
GetAddress
(
LPCWSTR
lpszServerName
,
INTERNET_PORT
nServerPort
,
struct
sockaddr
*
psa
,
socklen_t
*
sa_len
)
{
struct
addrinfo
*
res
,
hints
;
WCHAR
*
found
;
char
*
name
;
int
len
,
sz
;
#ifdef HAVE_GETADDRINFO
struct
addrinfo
*
res
,
hints
;
int
ret
;
#else
struct
hostent
*
phe
;
struct
sockaddr_in
*
sin
=
(
struct
sockaddr_in
*
)
psa
;
#endif
TRACE
(
"%s
\n
"
,
debugstr_w
(
lpszServerName
));
...
...
@@ -176,8 +152,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
lpszServerName
,
len
,
name
,
sz
,
NULL
,
NULL
);
name
[
sz
]
=
0
;
#ifdef HAVE_GETADDRINFO
memset
(
&
hints
,
0
,
sizeof
(
struct
addrinfo
)
);
memset
(
&
hints
,
0
,
sizeof
(
hints
)
);
/* Prefer IPv4 to IPv6 addresses, since some servers do not listen on
* their IPv6 addresses even though they have IPv6 addresses in the DNS.
*/
...
...
@@ -186,14 +161,14 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
ret
=
getaddrinfo
(
name
,
NULL
,
&
hints
,
&
res
);
if
(
ret
!=
0
)
{
TRACE
(
"failed to get IPv4 address of %s
(%s), retrying with IPv6
\n
"
,
debugstr_w
(
lpszServerName
),
gai_strerror
(
ret
));
TRACE
(
"failed to get IPv4 address of %s
, retrying with IPv6
\n
"
,
debugstr_w
(
lpszServerName
));
hints
.
ai_family
=
AF_INET6
;
ret
=
getaddrinfo
(
name
,
NULL
,
&
hints
,
&
res
);
}
heap_free
(
name
);
if
(
ret
!=
0
)
{
TRACE
(
"failed to get address of %s
(%s)
\n
"
,
debugstr_w
(
lpszServerName
),
gai_strerror
(
ret
));
TRACE
(
"failed to get address of %s
\n
"
,
debugstr_w
(
lpszServerName
));
return
FALSE
;
}
if
(
*
sa_len
<
res
->
ai_addrlen
)
...
...
@@ -216,31 +191,6 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
}
freeaddrinfo
(
res
);
#else
EnterCriticalSection
(
&
cs_gethostbyname
);
phe
=
gethostbyname
(
name
);
heap_free
(
name
);
if
(
NULL
==
phe
)
{
TRACE
(
"failed to get address of %s (%d)
\n
"
,
debugstr_w
(
lpszServerName
),
h_errno
);
LeaveCriticalSection
(
&
cs_gethostbyname
);
return
FALSE
;
}
if
(
*
sa_len
<
sizeof
(
struct
sockaddr_in
))
{
WARN
(
"address too small
\n
"
);
LeaveCriticalSection
(
&
cs_gethostbyname
);
return
FALSE
;
}
*
sa_len
=
sizeof
(
struct
sockaddr_in
);
memset
(
sin
,
0
,
sizeof
(
struct
sockaddr_in
));
memcpy
((
char
*
)
&
sin
->
sin_addr
,
phe
->
h_addr
,
phe
->
h_length
);
sin
->
sin_family
=
phe
->
h_addrtype
;
sin
->
sin_port
=
htons
(
nServerPort
);
LeaveCriticalSection
(
&
cs_gethostbyname
);
#endif
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