1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-08-09 03:22:45 +03:00

Generalized utility functions

This commit is contained in:
Lammert Bies
2016-12-15 09:29:41 +01:00
parent 0e01ba1dee
commit 9502832b97
230 changed files with 1544 additions and 451 deletions

688
Makefile

File diff suppressed because it is too large Load Diff

View File

@@ -22,34 +22,102 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#ifndef CIVETWEB_HEADER_INCLUDED #ifndef LIBHTTP_HEADER_INCLUDED
#define CIVETWEB_HEADER_INCLUDED #define LIBHTTP_HEADER_INCLUDED
#define LIBHTTP_VERSION "1.9" #define LIBHTTP_VERSION "1.9"
#ifndef CIVETWEB_API #ifndef LIBHTTP_API
#if defined(_WIN32) #if defined(_WIN32)
#if defined(CIVETWEB_DLL_EXPORTS) #if defined(LIBHTTP_DLL_EXPORTS)
#define CIVETWEB_API __declspec(dllexport) #define LIBHTTP_API __declspec(dllexport)
#elif defined(CIVETWEB_DLL_IMPORTS) #elif defined(LIBHTTP_DLL_IMPORTS)
#define CIVETWEB_API __declspec(dllimport) #define LIBHTTP_API __declspec(dllimport)
#else #else
#define CIVETWEB_API #define LIBHTTP_API
#endif #endif
#elif __GNUC__ >= 4 #elif __GNUC__ >= 4
#define CIVETWEB_API __attribute__((visibility("default"))) #define LIBHTTP_API __attribute__((visibility("default")))
#else #else
#define CIVETWEB_API #define LIBHTTP_API
#endif #endif
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stddef.h> #include <stddef.h>
/*
* For our Posix emulation functions to open and close directories we need
* to know the path length. If this length is not set yet, we set it here based
* on an educated guess.
*/
#if !defined(PATH_MAX)
#define PATH_MAX (MAX_PATH)
#endif /* PATH_MAX */
#if !defined(PATH_MAX)
#define PATH_MAX (4096)
#endif /* PATH_MAX */
#if defined(_WIN32)
/*
* The OS does not support Posix calls, but we need some of them for the
* library to function properly. We therefore define some items which makes
* life easier in the multiple target world.
*/
#define SIGKILL (0)
#else /* _WIN32 */
/*
* For Posix compliant systems we need to read some include files where
* definitions, structures and prototypes are present.
*/
#include <sys/poll.h>
#include <sys/types.h>
#include <dirent.h>
#include <signal.h>
#endif /* _WIN32 */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#if defined(_WIN32)
/*
* In Windows we emulate the Posix directory functions to make the OS dependent
* code on the application side as small as possible.
*/
struct dirent {
char d_name[PATH_MAX];
};
typedef struct DIR {
HANDLE handle;
WIN32_FIND_DATAW info;
struct dirent result;
} DIR;
#endif
#if defined(_WIN32) && !defined(POLLIN)
/*
* If we are on Windows without poll(), we emulate this Posix function.
*/
#ifndef HAVE_POLL
struct pollfd {
SOCKET fd;
short events;
short revents;
};
#define POLLIN (0x0300)
#endif /* HAVE_POLL */
#endif /* _WIN32 && ! POLLIN */
struct httplib_context; /* Handle for the HTTP service itself */ struct httplib_context; /* Handle for the HTTP service itself */
struct httplib_connection; /* Handle for the individual connection */ struct httplib_connection; /* Handle for the individual connection */
@@ -220,7 +288,7 @@ struct httplib_callbacks {
Return: Return:
web server context, or NULL on error. */ web server context, or NULL on error. */
CIVETWEB_API struct httplib_context *httplib_start(const struct httplib_callbacks *callbacks, void *user_data, const char **configuration_options); LIBHTTP_API struct httplib_context *httplib_start(const struct httplib_callbacks *callbacks, void *user_data, const char **configuration_options);
/* Stop the web server. /* Stop the web server.
@@ -228,7 +296,7 @@ CIVETWEB_API struct httplib_context *httplib_start(const struct httplib_callback
Must be called last, when an application wants to stop the web server and Must be called last, when an application wants to stop the web server and
release all associated resources. This function blocks until all LibHTTP release all associated resources. This function blocks until all LibHTTP
threads are stopped. Context pointer becomes invalid. */ threads are stopped. Context pointer becomes invalid. */
CIVETWEB_API void httplib_stop(struct httplib_context *); LIBHTTP_API void httplib_stop(struct httplib_context *);
/* httplib_request_handler /* httplib_request_handler
@@ -267,7 +335,7 @@ typedef int (*httplib_request_handler)(struct httplib_connection *conn, void *cb
to to
register it (not only a pattern match). register it (not only a pattern match).
cbdata: the callback data to give to the handler when it is called. */ cbdata: the callback data to give to the handler when it is called. */
CIVETWEB_API void httplib_set_request_handler(struct httplib_context *ctx, const char *uri, httplib_request_handler handler, void *cbdata); LIBHTTP_API void httplib_set_request_handler(struct httplib_context *ctx, const char *uri, httplib_request_handler handler, void *cbdata);
/* Callback types for websocket handlers in C/C++. /* Callback types for websocket handlers in C/C++.
@@ -305,7 +373,7 @@ typedef void (*httplib_websocket_close_handler)(const struct httplib_connection
Set or remove handler functions for websocket connections. Set or remove handler functions for websocket connections.
This function works similar to httplib_set_request_handler - see there. */ This function works similar to httplib_set_request_handler - see there. */
CIVETWEB_API void LIBHTTP_API void
httplib_set_websocket_handler(struct httplib_context *ctx, httplib_set_websocket_handler(struct httplib_context *ctx,
const char *uri, const char *uri,
httplib_websocket_connect_handler connect_handler, httplib_websocket_connect_handler connect_handler,
@@ -333,7 +401,7 @@ typedef int (*httplib_authorization_handler)(struct httplib_connection *conn, vo
Sets or removes a URI mapping for an authorization handler. Sets or removes a URI mapping for an authorization handler.
This function works similar to httplib_set_request_handler - see there. */ This function works similar to httplib_set_request_handler - see there. */
CIVETWEB_API void httplib_set_auth_handler(struct httplib_context *ctx, const char *uri, httplib_authorization_handler handler, void *cbdata); LIBHTTP_API void httplib_set_auth_handler(struct httplib_context *ctx, const char *uri, httplib_authorization_handler handler, void *cbdata);
/* Get the value of particular configuration parameter. /* Get the value of particular configuration parameter.
@@ -342,25 +410,25 @@ CIVETWEB_API void httplib_set_auth_handler(struct httplib_context *ctx, const ch
If given parameter name is not valid, NULL is returned. For valid If given parameter name is not valid, NULL is returned. For valid
names, return value is guaranteed to be non-NULL. If parameter is not names, return value is guaranteed to be non-NULL. If parameter is not
set, zero-length string is returned. */ set, zero-length string is returned. */
CIVETWEB_API const char *httplib_get_option(const struct httplib_context *ctx, const char *name); LIBHTTP_API const char *httplib_get_option(const struct httplib_context *ctx, const char *name);
/* Get context from connection. */ /* Get context from connection. */
CIVETWEB_API struct httplib_context * LIBHTTP_API struct httplib_context *
httplib_get_context(const struct httplib_connection *conn); httplib_get_context(const struct httplib_connection *conn);
/* Get user data passed to httplib_start from context. */ /* Get user data passed to httplib_start from context. */
CIVETWEB_API void *httplib_get_user_data(const struct httplib_context *ctx); LIBHTTP_API void *httplib_get_user_data(const struct httplib_context *ctx);
/* Set user data for the current connection. */ /* Set user data for the current connection. */
CIVETWEB_API void httplib_set_user_connection_data(struct httplib_connection *conn, LIBHTTP_API void httplib_set_user_connection_data(struct httplib_connection *conn,
void *data); void *data);
/* Get user data set for the current connection. */ /* Get user data set for the current connection. */
CIVETWEB_API void * LIBHTTP_API void *
httplib_get_user_connection_data(const struct httplib_connection *conn); httplib_get_user_connection_data(const struct httplib_connection *conn);
@@ -385,7 +453,7 @@ enum {
/* Return array of struct httplib_option, representing all valid configuration /* Return array of struct httplib_option, representing all valid configuration
options of libhttp.c. options of libhttp.c.
The array is terminated by a NULL name option. */ The array is terminated by a NULL name option. */
CIVETWEB_API const struct httplib_option *httplib_get_valid_options(void); LIBHTTP_API const struct httplib_option *httplib_get_valid_options(void);
struct httplib_server_ports { struct httplib_server_ports {
@@ -405,7 +473,7 @@ struct httplib_server_ports {
The caller is responsibility to allocate the required memory. The caller is responsibility to allocate the required memory.
This function returns the number of struct httplib_server_ports elements This function returns the number of struct httplib_server_ports elements
filled in, or <0 in case of an error. */ filled in, or <0 in case of an error. */
CIVETWEB_API int httplib_get_server_ports(const struct httplib_context *ctx, int size, struct httplib_server_ports *ports); LIBHTTP_API int httplib_get_server_ports(const struct httplib_context *ctx, int size, struct httplib_server_ports *ports);
/* Add, edit or delete the entry in the passwords file. /* Add, edit or delete the entry in the passwords file.
@@ -420,11 +488,11 @@ CIVETWEB_API int httplib_get_server_ports(const struct httplib_context *ctx, int
Return: Return:
1 on success, 0 on error. */ 1 on success, 0 on error. */
CIVETWEB_API int httplib_modify_passwords_file(const char *passwords_file_name, const char *domain, const char *user, const char *password); LIBHTTP_API int httplib_modify_passwords_file(const char *passwords_file_name, const char *domain, const char *user, const char *password);
/* Return information associated with the request. */ /* Return information associated with the request. */
CIVETWEB_API const struct httplib_request_info *httplib_get_request_info(const struct httplib_connection *); LIBHTTP_API const struct httplib_request_info *httplib_get_request_info(const struct httplib_connection *);
/* Send data to the client. /* Send data to the client.
@@ -432,7 +500,7 @@ CIVETWEB_API const struct httplib_request_info *httplib_get_request_info(const s
0 when the connection has been closed 0 when the connection has been closed
-1 on error -1 on error
>0 number of bytes written on success */ >0 number of bytes written on success */
CIVETWEB_API int httplib_write(struct httplib_connection *, const void *buf, size_t len); LIBHTTP_API int httplib_write(struct httplib_connection *, const void *buf, size_t len);
/* Send data to a websocket client wrapped in a websocket frame. Uses /* Send data to a websocket client wrapped in a websocket frame. Uses
@@ -447,7 +515,7 @@ CIVETWEB_API int httplib_write(struct httplib_connection *, const void *buf, siz
0 when the connection has been closed 0 when the connection has been closed
-1 on error -1 on error
>0 number of bytes written on success */ >0 number of bytes written on success */
CIVETWEB_API int httplib_websocket_write(struct httplib_connection *conn, int opcode, const char *data, size_t data_len); LIBHTTP_API int httplib_websocket_write(struct httplib_connection *conn, int opcode, const char *data, size_t data_len);
/* Send data to a websocket server wrapped in a masked websocket frame. Uses /* Send data to a websocket server wrapped in a masked websocket frame. Uses
@@ -462,7 +530,7 @@ CIVETWEB_API int httplib_websocket_write(struct httplib_connection *conn, int op
0 when the connection has been closed 0 when the connection has been closed
-1 on error -1 on error
>0 number of bytes written on success */ >0 number of bytes written on success */
CIVETWEB_API int httplib_websocket_client_write(struct httplib_connection *conn, int opcode, const char *data, size_t data_len); LIBHTTP_API int httplib_websocket_client_write(struct httplib_connection *conn, int opcode, const char *data, size_t data_len);
/* Blocks until unique access is obtained to this connection. Intended for use /* Blocks until unique access is obtained to this connection. Intended for use
@@ -470,14 +538,14 @@ CIVETWEB_API int httplib_websocket_client_write(struct httplib_connection *conn,
Invoke this before httplib_write or httplib_printf when communicating with a Invoke this before httplib_write or httplib_printf when communicating with a
websocket if your code has server-initiated communication as well as websocket if your code has server-initiated communication as well as
communication in direct response to a message. */ communication in direct response to a message. */
CIVETWEB_API void httplib_lock_connection(struct httplib_connection *conn); LIBHTTP_API void httplib_lock_connection(struct httplib_connection *conn);
CIVETWEB_API void httplib_unlock_connection(struct httplib_connection *conn); LIBHTTP_API void httplib_unlock_connection(struct httplib_connection *conn);
/* Lock server context. This lock may be used to protect resources /* Lock server context. This lock may be used to protect resources
that are shared between different connection/worker threads. */ that are shared between different connection/worker threads. */
CIVETWEB_API void httplib_lock_context(struct httplib_context *ctx); LIBHTTP_API void httplib_lock_context(struct httplib_context *ctx);
CIVETWEB_API void httplib_unlock_context(struct httplib_context *ctx); LIBHTTP_API void httplib_unlock_context(struct httplib_context *ctx);
/* Opcodes, from http://tools.ietf.org/html/rfc6455 */ /* Opcodes, from http://tools.ietf.org/html/rfc6455 */
@@ -513,11 +581,11 @@ enum {
/* Send data to the client using printf() semantics. /* Send data to the client using printf() semantics.
Works exactly like httplib_write(), but allows to do message formatting. */ Works exactly like httplib_write(), but allows to do message formatting. */
CIVETWEB_API int httplib_printf(struct httplib_connection *, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3); LIBHTTP_API int httplib_printf(struct httplib_connection *, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
/* Send contents of the entire file together with HTTP headers. */ /* Send contents of the entire file together with HTTP headers. */
CIVETWEB_API void httplib_send_file(struct httplib_connection *conn, const char *path); LIBHTTP_API void httplib_send_file(struct httplib_connection *conn, const char *path);
/* Send contents of the entire file together with HTTP headers. /* Send contents of the entire file together with HTTP headers.
Parameters: Parameters:
@@ -526,7 +594,7 @@ CIVETWEB_API void httplib_send_file(struct httplib_connection *conn, const char
mime_type: Content-Type for file. NULL will cause the type to be mime_type: Content-Type for file. NULL will cause the type to be
looked up by the file extension. looked up by the file extension.
*/ */
CIVETWEB_API void httplib_send_mime_file(struct httplib_connection *conn, const char *path, const char *mime_type); LIBHTTP_API void httplib_send_mime_file(struct httplib_connection *conn, const char *path, const char *mime_type);
/* Send contents of the entire file together with HTTP headers. /* Send contents of the entire file together with HTTP headers.
Parameters: Parameters:
@@ -539,10 +607,10 @@ CIVETWEB_API void httplib_send_mime_file(struct httplib_connection *conn, const
included twice. included twice.
NULL does not append anything. NULL does not append anything.
*/ */
CIVETWEB_API void httplib_send_mime_file2(struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers); LIBHTTP_API void httplib_send_mime_file2(struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers);
/* Store body data into a file. */ /* Store body data into a file. */
CIVETWEB_API long long httplib_store_body(struct httplib_connection *conn, const char *path); LIBHTTP_API long long httplib_store_body(struct httplib_connection *conn, const char *path);
/* Read entire request body and store it in a file "path". /* Read entire request body and store it in a file "path".
Return: Return:
< 0 Error < 0 Error
@@ -555,7 +623,7 @@ CIVETWEB_API long long httplib_store_body(struct httplib_connection *conn, const
0 connection has been closed by peer. No more data could be read. 0 connection has been closed by peer. No more data could be read.
< 0 read error. No more data could be read from the connection. < 0 read error. No more data could be read from the connection.
> 0 number of bytes read into the buffer. */ > 0 number of bytes read into the buffer. */
CIVETWEB_API int httplib_read(struct httplib_connection *, void *buf, size_t len); LIBHTTP_API int httplib_read(struct httplib_connection *, void *buf, size_t len);
/* Get the value of particular HTTP header. /* Get the value of particular HTTP header.
@@ -563,7 +631,7 @@ CIVETWEB_API int httplib_read(struct httplib_connection *, void *buf, size_t len
This is a helper function. It traverses request_info->http_headers array, This is a helper function. It traverses request_info->http_headers array,
and if the header is present in the array, returns its value. If it is and if the header is present in the array, returns its value. If it is
not present, NULL is returned. */ not present, NULL is returned. */
CIVETWEB_API const char *httplib_get_header(const struct httplib_connection *, const char *name); LIBHTTP_API const char *httplib_get_header(const struct httplib_connection *, const char *name);
/* Get a value of particular form variable. /* Get a value of particular form variable.
@@ -585,7 +653,7 @@ CIVETWEB_API const char *httplib_get_header(const struct httplib_connection *, c
Destination buffer is guaranteed to be '\0' - terminated if it is not Destination buffer is guaranteed to be '\0' - terminated if it is not
NULL or zero length. */ NULL or zero length. */
CIVETWEB_API int httplib_get_var(const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len); LIBHTTP_API int httplib_get_var(const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len);
/* Get a value of particular form variable. /* Get a value of particular form variable.
@@ -611,7 +679,7 @@ CIVETWEB_API int httplib_get_var(const char *data, size_t data_len, const char *
Destination buffer is guaranteed to be '\0' - terminated if it is not Destination buffer is guaranteed to be '\0' - terminated if it is not
NULL or zero length. */ NULL or zero length. */
CIVETWEB_API int httplib_get_var2(const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len, size_t occurrence); LIBHTTP_API int httplib_get_var2(const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len, size_t occurrence);
/* Fetch value of certain cookie variable into the destination buffer. /* Fetch value of certain cookie variable into the destination buffer.
@@ -627,7 +695,7 @@ CIVETWEB_API int httplib_get_var2(const char *data, size_t data_len, const char
parameter is not found). parameter is not found).
-2 (destination buffer is NULL, zero length or too small to hold the -2 (destination buffer is NULL, zero length or too small to hold the
value). */ value). */
CIVETWEB_API int httplib_get_cookie(const char *cookie, const char *var_name, char *buf, size_t buf_len); LIBHTTP_API int httplib_get_cookie(const char *cookie, const char *var_name, char *buf, size_t buf_len);
/* Download data from the remote web server. /* Download data from the remote web server.
@@ -645,7 +713,7 @@ CIVETWEB_API int httplib_get_cookie(const char *cookie, const char *var_name, ch
conn = httplib_download("google.com", 80, 0, ebuf, sizeof(ebuf), conn = httplib_download("google.com", 80, 0, ebuf, sizeof(ebuf),
"%s", "GET / HTTP/1.0\r\nHost: google.com\r\n\r\n"); "%s", "GET / HTTP/1.0\r\nHost: google.com\r\n\r\n");
*/ */
CIVETWEB_API struct httplib_connection * LIBHTTP_API struct httplib_connection *
httplib_download(const char *host, httplib_download(const char *host,
int port, int port,
int use_ssl, int use_ssl,
@@ -656,7 +724,7 @@ httplib_download(const char *host,
/* Close the connection opened by httplib_download(). */ /* Close the connection opened by httplib_download(). */
CIVETWEB_API void httplib_close_connection(struct httplib_connection *conn); LIBHTTP_API void httplib_close_connection(struct httplib_connection *conn);
/* This structure contains callback functions for handling form fields. /* This structure contains callback functions for handling form fields.
@@ -741,24 +809,24 @@ enum {
* error. In this case a number < 0 is returned as well. * error. In this case a number < 0 is returned as well.
* In any case, it is the duty of the caller to remove files once they are * In any case, it is the duty of the caller to remove files once they are
* no longer required. */ * no longer required. */
CIVETWEB_API int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_form_data_handler *fdh); LIBHTTP_API int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_form_data_handler *fdh);
/* Convenience function -- create detached thread. /* Convenience function -- create detached thread.
Return: 0 on success, non-0 on error. */ Return: 0 on success, non-0 on error. */
typedef void *(*httplib_thread_func_t)(void *); typedef void *(*httplib_thread_func_t)(void *);
CIVETWEB_API int httplib_start_thread(httplib_thread_func_t f, void *p); LIBHTTP_API int httplib_start_thread(httplib_thread_func_t f, void *p);
CIVETWEB_API const char * httplib_get_builtin_mime_type( const char *file_name ); LIBHTTP_API const char * httplib_get_builtin_mime_type( const char *file_name );
/* Get text representation of HTTP status code. */ /* Get text representation of HTTP status code. */
CIVETWEB_API const char *httplib_get_response_code_text(struct httplib_connection *conn, int response_code); LIBHTTP_API const char *httplib_get_response_code_text(struct httplib_connection *conn, int response_code);
/* Return LibHTTP version. */ /* Return LibHTTP version. */
CIVETWEB_API const char *httplib_version(void); LIBHTTP_API const char *httplib_version(void);
/* URL-decode input buffer into destination buffer. /* URL-decode input buffer into destination buffer.
@@ -767,13 +835,13 @@ CIVETWEB_API const char *httplib_version(void);
uses '+' as character for space, see RFC 1866 section 8.2.1 uses '+' as character for space, see RFC 1866 section 8.2.1
http://ftp.ics.uci.edu/pub/ietf/html/rfc1866.txt http://ftp.ics.uci.edu/pub/ietf/html/rfc1866.txt
Return: length of the decoded data, or -1 if dst buffer is too small. */ Return: length of the decoded data, or -1 if dst buffer is too small. */
CIVETWEB_API int httplib_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded); LIBHTTP_API int httplib_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded);
/* URL-encode input buffer into destination buffer. /* URL-encode input buffer into destination buffer.
returns the length of the resulting buffer or -1 returns the length of the resulting buffer or -1
is the buffer is too small. */ is the buffer is too small. */
CIVETWEB_API int httplib_url_encode(const char *src, char *dst, size_t dst_len); LIBHTTP_API int httplib_url_encode(const char *src, char *dst, size_t dst_len);
/* MD5 hash given strings. /* MD5 hash given strings.
@@ -782,7 +850,7 @@ CIVETWEB_API int httplib_url_encode(const char *src, char *dst, size_t dst_len);
MD5 hash. Example: MD5 hash. Example:
char buf[33]; char buf[33];
httplib_md5(buf, "aa", "bb", NULL); */ httplib_md5(buf, "aa", "bb", NULL); */
CIVETWEB_API char *httplib_md5(char buf[33], ...); LIBHTTP_API char *httplib_md5(char buf[33], ...);
/* Print error message to the opened error log stream. /* Print error message to the opened error log stream.
@@ -792,12 +860,12 @@ CIVETWEB_API char *httplib_md5(char buf[33], ...);
...: variable argument list ...: variable argument list
Example: Example:
httplib_cry(conn,"i like %s", "logging"); */ httplib_cry(conn,"i like %s", "logging"); */
CIVETWEB_API void httplib_cry(const struct httplib_connection *conn, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3); LIBHTTP_API void httplib_cry(const struct httplib_connection *conn, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
/* utility methods to compare two buffers, case insensitive. */ /* utility methods to compare two buffers, case insensitive. */
CIVETWEB_API int httplib_strcasecmp(const char *s1, const char *s2); LIBHTTP_API int httplib_strcasecmp(const char *s1, const char *s2);
CIVETWEB_API int httplib_strncasecmp(const char *s1, const char *s2, size_t len); LIBHTTP_API int httplib_strncasecmp(const char *s1, const char *s2, size_t len);
/* Connect to a websocket as a client /* Connect to a websocket as a client
@@ -818,7 +886,7 @@ CIVETWEB_API int httplib_strncasecmp(const char *s1, const char *s2, size_t len)
On success, valid httplib_connection object. On success, valid httplib_connection object.
On error, NULL. Se error_buffer for details. On error, NULL. Se error_buffer for details.
*/ */
CIVETWEB_API struct httplib_connection * LIBHTTP_API struct httplib_connection *
httplib_connect_websocket_client(const char *host, httplib_connect_websocket_client(const char *host,
int port, int port,
int use_ssl, int use_ssl,
@@ -843,7 +911,7 @@ httplib_connect_websocket_client(const char *host,
On success, valid httplib_connection object. On success, valid httplib_connection object.
On error, NULL. Se error_buffer for details. On error, NULL. Se error_buffer for details.
*/ */
CIVETWEB_API struct httplib_connection *httplib_connect_client(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size); LIBHTTP_API struct httplib_connection *httplib_connect_client(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size);
struct httplib_client_options { struct httplib_client_options {
@@ -855,7 +923,7 @@ struct httplib_client_options {
}; };
CIVETWEB_API struct httplib_connection * LIBHTTP_API struct httplib_connection *
httplib_connect_client_secure(const struct httplib_client_options *client_options, char *error_buffer, size_t error_buffer_size); httplib_connect_client_secure(const struct httplib_client_options *client_options, char *error_buffer, size_t error_buffer_size);
@@ -873,7 +941,7 @@ enum { TIMEOUT_INFINITE = -1 };
On success, >= 0 On success, >= 0
On error/timeout, < 0 On error/timeout, < 0
*/ */
CIVETWEB_API int httplib_get_response(struct httplib_connection *conn, char *ebuf, size_t ebuf_len, int timeout); LIBHTTP_API int httplib_get_response(struct httplib_connection *conn, char *ebuf, size_t ebuf_len, int timeout);
/* Check which features where set when LibHTTP has been compiled. /* Check which features where set when LibHTTP has been compiled.
@@ -891,11 +959,17 @@ CIVETWEB_API int httplib_get_response(struct httplib_connection *conn, char *ebu
If feature is available > 0 If feature is available > 0
If feature is not available = 0 If feature is not available = 0
*/ */
CIVETWEB_API unsigned httplib_check_feature(unsigned feature); LIBHTTP_API unsigned httplib_check_feature(unsigned feature);
LIBHTTP_API int httplib_closedir( DIR *dir );
LIBHTTP_API int httplib_kill( pid_t pid, int sig_num );
LIBHTTP_API int httplib_mkdir( const char *path, int mode );
LIBHTTP_API DIR * httplib_opendir( const char *name );
LIBHTTP_API int httplib_poll( struct pollfd *pfd, unsigned int n, int milliseconds );
LIBHTTP_API struct dirent * httplib_readdir( DIR *dir );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* CIVETWEB_HEADER_INCLUDED */ #endif /* LIBHTTP_HEADER_INCLUDED */

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ===========
* Release 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,29 +20,47 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 2.0
*/ */
#include "httplib_main.h" #include "httplib_main.h"
#include "httplib_memory.h" #include "httplib_memory.h"
/*
* int httplib_closedir( DIR *dir );
*
* The function httplib_closedir() closes a previously opened directory. On
* systems which support Posix, this is done with a call to the closedir()
* system fuction. Otherwise the function is emulated.
*/
LIBHTTP_API int httplib_closedir( DIR *dir ) {
#if defined(_WIN32) #if defined(_WIN32)
int XX_httplib_closedir( DIR *dir ) { int result;
int result = 0; result = 0;
if (dir != NULL) { if ( dir != NULL ) {
if (dir->handle != INVALID_HANDLE_VALUE)
result = FindClose(dir->handle) ? 0 : -1; if ( dir->handle != INVALID_HANDLE_VALUE ) result = ( FindClose( dir->handle ) ) ? 0 : -1;
XX_httplib_free( dir );
}
else {
XX_httplib_free(dir);
} else {
result = -1; result = -1;
SetLastError(ERROR_BAD_ARGUMENTS); SetLastError( ERROR_BAD_ARGUMENTS );
} }
return result; return result;
} /* XX_httplib_closedir */ #else /* _WIN32 */
#endif /* _WIN32 */ return closedir( dir );
#endif /* _WIN32 */
} /* httplib_closedir */

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"
@@ -40,7 +43,7 @@ static struct httplib_connection * httplib_connect_client_impl( const struct htt
* information, or NULL if an error occured. * information, or NULL if an error occured.
*/ */
CIVETWEB_API struct httplib_connection *httplib_connect_client_secure( const struct httplib_client_options *client_options, char *error_buffer, size_t error_buffer_size ) { LIBHTTP_API struct httplib_connection *httplib_connect_client_secure( const struct httplib_client_options *client_options, char *error_buffer, size_t error_buffer_size ) {
return httplib_connect_client_impl( client_options, 1, error_buffer, error_buffer_size ); return httplib_connect_client_impl( client_options, 1, error_buffer, error_buffer_size );

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ===========
* Release 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -18,6 +18,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 2.0
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"
@@ -239,7 +242,7 @@ done:
XX_httplib_free(blk.buf); XX_httplib_free(blk.buf);
if (pid != (pid_t)-1) { if (pid != (pid_t)-1) {
XX_httplib_kill(pid, SIGKILL); httplib_kill( pid, SIGKILL );
#if !defined(_WIN32) #if !defined(_WIN32)
{ {
int st; int st;

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -19,6 +19,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

53
src/httplib_kill.c Normal file
View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2016 Lammert Bies
* Copyright (c) 2013-2016 the Civetweb developers
* Copyright (c) 2004-2013 Sergey Lyubka
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ============
* Release: 2.0
*/
#include "httplib_main.h"
/*
* int httplib_kill( pid_t pid, int sig_num );
*
* The functopn httplib_kill() can be used to terminate a process. The function
* is a wrapper around the Posix kill() function if Posix is supported on the
* platform, or an alternative implementation on other operating systems.
*/
LIBHTTP_API int httplib_kill( pid_t pid, int sig_num ) {
#if defined(_WIN32)
TerminateProcess( (HANDLE)pid, (UINT)sig_num );
CloseHandle( (HANDLE)pid );
return 0;
#else /* _WIN32 */
return kill( pid, sig_num );
#endif
} /* httplib_kill */

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -24,37 +24,52 @@
#ifndef UNUSED_PARAMETER
#define UNUSED_PARAMETER(x) (void)(x)
#endif /* UNUSED_PARAMETER */
#if defined(_WIN32) #if defined(_WIN32)
#if !defined(_CRT_SECURE_NO_WARNINGS) #if !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005 */ #define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005 */
#endif #endif /* _CRT_SECURE_NO_WARNINGS */
#ifndef _WIN32_WINNT /* defined for tdm-gcc so we can use getnameinfo */ #ifndef _WIN32_WINNT /* defined for tdm-gcc so we can use getnameinfo */
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501
#endif #endif /* _WIN32_WINNT */
#else
#else /* _WIN32 */
#if defined(__GNUC__) && !defined(_GNU_SOURCE) #if defined(__GNUC__) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE /* for setgroups() */ #define _GNU_SOURCE /* for setgroups() */
#endif #endif /* __GNUC__ && ! _GNU_SOURCE */
#if defined(__linux__) && !defined(_XOPEN_SOURCE) #if defined(__linux__) && !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE 600 /* For flockfile() on Linux */ #define _XOPEN_SOURCE 600 /* For flockfile() on Linux */
#endif #endif /* __linux__ && ! _XOPEN_SOURCE */
#ifndef _LARGEFILE_SOURCE #ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE /* For fseeko(), ftello() */ #define _LARGEFILE_SOURCE /* For fseeko(), ftello() */
#endif #endif /* _LARGEFILE_SOURCE */
#ifndef _FILE_OFFSET_BITS #ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ #define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */
#endif #endif /* _FILE_OFFSET_BITS */
#ifndef __STDC_FORMAT_MACROS #ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ #define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */
#endif #endif /* __STDC_FORMAT_MACROS */
#ifndef __STDC_LIMIT_MACROS #ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ #define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */
#endif #endif /* __STDC_LIMIT_MACROS */
#ifdef __sun #ifdef __sun
#define __EXTENSIONS__ /* to expose flockfile and friends in stdio.h */ #define __EXTENSIONS__ /* to expose flockfile and friends in stdio.h */
#define __inline inline /* not recognized on older compiler versions */ #define __inline inline /* not recognized on older compiler versions */
#endif #endif /* __sun */
#endif #endif /* _WIN32 */
#if defined(_MSC_VER) #if defined(_MSC_VER)
/* 'type cast' : conversion from 'int' to 'HANDLE' of greater size */ /* 'type cast' : conversion from 'int' to 'HANDLE' of greater size */
@@ -66,7 +81,7 @@
#pragma warning(disable : 4820) #pragma warning(disable : 4820)
/* not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */ /* not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
#pragma warning(disable : 4668) #pragma warning(disable : 4668)
#endif #endif /* _MSC_VER */
/* This code uses static_assert to check some conditions. /* This code uses static_assert to check some conditions.
@@ -78,11 +93,10 @@
#define httplib_static_assert static_assert #define httplib_static_assert static_assert
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define httplib_static_assert _Static_assert #define httplib_static_assert _Static_assert
#else #else /* _MSC_VER && _MSC_VER >= 1600 */
char static_assert_replacement[1]; char static_assert_replacement[1];
#define httplib_static_assert(cond, txt) \ #define httplib_static_assert(cond, txt) extern char static_assert_replacement[(cond) ? 1 : -1]
extern char static_assert_replacement[(cond) ? 1 : -1] #endif /* _MSC_VER && _MSC_VER >= 1600 */
#endif
httplib_static_assert(sizeof(int) == 4 || sizeof(int) == 8, "int data type size check"); httplib_static_assert(sizeof(int) == 4 || sizeof(int) == 8, "int data type size check");
httplib_static_assert(sizeof(void *) == 4 || sizeof(void *) == 8, "pointer data type size check"); httplib_static_assert(sizeof(void *) == 4 || sizeof(void *) == 8, "pointer data type size check");
@@ -92,7 +106,7 @@ httplib_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
/* DTL -- including winsock2.h works better if lean and mean */ /* DTL -- including winsock2.h works better if lean and mean */
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif /* WIN32_LEAN_AND_MEAN */
/* Include the header file here, so the LibHTTP interface is defined for the /* Include the header file here, so the LibHTTP interface is defined for the
* entire implementation, including the following forward definitions. */ * entire implementation, including the following forward definitions. */
@@ -104,7 +118,7 @@ httplib_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
#ifndef IGNORE_UNUSED_RESULT #ifndef IGNORE_UNUSED_RESULT
#define IGNORE_UNUSED_RESULT(a) ((void)((a) && 1)) #define IGNORE_UNUSED_RESULT(a) ((void)((a) && 1))
#endif #endif /* IGNORE_UNUSED_RESULT */
#ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */ #ifndef _WIN32_WCE /* Some ANSI #includes are not available on Windows CE */
#include <sys/types.h> #include <sys/types.h>
@@ -140,7 +154,7 @@ httplib_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
#ifndef MAX_WORKER_THREADS #ifndef MAX_WORKER_THREADS
#define MAX_WORKER_THREADS (1024 * 64) #define MAX_WORKER_THREADS (1024 * 64)
#endif #endif /* MAX_WORKER_THREADS */
#define SHUTDOWN_RD (0) #define SHUTDOWN_RD (0)
#define SHUTDOWN_WR (1) #define SHUTDOWN_WR (1)
@@ -155,14 +169,6 @@ httplib_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
typedef const char *SOCK_OPT_TYPE; typedef const char *SOCK_OPT_TYPE;
#if !defined(PATH_MAX)
#define PATH_MAX (MAX_PATH)
#endif /* PATH_MAX */
#if !defined(PATH_MAX)
#define PATH_MAX (4096)
#endif /* PATH_MAX */
httplib_static_assert(PATH_MAX >= 1, "path length must be a positive number"); httplib_static_assert(PATH_MAX >= 1, "path length must be a positive number");
#ifndef _IN_PORT_T #ifndef _IN_PORT_T
@@ -202,11 +208,11 @@ typedef long off_t;
#define __func__ __FILE__ ":" STR(__LINE__) #define __func__ __FILE__ ":" STR(__LINE__)
#define strtoull(x, y, z) ((unsigned __int64)_atoi64(x)) #define strtoull(x, y, z) ((unsigned __int64)_atoi64(x))
#define strtoll(x, y, z) (_atoi64(x)) #define strtoll(x, y, z) (_atoi64(x))
#else #else /* _MSC_VER < 1300 */
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
#define strtoull(x, y, z) (_strtoui64(x, y, z)) #define strtoull(x, y, z) (_strtoui64(x, y, z))
#define strtoll(x, y, z) (_strtoi64(x, y, z)) #define strtoll(x, y, z) (_strtoi64(x, y, z))
#endif #endif /* _MSC_VER < 1300 */
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#define ERRNO ((int)(GetLastError())) #define ERRNO ((int)(GetLastError()))
@@ -215,18 +221,20 @@ typedef long off_t;
#if defined(_WIN64) || defined(__MINGW64__) #if defined(_WIN64) || defined(__MINGW64__)
#define SSL_LIB "ssleay64.dll" #define SSL_LIB "ssleay64.dll"
#define CRYPTO_LIB "libeay64.dll" #define CRYPTO_LIB "libeay64.dll"
#else #else /* _WIN64 || __MINGW64__ */
#define SSL_LIB "ssleay32.dll" #define SSL_LIB "ssleay32.dll"
#define CRYPTO_LIB "libeay32.dll" #define CRYPTO_LIB "libeay32.dll"
#endif #endif /* _WIN64 || __MINGW64__ */
#define O_NONBLOCK (0) #define O_NONBLOCK (0)
#ifndef W_OK #ifndef W_OK
#define W_OK (2) /* http://msdn.microsoft.com/en-us/library/1w06ktdy.aspx */ #define W_OK (2) /* http://msdn.microsoft.com/en-us/library/1w06ktdy.aspx */
#endif #endif /* W_OK */
#if !defined(EWOULDBLOCK) #if !defined(EWOULDBLOCK)
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#endif /* !EWOULDBLOCK */ #endif /* !EWOULDBLOCK */
#define _POSIX_ #define _POSIX_
#define INT64_FMT "I64d" #define INT64_FMT "I64d"
#define UINT64_FMT "I64u" #define UINT64_FMT "I64u"
@@ -239,10 +247,12 @@ typedef long off_t;
#define pipe(x) _pipe(x, MG_BUF_LEN, _O_BINARY) #define pipe(x) _pipe(x, MG_BUF_LEN, _O_BINARY)
#ifndef popen #ifndef popen
#define popen(x, y) (_popen(x, y)) #define popen(x, y) (_popen(x, y))
#endif #endif /* popen */
#ifndef pclose #ifndef pclose
#define pclose(x) (_pclose(x)) #define pclose(x) (_pclose(x))
#endif #endif /* pclose */
#define close(x) (_close(x)) #define close(x) (_close(x))
#define dlsym(x, y) (GetProcAddress((HINSTANCE)(x), (y))) #define dlsym(x, y) (GetProcAddress((HINSTANCE)(x), (y)))
#define RTLD_LAZY (0) #define RTLD_LAZY (0)
@@ -270,59 +280,39 @@ typedef struct {
#ifndef __clockid_t_defined #ifndef __clockid_t_defined
typedef DWORD clockid_t; typedef DWORD clockid_t;
#endif #endif /* __clockid_t_defined */
#ifndef CLOCK_MONOTONIC #ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (1) #define CLOCK_MONOTONIC (1)
#endif #endif /* CLOCK_MONOTONIC */
#ifndef CLOCK_REALTIME #ifndef CLOCK_REALTIME
#define CLOCK_REALTIME (2) #define CLOCK_REALTIME (2)
#endif #endif /* CLOCK_REALTIME */
#if defined(_MSC_VER) && (_MSC_VER >= 1900) #if defined(_MSC_VER) && (_MSC_VER >= 1900)
#define _TIMESPEC_DEFINED #define _TIMESPEC_DEFINED
#endif #endif /* _MSC_VER && _MSC_VER >= 1900 */
#ifndef _TIMESPEC_DEFINED #ifndef _TIMESPEC_DEFINED
struct timespec { struct timespec {
time_t tv_sec; /* seconds */ time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */ long tv_nsec; /* nanoseconds */
}; };
#endif #endif /* _TIMESPEC_DEFINED */
#define pid_t HANDLE /* MINGW typedefs pid_t to int. Using #define here. */ #define pid_t HANDLE /* MINGW typedefs pid_t to int. Using #define here. */
/* POSIX dirent interface */
struct dirent {
char d_name[PATH_MAX];
};
typedef struct DIR {
HANDLE handle;
WIN32_FIND_DATAW info;
struct dirent result;
} DIR;
#if defined(_WIN32) && !defined(POLLIN)
#ifndef HAVE_POLL
struct pollfd {
SOCKET fd;
short events;
short revents;
};
#define POLLIN (0x0300)
#endif
#endif
/* Mark required libraries */ /* Mark required libraries */
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "Ws2_32.lib")
#endif #endif /* _MSC_VER */
#else /* defined(_WIN32) - \ #else /* defined(_WIN32) - \
WINDOWS / UNIX include block */ WINDOWS / UNIX include block */
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/poll.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/time.h> #include <sys/time.h>
@@ -361,11 +351,7 @@ typedef unsigned short int in_port_t;
#define O_BINARY (0) #define O_BINARY (0)
#endif /* O_BINARY */ #endif /* O_BINARY */
#define closesocket(a) (close(a)) #define closesocket(a) (close(a))
#define httplib_mkdir(conn, path, mode) (mkdir(path, mode))
#define httplib_sleep(x) (usleep((x)*1000)) #define httplib_sleep(x) (usleep((x)*1000))
#define httplib_opendir(conn, x) (opendir(x))
#define httplib_closedir(x) (closedir(x))
#define httplib_readdir(x) (readdir(x))
#define ERRNO (errno) #define ERRNO (errno)
#define INVALID_SOCKET (-1) #define INVALID_SOCKET (-1)
#define INT64_FMT PRId64 #define INT64_FMT PRId64
@@ -799,9 +785,7 @@ typedef int socklen_t;
#define _DARWIN_UNLIMITED_SELECT #define _DARWIN_UNLIMITED_SELECT
#if defined(_WIN32) #if defined(_WIN32)
#define SIGKILL (0)
int clock_gettime( clockid_t clk_id, struct timespec *tp ); int clock_gettime( clockid_t clk_id, struct timespec *tp );
int poll( struct pollfd *pfd, unsigned int n, int milliseconds );
#endif #endif
@@ -818,7 +802,6 @@ int XX_httplib_check_authorization( struct httplib_connection *conn, const cha
int XX_httplib_check_password( const char *method, const char *ha1, const char *uri, const char *nonce, const char *nc, const char *cnonce, const char *qop, const char *response ); int XX_httplib_check_password( const char *method, const char *ha1, const char *uri, const char *nonce, const char *nc, const char *cnonce, const char *qop, const char *response );
void XX_httplib_close_all_listening_sockets( struct httplib_context *ctx ); void XX_httplib_close_all_listening_sockets( struct httplib_context *ctx );
void XX_httplib_close_connection( struct httplib_connection *conn ); void XX_httplib_close_connection( struct httplib_connection *conn );
int XX_httplib_closedir( DIR *dir );
void XX_httplib_close_socket_gracefully( struct httplib_connection *conn ); void XX_httplib_close_socket_gracefully( struct httplib_connection *conn );
int WINCDECL XX_httplib_compare_dir_entries( const void *p1, const void *p2 ); int WINCDECL XX_httplib_compare_dir_entries( const void *p1, const void *p2 );
int XX_httplib_connect_socket( struct httplib_context *ctx, const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, SOCKET *sock, union usa *sa ); int XX_httplib_connect_socket( struct httplib_context *ctx, const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, SOCKET *sock, union usa *sa );
@@ -864,23 +847,20 @@ bool XX_httplib_is_valid_http_method( const char *method );
int XX_httplib_is_valid_port( unsigned long port ); int XX_httplib_is_valid_port( unsigned long port );
int XX_httplib_is_websocket_protocol( const struct httplib_connection *conn ); int XX_httplib_is_websocket_protocol( const struct httplib_connection *conn );
int XX_httplib_join_thread( pthread_t threadid ); int XX_httplib_join_thread( pthread_t threadid );
int XX_httplib_kill( pid_t pid, int sig_num );
void * XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw ); void * XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw );
void XX_httplib_log_access( const struct httplib_connection *conn ); void XX_httplib_log_access( const struct httplib_connection *conn );
int XX_httplib_match_prefix(const char *pattern, size_t pattern_len, const char *str); int XX_httplib_match_prefix(const char *pattern, size_t pattern_len, const char *str);
void XX_httplib_mkcol( struct httplib_connection *conn, const char *path ); void XX_httplib_mkcol( struct httplib_connection *conn, const char *path );
int XX_httplib_mkdir( const struct httplib_connection *conn, const char *path, int mode );
int XX_httplib_must_hide_file( struct httplib_connection *conn, const char *path ); int XX_httplib_must_hide_file( struct httplib_connection *conn, const char *path );
const char * XX_httplib_next_option( const char *list, struct vec *val, struct vec *eq_val ); const char * XX_httplib_next_option( const char *list, struct vec *val, struct vec *eq_val );
void XX_httplib_open_auth_file( struct httplib_connection *conn, const char *path, struct file *filep ); void XX_httplib_open_auth_file( struct httplib_connection *conn, const char *path, struct file *filep );
DIR * XX_httplib_opendir( const struct httplib_connection *conn, const char *name );
int XX_httplib_parse_auth_header( struct httplib_connection *conn, char *buf, size_t buf_size, struct ah *ah ); int XX_httplib_parse_auth_header( struct httplib_connection *conn, char *buf, size_t buf_size, struct ah *ah );
time_t XX_httplib_parse_date_string( const char *datetime ); time_t XX_httplib_parse_date_string( const char *datetime );
int XX_httplib_parse_http_headers( char **buf, struct httplib_request_info *ri ); int XX_httplib_parse_http_headers( char **buf, struct httplib_request_info *ri );
int XX_httplib_parse_http_message( char *buf, int len, struct httplib_request_info *ri ); int XX_httplib_parse_http_message( char *buf, int len, struct httplib_request_info *ri );
int XX_httplib_parse_net( const char *spec, uint32_t *net, uint32_t *mask ); int XX_httplib_parse_net( const char *spec, uint32_t *net, uint32_t *mask );
int XX_httplib_parse_range_header( const char *header, int64_t *a, int64_t *b ); int XX_httplib_parse_range_header( const char *header, int64_t *a, int64_t *b );
void XX_httplib_path_to_unicode( const struct httplib_connection *conn, const char *path, wchar_t *wbuf, size_t wbuf_len ); void XX_httplib_path_to_unicode( const char *path, wchar_t *wbuf, size_t wbuf_len );
void XX_httplib_prepare_cgi_environment( struct httplib_connection *conn, const char *prog, struct cgi_environment *env ); void XX_httplib_prepare_cgi_environment( struct httplib_connection *conn, const char *prog, struct cgi_environment *env );
void XX_httplib_print_dir_entry( struct de *de ); void XX_httplib_print_dir_entry( struct de *de );
void XX_httplib_process_new_connection( struct httplib_connection *conn ); void XX_httplib_process_new_connection( struct httplib_connection *conn );
@@ -893,7 +873,6 @@ void XX_httplib_put_file( struct httplib_connection *conn, const char *path );
int XX_httplib_read_auth_file( struct file *filep, struct read_auth_file_struct *workdata ); int XX_httplib_read_auth_file( struct file *filep, struct read_auth_file_struct *workdata );
int XX_httplib_read_request( FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread ); int XX_httplib_read_request( FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread );
void XX_httplib_read_websocket( struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *callback_data ); void XX_httplib_read_websocket( struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *callback_data );
struct dirent * XX_httplib_readdir( DIR *dir );
void XX_httplib_redirect_to_https_port( struct httplib_connection *conn, int ssl_index ); void XX_httplib_redirect_to_https_port( struct httplib_connection *conn, int ssl_index );
int XX_httplib_refresh_trust( struct httplib_connection *conn ); int XX_httplib_refresh_trust( struct httplib_connection *conn );
int XX_httplib_remove( const struct httplib_connection *conn, const char *path ); int XX_httplib_remove( const struct httplib_connection *conn, const char *path );

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"

View File

@@ -20,6 +20,9 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 1.8
*/ */
#include "httplib_main.h" #include "httplib_main.h"
@@ -64,7 +67,7 @@ void XX_httplib_mkcol( struct httplib_connection *conn, const char *path ) {
return; return;
} }
rc = XX_httplib_mkdir( conn, path, 0755 ); rc = httplib_mkdir( path, 0755 );
if ( rc == 0 ) { if ( rc == 0 ) {

View File

@@ -20,20 +20,39 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*
* ============
* Release: 2.0
*/ */
#if ! defined(_WIN32)
#include <sys/stat.h>
#endif /* ! _WIN32 */
#include "httplib_main.h" #include "httplib_main.h"
#if defined(_WIN32) /*
* int httplib_mkdir( const char *path, int mode );
*
* The function httplib_mkdir() creates a directory. On a Posix compliant
* system the underlying system call mkdir() is used for this. For systems
* without mkdir support an emulation function is used with the same
* functionality.
*/
int XX_httplib_mkdir( const struct httplib_connection *conn, const char *path, int mode ) { LIBHTTP_API int httplib_mkdir( const char *path, int mode ) {
#if defined(_WIN32)
wchar_t wbuf[PATH_MAX]; wchar_t wbuf[PATH_MAX];
(void)mode; XX_httplib_path_to_unicode( path, wbuf, ARRAY_SIZE(wbuf) );
XX_httplib_path_to_unicode(conn, path, wbuf, ARRAY_SIZE(wbuf)); return ( CreateDirectoryW( wbuf, NULL ) ) ? 0 : -1;
return CreateDirectoryW(wbuf, NULL) ? 0 : -1;
} /* XX_httplib_mkdir */ #else /* _WIN32 */
#endif /* _WIN32 */ return mkdir( path, mode );
#endif
} /* httplib_mkdir */

Some files were not shown because too many files have changed in this diff Show More