Made independent from winsock.
Include the needed headers directly in internet.h.
This commit is contained in:
parent
06a49f67fe
commit
a0f98f13d9
@ -12,9 +12,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifdef HAVE_NETDB_H
|
|
||||||
# include <netdb.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -27,9 +24,6 @@
|
|||||||
#ifdef HAVE_NETINET_IN_SYSTM_H
|
#ifdef HAVE_NETINET_IN_SYSTM_H
|
||||||
# include <netinet/in_systm.h>
|
# include <netinet/in_systm.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
# include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IP_H
|
#ifdef HAVE_NETINET_IP_H
|
||||||
# include <netinet/ip.h>
|
# include <netinet/ip.h>
|
||||||
#endif
|
#endif
|
||||||
@ -39,7 +33,6 @@
|
|||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "wininet.h"
|
#include "wininet.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "winsock.h"
|
|
||||||
|
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "internet.h"
|
#include "internet.h"
|
||||||
@ -236,7 +229,7 @@ BOOL WINAPI FTP_FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lend:
|
lend:
|
||||||
if (lpwfs->lstnSocket != INVALID_SOCKET)
|
if (lpwfs->lstnSocket != -1)
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
|
|
||||||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
|
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
|
||||||
@ -564,7 +557,7 @@ INTERNETAPI HINTERNET WINAPI FTP_FtpFindFirstFileA(HINTERNET hConnect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lend:
|
lend:
|
||||||
if (lpwfs->lstnSocket != INVALID_SOCKET)
|
if (lpwfs->lstnSocket != -1)
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
|
|
||||||
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
|
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC && hIC->lpfnStatusCB)
|
||||||
@ -811,7 +804,7 @@ HINTERNET FTP_FtpOpenFileA(HINTERNET hFtpSession,
|
|||||||
hFile->nDataSocket = nDataSocket;
|
hFile->nDataSocket = nDataSocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpwfs->lstnSocket != INVALID_SOCKET)
|
if (lpwfs->lstnSocket != -1)
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
|
|
||||||
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
|
hIC = (LPWININETAPPINFOA) lpwfs->hdr.lpwhparent;
|
||||||
@ -948,7 +941,7 @@ BOOL WINAPI FTP_FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR l
|
|||||||
}
|
}
|
||||||
|
|
||||||
lend:
|
lend:
|
||||||
if (lpwfs->lstnSocket != INVALID_SOCKET)
|
if (lpwfs->lstnSocket != -1)
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
|
|
||||||
if (hFile)
|
if (hFile)
|
||||||
@ -1276,7 +1269,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||||||
{
|
{
|
||||||
struct sockaddr_in socketAddr;
|
struct sockaddr_in socketAddr;
|
||||||
struct hostent *phe = NULL;
|
struct hostent *phe = NULL;
|
||||||
INT nsocket = INVALID_SOCKET, sock_namelen;
|
INT nsocket = -1, sock_namelen;
|
||||||
LPWININETAPPINFOA hIC = NULL;
|
LPWININETAPPINFOA hIC = NULL;
|
||||||
BOOL bSuccess = FALSE;
|
BOOL bSuccess = FALSE;
|
||||||
LPWININETFTPSESSIONA lpwfs = NULL;
|
LPWININETFTPSESSIONA lpwfs = NULL;
|
||||||
@ -1313,7 +1306,8 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||||||
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_NAME_RESOLVED,
|
hIC->lpfnStatusCB(hInternet, dwContext, INTERNET_STATUS_NAME_RESOLVED,
|
||||||
(LPSTR) lpszServerName, strlen(lpszServerName));
|
(LPSTR) lpszServerName, strlen(lpszServerName));
|
||||||
|
|
||||||
if (INVALID_SOCKET == (nsocket = socket(AF_INET,SOCK_STREAM,0)))
|
nsocket = socket(AF_INET,SOCK_STREAM,0);
|
||||||
|
if (nsocket == -1)
|
||||||
{
|
{
|
||||||
INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT);
|
INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT);
|
||||||
goto lerror;
|
goto lerror;
|
||||||
@ -1380,7 +1374,7 @@ HINTERNET FTP_Connect(HINTERNET hInternet, LPCSTR lpszServerName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lerror:
|
lerror:
|
||||||
if (!bSuccess && INVALID_SOCKET != nsocket)
|
if (!bSuccess && nsocket == -1)
|
||||||
close(nsocket);
|
close(nsocket);
|
||||||
|
|
||||||
if (!bSuccess && lpwfs)
|
if (!bSuccess && lpwfs)
|
||||||
@ -1483,7 +1477,7 @@ BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
|
|||||||
bParamHasLen ? lpszParam : "", szCRLF);
|
bParamHasLen ? lpszParam : "", szCRLF);
|
||||||
|
|
||||||
TRACE("Sending (%s) len(%ld)\n", buf, len);
|
TRACE("Sending (%s) len(%ld)\n", buf, len);
|
||||||
while((nBytesSent < len) && (nRC != SOCKET_ERROR))
|
while((nBytesSent < len) && (nRC != -1))
|
||||||
{
|
{
|
||||||
nRC = send(nSocket, buf+nBytesSent, len - nBytesSent, 0);
|
nRC = send(nSocket, buf+nBytesSent, len - nBytesSent, 0);
|
||||||
nBytesSent += nRC;
|
nBytesSent += nRC;
|
||||||
@ -1496,7 +1490,7 @@ BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
|
|||||||
&nBytesSent, sizeof(DWORD));
|
&nBytesSent, sizeof(DWORD));
|
||||||
|
|
||||||
TRACE("Sent %ld bytes\n", nBytesSent);
|
TRACE("Sent %ld bytes\n", nBytesSent);
|
||||||
return (nRC != SOCKET_ERROR);
|
return (nRC != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1679,10 +1673,10 @@ BOOL FTP_SendStore(LPWININETFTPSESSIONA lpwfs, LPCSTR lpszRemoteFile, DWORD dwTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
lend:
|
lend:
|
||||||
if (!bSuccess && INVALID_SOCKET != lpwfs->lstnSocket)
|
if (!bSuccess && lpwfs->lstnSocket != -1)
|
||||||
{
|
{
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
lpwfs->lstnSocket = INVALID_SOCKET;
|
lpwfs->lstnSocket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
@ -1707,7 +1701,7 @@ BOOL FTP_InitListenSocket(LPWININETFTPSESSIONA lpwfs)
|
|||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
lpwfs->lstnSocket = socket(PF_INET, SOCK_STREAM, 0);
|
lpwfs->lstnSocket = socket(PF_INET, SOCK_STREAM, 0);
|
||||||
if (INVALID_SOCKET == lpwfs->lstnSocket)
|
if (lpwfs->lstnSocket == -1)
|
||||||
{
|
{
|
||||||
TRACE("Unable to create listening socket\n");
|
TRACE("Unable to create listening socket\n");
|
||||||
goto lend;
|
goto lend;
|
||||||
@ -1719,26 +1713,26 @@ BOOL FTP_InitListenSocket(LPWININETFTPSESSIONA lpwfs)
|
|||||||
/* and get the system to assign us a port */
|
/* and get the system to assign us a port */
|
||||||
lpwfs->lstnSocketAddress.sin_port = htons((u_short) 0);
|
lpwfs->lstnSocketAddress.sin_port = htons((u_short) 0);
|
||||||
|
|
||||||
if (SOCKET_ERROR == bind(lpwfs->lstnSocket,(struct sockaddr *) &lpwfs->lstnSocketAddress, sizeof(struct sockaddr_in)))
|
if (bind(lpwfs->lstnSocket,(struct sockaddr *) &lpwfs->lstnSocketAddress, sizeof(struct sockaddr_in)) == -1)
|
||||||
{
|
{
|
||||||
TRACE("Unable to bind socket\n");
|
TRACE("Unable to bind socket\n");
|
||||||
goto lend;
|
goto lend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SOCKET_ERROR == listen(lpwfs->lstnSocket, MAX_BACKLOG))
|
if (listen(lpwfs->lstnSocket, MAX_BACKLOG) == -1)
|
||||||
{
|
{
|
||||||
TRACE("listen failed\n");
|
TRACE("listen failed\n");
|
||||||
goto lend;
|
goto lend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SOCKET_ERROR != getsockname(lpwfs->lstnSocket, (struct sockaddr *) &lpwfs->lstnSocketAddress, &namelen))
|
if (getsockname(lpwfs->lstnSocket, (struct sockaddr *) &lpwfs->lstnSocketAddress, &namelen) != -1)
|
||||||
bSuccess = TRUE;
|
bSuccess = TRUE;
|
||||||
|
|
||||||
lend:
|
lend:
|
||||||
if (!bSuccess && INVALID_SOCKET == lpwfs->lstnSocket)
|
if (!bSuccess && lpwfs->lstnSocket == -1)
|
||||||
{
|
{
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
lpwfs->lstnSocket = INVALID_SOCKET;
|
lpwfs->lstnSocket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
@ -1860,7 +1854,7 @@ BOOL FTP_DoPassive(LPWININETFTPSESSIONA lpwfs)
|
|||||||
int f[6];
|
int f[6];
|
||||||
int i;
|
int i;
|
||||||
char *pAddr, *pPort;
|
char *pAddr, *pPort;
|
||||||
INT nsocket = INVALID_SOCKET;
|
INT nsocket = -1;
|
||||||
struct sockaddr_in dataSocketAddress;
|
struct sockaddr_in dataSocketAddress;
|
||||||
|
|
||||||
p = lpszResponseBuffer+4; /* skip status code */
|
p = lpszResponseBuffer+4; /* skip status code */
|
||||||
@ -1898,7 +1892,8 @@ BOOL FTP_DoPassive(LPWININETFTPSESSIONA lpwfs)
|
|||||||
pPort[0] = f[4];
|
pPort[0] = f[4];
|
||||||
pPort[1] = f[5];
|
pPort[1] = f[5];
|
||||||
|
|
||||||
if (INVALID_SOCKET == (nsocket = socket(AF_INET,SOCK_STREAM,0)))
|
nsocket = socket(AF_INET,SOCK_STREAM,0);
|
||||||
|
if (nsocket == -1)
|
||||||
goto lend;
|
goto lend;
|
||||||
|
|
||||||
if (connect(nsocket, (struct sockaddr *)&dataSocketAddress, sizeof(dataSocketAddress)))
|
if (connect(nsocket, (struct sockaddr *)&dataSocketAddress, sizeof(dataSocketAddress)))
|
||||||
@ -1961,9 +1956,9 @@ BOOL FTP_GetDataSocket(LPWININETFTPSESSIONA lpwfs, LPINT nDataSocket)
|
|||||||
{
|
{
|
||||||
*nDataSocket = accept(lpwfs->lstnSocket, (struct sockaddr *) &saddr, &addrlen);
|
*nDataSocket = accept(lpwfs->lstnSocket, (struct sockaddr *) &saddr, &addrlen);
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
lpwfs->lstnSocket = INVALID_SOCKET;
|
lpwfs->lstnSocket = -1;
|
||||||
}
|
}
|
||||||
return *nDataSocket != INVALID_SOCKET;
|
return *nDataSocket != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2017,7 +2012,7 @@ BOOL FTP_SendData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, HANDLE hFile)
|
|||||||
DATA_PACKET_SIZE : nBytesToSend;
|
DATA_PACKET_SIZE : nBytesToSend;
|
||||||
nRC = send(nDataSocket, lpszBuffer, nLen, 0);
|
nRC = send(nDataSocket, lpszBuffer, nLen, 0);
|
||||||
|
|
||||||
if (nRC != SOCKET_ERROR)
|
if (nRC != -1)
|
||||||
{
|
{
|
||||||
nBytesSent += nRC;
|
nBytesSent += nRC;
|
||||||
nTotalSent += nRC;
|
nTotalSent += nRC;
|
||||||
@ -2038,7 +2033,7 @@ BOOL FTP_SendData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, HANDLE hFile)
|
|||||||
nTotalSent, fi.nFileSizeLow, nTotalSent*100/fi.nFileSizeLow, nSeconds,
|
nTotalSent, fi.nFileSizeLow, nTotalSent*100/fi.nFileSizeLow, nSeconds,
|
||||||
(fi.nFileSizeLow - nTotalSent) * nSeconds / nTotalSent);
|
(fi.nFileSizeLow - nTotalSent) * nSeconds / nTotalSent);
|
||||||
}
|
}
|
||||||
} while (nRC != SOCKET_ERROR);
|
} while (nRC != -1);
|
||||||
|
|
||||||
TRACE("file transfer complete!\n");
|
TRACE("file transfer complete!\n");
|
||||||
|
|
||||||
@ -2104,10 +2099,10 @@ DWORD FTP_SendRetrieve(LPWININETFTPSESSIONA lpwfs, LPCSTR lpszRemoteFile, DWORD
|
|||||||
}
|
}
|
||||||
|
|
||||||
lend:
|
lend:
|
||||||
if (0 == nResult && INVALID_SOCKET != lpwfs->lstnSocket)
|
if (0 == nResult && lpwfs->lstnSocket != -1)
|
||||||
{
|
{
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
lpwfs->lstnSocket = INVALID_SOCKET;
|
lpwfs->lstnSocket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nResult;
|
return nResult;
|
||||||
@ -2143,10 +2138,10 @@ BOOL FTP_RetrieveFileData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, DWORD nBy
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nBytesReceived < nBytes && nRC != SOCKET_ERROR)
|
while (nBytesReceived < nBytes && nRC != -1)
|
||||||
{
|
{
|
||||||
nRC = recv(nDataSocket, lpszBuffer, DATA_PACKET_SIZE, 0);
|
nRC = recv(nDataSocket, lpszBuffer, DATA_PACKET_SIZE, 0);
|
||||||
if (nRC != SOCKET_ERROR)
|
if (nRC != -1)
|
||||||
{
|
{
|
||||||
/* other side closed socket. */
|
/* other side closed socket. */
|
||||||
if (nRC == 0)
|
if (nRC == 0)
|
||||||
@ -2164,7 +2159,7 @@ BOOL FTP_RetrieveFileData(LPWININETFTPSESSIONA lpwfs, INT nDataSocket, DWORD nBy
|
|||||||
HeapFree(GetProcessHeap(), 0, lpszBuffer);
|
HeapFree(GetProcessHeap(), 0, lpszBuffer);
|
||||||
|
|
||||||
recv_end:
|
recv_end:
|
||||||
return (nRC != SOCKET_ERROR);
|
return (nRC != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2180,10 +2175,10 @@ recv_end:
|
|||||||
*/
|
*/
|
||||||
BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs)
|
BOOL FTP_CloseSessionHandle(LPWININETFTPSESSIONA lpwfs)
|
||||||
{
|
{
|
||||||
if (INVALID_SOCKET != lpwfs->sndSocket)
|
if (lpwfs->sndSocket != -1)
|
||||||
close(lpwfs->sndSocket);
|
close(lpwfs->sndSocket);
|
||||||
|
|
||||||
if (INVALID_SOCKET != lpwfs->lstnSocket)
|
if (lpwfs->lstnSocket != -1)
|
||||||
close(lpwfs->lstnSocket);
|
close(lpwfs->lstnSocket);
|
||||||
|
|
||||||
if (lpwfs->lpszPassword)
|
if (lpwfs->lpszPassword)
|
||||||
|
@ -14,16 +14,12 @@
|
|||||||
#include "wininet.h"
|
#include "wininet.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "winsock.h"
|
|
||||||
#include "shlwapi.h"
|
#include "shlwapi.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NETDB_H
|
|
||||||
# include <netdb.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -223,7 +219,7 @@ INTERNETAPI HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
|
|||||||
lpwhr->hdr.lpwhparent = hHttpSession;
|
lpwhr->hdr.lpwhparent = hHttpSession;
|
||||||
lpwhr->hdr.dwFlags = dwFlags;
|
lpwhr->hdr.dwFlags = dwFlags;
|
||||||
lpwhr->hdr.dwContext = dwContext;
|
lpwhr->hdr.dwContext = dwContext;
|
||||||
lpwhr->nSocketFD = INVALID_SOCKET;
|
lpwhr->nSocketFD = -1;
|
||||||
|
|
||||||
if (NULL != lpszObjectName && strlen(lpszObjectName)) {
|
if (NULL != lpszObjectName && strlen(lpszObjectName)) {
|
||||||
DWORD needed = 0;
|
DWORD needed = 0;
|
||||||
@ -847,7 +843,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQA lpwhr)
|
|||||||
lpwhs = (LPWININETHTTPSESSIONA)lpwhr->hdr.lpwhparent;
|
lpwhs = (LPWININETHTTPSESSIONA)lpwhr->hdr.lpwhparent;
|
||||||
|
|
||||||
lpwhr->nSocketFD = socket(lpwhs->phostent->h_addrtype,SOCK_STREAM,0);
|
lpwhr->nSocketFD = socket(lpwhs->phostent->h_addrtype,SOCK_STREAM,0);
|
||||||
if (INVALID_SOCKET == lpwhr->nSocketFD)
|
if (lpwhr->nSocketFD == -1)
|
||||||
{
|
{
|
||||||
WARN("Socket creation failed\n");
|
WARN("Socket creation failed\n");
|
||||||
goto lend;
|
goto lend;
|
||||||
@ -856,7 +852,7 @@ BOOL HTTP_OpenConnection(LPWININETHTTPREQA lpwhr)
|
|||||||
result = connect(lpwhr->nSocketFD, (struct sockaddr *)&lpwhs->socketAddress,
|
result = connect(lpwhr->nSocketFD, (struct sockaddr *)&lpwhs->socketAddress,
|
||||||
sizeof(lpwhs->socketAddress));
|
sizeof(lpwhs->socketAddress));
|
||||||
|
|
||||||
if (SOCKET_ERROR == result)
|
if (result == -1)
|
||||||
{
|
{
|
||||||
WARN("Unable to connect to host (%s)\n", strerror(errno));
|
WARN("Unable to connect to host (%s)\n", strerror(errno));
|
||||||
goto lend;
|
goto lend;
|
||||||
@ -890,7 +886,7 @@ BOOL HTTP_GetResponseHeaders(LPWININETHTTPREQA lpwhr)
|
|||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if (INVALID_SOCKET == lpwhr->nSocketFD)
|
if (lpwhr->nSocketFD == -1)
|
||||||
goto lend;
|
goto lend;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1213,10 +1209,10 @@ BOOL HTTP_ProcessHeader(LPWININETHTTPREQA lpwhr, LPCSTR field, LPCSTR value, DWO
|
|||||||
*/
|
*/
|
||||||
VOID HTTP_CloseConnection(LPWININETHTTPREQA lpwhr)
|
VOID HTTP_CloseConnection(LPWININETHTTPREQA lpwhr)
|
||||||
{
|
{
|
||||||
if (lpwhr->nSocketFD != INVALID_SOCKET)
|
if (lpwhr->nSocketFD != -1)
|
||||||
{
|
{
|
||||||
close(lpwhr->nSocketFD);
|
close(lpwhr->nSocketFD);
|
||||||
lpwhr->nSocketFD = INVALID_SOCKET;
|
lpwhr->nSocketFD = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1233,7 +1229,7 @@ void HTTP_CloseHTTPRequestHandle(LPWININETHTTPREQA lpwhr)
|
|||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if (lpwhr->nSocketFD != INVALID_SOCKET)
|
if (lpwhr->nSocketFD != -1)
|
||||||
HTTP_CloseConnection(lpwhr);
|
HTTP_CloseConnection(lpwhr);
|
||||||
|
|
||||||
if (lpwhr->lpszPath)
|
if (lpwhr->lpszPath)
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "wininet.h"
|
#include "wininet.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "winsock.h"
|
|
||||||
#include "shlwapi.h"
|
#include "shlwapi.h"
|
||||||
|
|
||||||
#include "internet.h"
|
#include "internet.h"
|
||||||
@ -784,7 +783,7 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
|
|||||||
DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
|
DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
|
||||||
{
|
{
|
||||||
BOOL retval = FALSE;
|
BOOL retval = FALSE;
|
||||||
int nSocket = INVALID_SOCKET;
|
int nSocket = -1;
|
||||||
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hFile;
|
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hFile;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
@ -805,7 +804,7 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer ,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (INVALID_SOCKET != nSocket)
|
if (nSocket != -1)
|
||||||
{
|
{
|
||||||
*lpdwNumOfBytesWritten = INTERNET_WriteDataToStream(nSocket, lpBuffer, dwNumOfBytesToWrite);
|
*lpdwNumOfBytesWritten = INTERNET_WriteDataToStream(nSocket, lpBuffer, dwNumOfBytesToWrite);
|
||||||
if (*lpdwNumOfBytesWritten < 0)
|
if (*lpdwNumOfBytesWritten < 0)
|
||||||
@ -832,7 +831,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
|
|||||||
DWORD dwNumOfBytesToRead, LPDWORD dwNumOfBytesRead)
|
DWORD dwNumOfBytesToRead, LPDWORD dwNumOfBytesRead)
|
||||||
{
|
{
|
||||||
BOOL retval = FALSE;
|
BOOL retval = FALSE;
|
||||||
int nSocket = INVALID_SOCKET;
|
int nSocket = -1;
|
||||||
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hFile;
|
LPWININETHANDLEHEADER lpwh = (LPWININETHANDLEHEADER) hFile;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
@ -853,7 +852,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (INVALID_SOCKET != nSocket)
|
if (nSocket != -1)
|
||||||
{
|
{
|
||||||
*dwNumOfBytesRead = INTERNET_ReadDataFromStream(nSocket, lpBuffer, dwNumOfBytesToRead);
|
*dwNumOfBytesRead = INTERNET_ReadDataFromStream(nSocket, lpBuffer, dwNumOfBytesToRead);
|
||||||
if (*dwNumOfBytesRead < 0)
|
if (*dwNumOfBytesRead < 0)
|
||||||
@ -1063,8 +1062,8 @@ End:
|
|||||||
*/
|
*/
|
||||||
int INTERNET_WriteDataToStream(int nDataSocket, LPCVOID Buffer, DWORD BytesToWrite)
|
int INTERNET_WriteDataToStream(int nDataSocket, LPCVOID Buffer, DWORD BytesToWrite)
|
||||||
{
|
{
|
||||||
if (INVALID_SOCKET == nDataSocket)
|
if (nDataSocket == -1)
|
||||||
return SOCKET_ERROR;
|
return -1;
|
||||||
|
|
||||||
return send(nDataSocket, Buffer, BytesToWrite, 0);
|
return send(nDataSocket, Buffer, BytesToWrite, 0);
|
||||||
}
|
}
|
||||||
@ -1082,8 +1081,8 @@ int INTERNET_WriteDataToStream(int nDataSocket, LPCVOID Buffer, DWORD BytesToWri
|
|||||||
*/
|
*/
|
||||||
int INTERNET_ReadDataFromStream(int nDataSocket, LPVOID Buffer, DWORD BytesToRead)
|
int INTERNET_ReadDataFromStream(int nDataSocket, LPVOID Buffer, DWORD BytesToRead)
|
||||||
{
|
{
|
||||||
if (INVALID_SOCKET == nDataSocket)
|
if (nDataSocket == -1)
|
||||||
return SOCKET_ERROR;
|
return -1;
|
||||||
|
|
||||||
return recv(nDataSocket, Buffer, BytesToRead, 0);
|
return recv(nDataSocket, Buffer, BytesToRead, 0);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
#define _WINE_INTERNET_H_
|
#define _WINE_INTERNET_H_
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifdef HAVE_NETDB_H
|
||||||
|
# include <netdb.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
|
# include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wininet.h"
|
#include "wininet.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "winsock.h"
|
|
||||||
|
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "internet.h"
|
#include "internet.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user