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
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
44 additions
and
355 deletions
+44
-355
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
+13
-40
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
+14
-177
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
;
...
...
@@ -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
This diff is collapsed.
Click to expand it.
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