summaryrefslogtreecommitdiffstats
path: root/nanohttp
diff options
context:
space:
mode:
authorGravatar snowdrop2005-05-27 19:28:04 +0000
committerGravatar snowdrop2005-05-27 19:28:04 +0000
commit232ff6e28d1fce08472a2f7a965d83d3e008d84c (patch)
treedcad585d5cb9e1bd6cbd99ad38aa3d32d257b25c /nanohttp
parent3cb6ed195c1c2a3e45014e31f2d923eabd88829f (diff)
downloadcsoap-232ff6e28d1fce08472a2f7a965d83d3e008d84c.tar.gz
csoap-232ff6e28d1fce08472a2f7a965d83d3e008d84c.tar.bz2
patch from mailinglist
Diffstat (limited to 'nanohttp')
-rw-r--r--nanohttp/nanohttp-client.c8
-rw-r--r--nanohttp/nanohttp-common.c3
-rwxr-xr-xnanohttp/nanohttp-mime.c3
-rwxr-xr-xnanohttp/nanohttp-request.c4
-rwxr-xr-xnanohttp/nanohttp-response.c3
-rw-r--r--nanohttp/nanohttp-server.c16
-rw-r--r--nanohttp/nanohttp-socket.c14
-rwxr-xr-xnanohttp/nanohttp-stream.c4
8 files changed, 37 insertions, 18 deletions
diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c
index 2f79bc0..b1d101f 100644
--- a/nanohttp/nanohttp-client.c
+++ b/nanohttp/nanohttp-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-client.c,v 1.26 2004/11/02 23:09:26 snowdrop Exp $
+* $Id: nanohttp-client.c,v 1.27 2005/05/27 19:28:15 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -32,17 +32,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <string.h>
#ifdef MEM_DEBUG
#include <utils/alloc.h>
#endif
+#if 0
static
int httpc_send_data(httpc_conn_t *conn, const unsigned char* data, size_t size)
{
return -1;
}
-
+#endif
/*--------------------------------------------------
FUNCTION: httpc_init
DESC: Initialize http client connection
@@ -188,7 +190,7 @@ httpc_header_add_date(httpc_conn_t * conn)
/* Set date */
nw = time(NULL);
localtime_r(&nw, &stm);
- strftime(buffer, 255, "%a, %d %b %y %T GMT", &stm);
+ strftime(buffer, 255, "%a, %d %b %Y %T GMT", &stm);
httpc_set_header(conn, HEADER_DATE, buffer);
}
diff --git a/nanohttp/nanohttp-common.c b/nanohttp/nanohttp-common.c
index a6d02e6..b59a4d4 100644
--- a/nanohttp/nanohttp-common.c
+++ b/nanohttp/nanohttp-common.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-common.c,v 1.17 2004/11/02 23:09:26 snowdrop Exp $
+* $Id: nanohttp-common.c,v 1.18 2005/05/27 19:28:15 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#include <ctype.h>
#ifdef MEM_DEBUG
#include <utils/alloc.h>
diff --git a/nanohttp/nanohttp-mime.c b/nanohttp/nanohttp-mime.c
index 2cf059c..f4ff487 100755
--- a/nanohttp/nanohttp-mime.c
+++ b/nanohttp/nanohttp-mime.c
@@ -3,7 +3,7 @@
* | \/ | | | | \/ | | _/
* |_''_| |_| |_''_| |_'/ PARSER
*
-* $Id: nanohttp-mime.c,v 1.6 2004/11/02 23:09:26 snowdrop Exp $
+* $Id: nanohttp-mime.c,v 1.7 2005/05/27 19:28:15 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -30,6 +30,7 @@
#include <nanohttp/nanohttp-mime.h>
#include <stdio.h>
+#include <string.h>
/*----------------------------------------------------------------
Buffered Reader. A helper object to read bytes from a source
diff --git a/nanohttp/nanohttp-request.c b/nanohttp/nanohttp-request.c
index 16e74cb..6597c10 100755
--- a/nanohttp/nanohttp-request.c
+++ b/nanohttp/nanohttp-request.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-request.c,v 1.4 2004/11/02 23:09:26 snowdrop Exp $
+* $Id: nanohttp-request.c,v 1.5 2005/05/27 19:28:15 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,6 +25,8 @@
#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-request.h>
+#include <string.h>
+
#ifdef MEM_DEBUG
#include <utils/alloc.h>
#endif
diff --git a/nanohttp/nanohttp-response.c b/nanohttp/nanohttp-response.c
index 5432898..1447345 100755
--- a/nanohttp/nanohttp-response.c
+++ b/nanohttp/nanohttp-response.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-response.c,v 1.4 2004/11/02 23:09:27 snowdrop Exp $
+* $Id: nanohttp-response.c,v 1.5 2005/05/27 19:28:15 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -25,6 +25,7 @@
#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-response.h>
+#include <string.h>
#ifdef MEM_DEBUG
#include <utils/alloc.h>
diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c
index d50c434..742ecc3 100644
--- a/nanohttp/nanohttp-server.c
+++ b/nanohttp/nanohttp-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-server.c,v 1.31 2004/11/02 23:09:27 snowdrop Exp $
+* $Id: nanohttp-server.c,v 1.32 2005/05/27 19:28:15 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
+#include <string.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -41,6 +42,10 @@
#include <sys/types.h>
#include <unistd.h>
+#ifdef HAVE_SOCKET
+#include <sys/socket.h>
+#endif
+
#else
#include <process.h>
@@ -51,6 +56,8 @@
#include <utils/alloc.h>
#endif
+#include <pthread.h>
+
typedef struct _conndata
{
hsocket_t sock;
@@ -71,7 +78,9 @@ typedef struct _conndata
*/
static int _httpd_port = 10000;
static int _httpd_max_connections = 20;
+#ifdef WIN32
static int _httpd_max_idle = 120;
+#endif
static hsocket_t _httpd_socket;
static hservice_t *_httpd_services_head = NULL;
static hservice_t *_httpd_services_tail = NULL;
@@ -267,7 +276,7 @@ httpd_send_header (httpd_conn_t * res, int code, const char *text)
/* set date */
nw = time (NULL);
localtime_r (&nw, &stm);
- strftime (buffer, 255, "Date: %a, %d %b %y %T GMT", &stm);
+ strftime (buffer, 255, "Date: %a, %d %b %Y %T GMT", &stm);
strcat (header, buffer);
strcat (header, "\r\n");
@@ -386,11 +395,9 @@ httpd_session_main (void *data)
int len = strlen (msg);
char buffer[256]; /* temp buffer for recv() */
char header[4064]; /* received header */
- int headerreached = 0; /* whether reach header * "\n\n" */
hrequest_t *req = NULL; /* only for test */
httpd_conn_t *rconn;
hservice_t *service = NULL;
- long content_length = 0;
herror_t status;
header[0] = '\0';
@@ -754,7 +761,6 @@ httpd_get_postdata (httpd_conn_t * conn, hrequest_t * req, long *received,
{
char *content_length_str;
long content_length = 0;
- long total = 0;
unsigned char *postdata = NULL;
if (req->method == HTTP_REQUEST_POST)
diff --git a/nanohttp/nanohttp-socket.c b/nanohttp/nanohttp-socket.c
index 869bc40..468f3b9 100644
--- a/nanohttp/nanohttp-socket.c
+++ b/nanohttp/nanohttp-socket.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-socket.c,v 1.32 2004/11/02 23:09:27 snowdrop Exp $
+* $Id: nanohttp-socket.c,v 1.33 2005/05/27 19:28:16 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -63,6 +63,7 @@
#include <stdio.h>
#include <errno.h>
+#include <string.h>
#ifdef MEM_DEBUG
#include <utils/alloc.h>
@@ -257,7 +258,7 @@ hsocket_listen (hsocket_t sock)
return H_OK;
}
-
+#if 0
static
void _hsocket_wait_until_receive(hsocket_t sock)
{
@@ -294,6 +295,7 @@ void _hsocket_wait_until_receive(hsocket_t sock)
}
}
}
+#endif
/*--------------------------------------------------
FUNCTION: hsocket_close
@@ -327,7 +329,7 @@ hsocket_close (hsocket_t sock)
log_verbose1 ("closed");
}
-
+#if 0
static int _test_send_to_file(const char* filename, const byte_t* bytes,int n)
{
int size;
@@ -337,7 +339,7 @@ static int _test_send_to_file(const char* filename, const byte_t* bytes,int n)
fclose(f);
return size;
}
-
+#endif
/*--------------------------------------------------
FUNCTION: hsocket_send
----------------------------------------------------*/
@@ -391,7 +393,9 @@ hsocket_read (hsocket_t sock, byte_t *buffer, int total, int force, int *receive
{
int status;
int totalRead;
- int wsa_error;
+#ifdef WIN32
+ int wsa_error = 0;
+#endif
totalRead = 0;
/*
log_verbose3("Entering hsocket_read(total=%d,force=%d)", total, force);
diff --git a/nanohttp/nanohttp-stream.c b/nanohttp/nanohttp-stream.c
index 3f0a9e9..1440e63 100755
--- a/nanohttp/nanohttp-stream.c
+++ b/nanohttp/nanohttp-stream.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: nanohttp-stream.c,v 1.6 2004/11/02 23:09:27 snowdrop Exp $
+* $Id: nanohttp-stream.c,v 1.7 2005/05/27 19:28:16 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -24,6 +24,8 @@
#include <nanohttp/nanohttp-stream.h>
+#include <string.h>
+
#ifdef MEM_DEBUG
#include <utils/alloc.h>
#endif