From 632b4b8564290bae074cf95ca91b90256101fd9d Mon Sep 17 00:00:00 2001 From: snowdrop Date: Mon, 30 Aug 2004 07:55:41 +0000 Subject: fixed some bugs corresponding win32 port code --- nanohttp/nanohttp-client.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'nanohttp/nanohttp-client.c') diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c index 8f49048..e0456e8 100644 --- a/nanohttp/nanohttp-client.c +++ b/nanohttp/nanohttp-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-client.c,v 1.13 2004/08/26 17:07:47 rans Exp $ +* $Id: nanohttp-client.c,v 1.14 2004/08/30 07:55:41 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -36,11 +36,15 @@ #include #include #include + + #ifdef WIN32 + #include + static struct tm *localtime_r(const time_t *const timep, struct tm *p_tm) { - static tm* tmp; + static struct tm* tmp; tmp = localtime(timep); if (tmp) { memcpy(p_tm, tmp, sizeof(struct tm)); @@ -48,6 +52,7 @@ static struct tm *localtime_r(const time_t *const timep, struct tm *p_tm) } return tmp; } + #endif /*-------------------------------------------------- FUNCTION: httpc_new @@ -572,6 +577,14 @@ int httpc_talk_to_server(hreq_method method, httpc_conn_t *conn, char buffer[4096]; int status; +#ifndef WIN32 + #if HSOCKET_BLOCKMODE!=0 + fcntl(conn->sock, F_SETFL, O_NONBLOCK); + #endif +#else + unsigned long iMode = HSOCKET_BLOCKMODE; +#endif + if (conn == NULL) { log_error1("Connection object is NULL"); @@ -604,7 +617,6 @@ int httpc_talk_to_server(hreq_method method, httpc_conn_t *conn, fcntl(conn->sock, F_SETFL, O_NONBLOCK); #endif #else - unsigned long iMode = HSOCKET_BLOCKMODE; if(ioctlsocket(conn->sock, FIONBIO, (u_long FAR*) &iMode) == INVALID_SOCKET) { log_error1("ioctlsocket error"); -- cgit v1.1-32-gdbae