diff options
Diffstat (limited to 'nanohttp/nanohttp-server.c')
| -rw-r--r-- | nanohttp/nanohttp-server.c | 56 | 
1 files changed, 28 insertions, 28 deletions
| diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c index 625bd79..d50c434 100644 --- a/nanohttp/nanohttp-server.c +++ b/nanohttp/nanohttp-server.c @@ -1,5 +1,5 @@  /****************************************************************** -*  $Id: nanohttp-server.c,v 1.30 2004/11/02 22:42:52 snowdrop Exp $ +*  $Id: nanohttp-server.c,v 1.31 2004/11/02 23:09:27 snowdrop Exp $  *  * CSOAP Project:  A http client/server library in C  * Copyright (C) 2003  Ferhat Ayaz @@ -32,7 +32,7 @@  #endif  #ifndef WIN32 -
 +  /* According to POSIX 1003.1-2001 */  #include <sys/select.h> @@ -40,11 +40,11 @@  #include <sys/time.h>  #include <sys/types.h>  #include <unistd.h> -
 -#else
 -
 + +#else +  #include <process.h>   -
 +  #endif  #ifdef MEM_DEBUG @@ -97,11 +97,11 @@ static void WSAReaper(void *x);  herror_t  httpd_init (int argc, char *argv[])  { -  int i;
 +  int i;    herror_t status; -
 -  hoption_init_args(argc, argv);
 -
 + +  hoption_init_args(argc, argv); +  	status = hsocket_module_init ();    if (status != H_OK)      return status; @@ -140,14 +140,14 @@ httpd_init (int argc, char *argv[])      memset ((char *) &_httpd_connection[i], 0, sizeof (_httpd_connection[i]));    } -#ifdef WIN32
 +#ifdef WIN32    /*    if (_beginthread (WSAReaper, 0, NULL) == -1)    {      log_error1 ("Winsock reaper thread failed to start"); -    return herror_new("httpd_init", THREAD_BEGIN_ERROR, 
 +    return herror_new("httpd_init", THREAD_BEGIN_ERROR,   		"_beginthread() failed while starting WSAReaper"); -  }
 +  }    */  #endif @@ -298,8 +298,8 @@ httpd_send_header (httpd_conn_t * res, int code, const char *text)    /* send header */    status = hsocket_nsend (res->sock, header, strlen (header)); -	if (status != H_OK)
 -		return status;
 +	if (status != H_OK) +		return status;    res->out = http_output_stream_new (res->sock, res->header);    return H_OK; @@ -390,11 +390,11 @@ httpd_session_main (void *data)    hrequest_t *req = NULL;       /* only for test */    httpd_conn_t *rconn;    hservice_t *service = NULL; -  long content_length = 0;
 +  long content_length = 0;    herror_t status;    header[0] = '\0'; -  len = 0;
 +  len = 0; @@ -407,7 +407,7 @@ httpd_session_main (void *data)    status = hrequest_new_from_socket (conn->sock, &req);    if (status != H_OK)    { -    httpd_send_internal_error (rconn, herror_message(status)/*"Request parse error!"*/);
 +    httpd_send_internal_error (rconn, herror_message(status)/*"Request parse error!"*/);  	herror_release(status);    }    else @@ -706,7 +706,7 @@ void httpd_destroy()      hservice_free(cur);      cur = tmp;    } -
 +    hsocket_module_destroy();  } @@ -834,12 +834,12 @@ httpd_mime_send_header (httpd_conn_t * conn,       type=..; start=.. ; start-info= ..; boundary=...     */ -	/*
 -	  using sprintf instead of snprintf because visual c does not support snprintf
 -	*/
 -#ifdef WIN32
 -#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
 -#endif
 +	/* +	  using sprintf instead of snprintf because visual c does not support snprintf +	*/ +#ifdef WIN32 +#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2) +#endif    sprintf (buffer, "multipart/related;");    if (related_type) @@ -926,7 +926,7 @@ httpd_mime_send_file (httpd_conn_t * conn,    size_t size;    if (fd == NULL) -    return herror_new("httpd_mime_send_file", FILE_ERROR_OPEN,
 +    return herror_new("httpd_mime_send_file", FILE_ERROR_OPEN,  	 "Can not open file '%d'", filename);    status = @@ -943,8 +943,8 @@ httpd_mime_send_file (httpd_conn_t * conn,      if (size == -1)      {        fclose (fd); -          return herror_new("httpd_mime_send_file", FILE_ERROR_READ,
 -		  "Can not read from file '%d'", filename);
 +          return herror_new("httpd_mime_send_file", FILE_ERROR_READ, +		  "Can not read from file '%d'", filename);      }      status = http_output_stream_write (conn->out, buffer, size); | 
