mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-09 03:22:45 +03:00
Replaced httplib_context with lh_ctx_t
This commit is contained in:
@@ -145,7 +145,7 @@ struct pollfd {
|
|||||||
#endif /* _WIN32 && ! POLLIN */
|
#endif /* _WIN32 && ! POLLIN */
|
||||||
|
|
||||||
|
|
||||||
struct httplib_context; /* Handle for the HTTP service itself */
|
struct lh_ctx_t; /* Handle for the HTTP service itself */
|
||||||
struct httplib_connection; /* Handle for the individual connection */
|
struct httplib_connection; /* Handle for the individual connection */
|
||||||
|
|
||||||
|
|
||||||
@@ -192,18 +192,18 @@ struct client_cert {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_callbacks {
|
struct httplib_callbacks {
|
||||||
int (*begin_request)( const struct httplib_context *ctx, struct httplib_connection *conn );
|
int (*begin_request)( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
void (*end_request)( const struct httplib_context *ctx, const struct httplib_connection *conn, int reply_status_code );
|
void (*end_request)( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, int reply_status_code );
|
||||||
int (*log_message)( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *message );
|
int (*log_message)( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *message );
|
||||||
int (*log_access)( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *message );
|
int (*log_access)( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *message );
|
||||||
int (*init_ssl)( const struct httplib_context *ctx, void *ssl_context, void *user_data );
|
int (*init_ssl)( const struct lh_ctx_t *ctx, void *ssl_context, void *user_data );
|
||||||
void (*connection_close)( const struct httplib_context *ctx, const struct httplib_connection *conn );
|
void (*connection_close)( const struct lh_ctx_t *ctx, const struct httplib_connection *conn );
|
||||||
const char * (*open_file)( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, size_t *data_len );
|
const char * (*open_file)( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, size_t *data_len );
|
||||||
void (*init_lua)( const struct httplib_context *ctx, const struct httplib_connection *conn, void *lua_context );
|
void (*init_lua)( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, void *lua_context );
|
||||||
int (*http_error)( const struct httplib_context *ctx, struct httplib_connection *, int status);
|
int (*http_error)( const struct lh_ctx_t *ctx, struct httplib_connection *, int status);
|
||||||
void (*init_context)( const struct httplib_context *ctx );
|
void (*init_context)( const struct lh_ctx_t *ctx );
|
||||||
void (*init_thread)( const struct httplib_context *ctx, int thread_type );
|
void (*init_thread)( const struct lh_ctx_t *ctx, int thread_type );
|
||||||
void (*exit_context)( const struct httplib_context *ctx );
|
void (*exit_context)( const struct lh_ctx_t *ctx );
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
@@ -214,8 +214,8 @@ struct httplib_option_t { /* */
|
|||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
typedef int (*httplib_request_handler)( const struct httplib_context *ctx, struct httplib_connection *conn, void *cbdata );
|
typedef int (*httplib_request_handler)( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *cbdata );
|
||||||
typedef int (*httplib_authorization_handler)( const struct httplib_context *ctx, struct httplib_connection *conn, void *cbdata );
|
typedef int (*httplib_authorization_handler)( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *cbdata );
|
||||||
|
|
||||||
|
|
||||||
/* Callback types for websocket handlers in C/C++.
|
/* Callback types for websocket handlers in C/C++.
|
||||||
@@ -243,10 +243,10 @@ typedef int (*httplib_authorization_handler)( const struct httplib_context *ctx,
|
|||||||
|
|
||||||
httplib_connection_close_handler
|
httplib_connection_close_handler
|
||||||
Is called, when the connection is closed.*/
|
Is called, when the connection is closed.*/
|
||||||
typedef int (*httplib_websocket_connect_handler)( const struct httplib_context *ctx, struct httplib_connection *conn, void *);
|
typedef int (*httplib_websocket_connect_handler)( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *);
|
||||||
typedef void (*httplib_websocket_ready_handler)( const struct httplib_context *ctx, struct httplib_connection *conn, void *);
|
typedef void (*httplib_websocket_ready_handler)( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *);
|
||||||
typedef int (*httplib_websocket_data_handler)( const struct httplib_context *ctx, struct httplib_connection *conn, int, char *, size_t, void *);
|
typedef int (*httplib_websocket_data_handler)( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int, char *, size_t, void *);
|
||||||
typedef void (*httplib_websocket_close_handler)( const struct httplib_context *ctx, struct httplib_connection *conn, void *);
|
typedef void (*httplib_websocket_close_handler)( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *);
|
||||||
|
|
||||||
|
|
||||||
/* httplib_set_auth_handler
|
/* httplib_set_auth_handler
|
||||||
@@ -265,7 +265,7 @@ typedef void (*httplib_websocket_close_handler)( const struct httplib_context
|
|||||||
|
|
||||||
|
|
||||||
/* Get user data passed to httplib_start from context. */
|
/* Get user data passed to httplib_start from context. */
|
||||||
LIBHTTP_API void *httplib_get_user_data(const struct httplib_context *ctx);
|
LIBHTTP_API void *httplib_get_user_data(const struct lh_ctx_t *ctx);
|
||||||
|
|
||||||
|
|
||||||
struct httplib_server_ports {
|
struct httplib_server_ports {
|
||||||
@@ -281,7 +281,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. */
|
||||||
LIBHTTP_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 lh_ctx_t *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.
|
||||||
@@ -615,38 +615,38 @@ LIBHTTP_API int httplib_atomic_dec( volatile int *addr );
|
|||||||
LIBHTTP_API int httplib_atomic_inc( volatile int *addr );
|
LIBHTTP_API int httplib_atomic_inc( volatile int *addr );
|
||||||
LIBHTTP_API int httplib_base64_encode( const unsigned char *src, int src_len, char *dst, int dst_len );
|
LIBHTTP_API int httplib_base64_encode( const unsigned char *src, int src_len, char *dst, int dst_len );
|
||||||
LIBHTTP_API unsigned httplib_check_feature( unsigned feature );
|
LIBHTTP_API unsigned httplib_check_feature( unsigned feature );
|
||||||
LIBHTTP_API void httplib_close_connection( struct httplib_context *ctx, struct httplib_connection *conn );
|
LIBHTTP_API void httplib_close_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
LIBHTTP_API int httplib_closedir( DIR *dir );
|
LIBHTTP_API int httplib_closedir( DIR *dir );
|
||||||
LIBHTTP_API struct httplib_connection * httplib_connect_client( struct httplib_context *ctx, const char *host, int port, int use_ssl );
|
LIBHTTP_API struct httplib_connection * httplib_connect_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl );
|
||||||
LIBHTTP_API struct httplib_connection * httplib_connect_client_secure( struct httplib_context *ctx, const struct httplib_client_options *client_options );
|
LIBHTTP_API struct httplib_connection * httplib_connect_client_secure( struct lh_ctx_t *ctx, const struct httplib_client_options *client_options );
|
||||||
LIBHTTP_API struct httplib_connection * httplib_connect_websocket_client( struct httplib_context *ctx, const char *host, int port, int use_ssl, const char *path, const char *origin, httplib_websocket_data_handler data_func, httplib_websocket_close_handler close_func, void *user_data );
|
LIBHTTP_API struct httplib_connection * httplib_connect_websocket_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, const char *path, const char *origin, httplib_websocket_data_handler data_func, httplib_websocket_close_handler close_func, void *user_data );
|
||||||
LIBHTTP_API struct httplib_context * httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options );
|
LIBHTTP_API struct lh_ctx_t * httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options );
|
||||||
LIBHTTP_API void httplib_cry( enum debug_level_t debug_level, const struct httplib_context *ctx, const struct httplib_connection *conn, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(4, 5);
|
LIBHTTP_API void httplib_cry( enum debug_level_t debug_level, const struct lh_ctx_t *ctx, const struct httplib_connection *conn, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(4, 5);
|
||||||
LIBHTTP_API void httplib_destroy_client_context( struct httplib_context *ctx );
|
LIBHTTP_API void httplib_destroy_client_context( struct lh_ctx_t *ctx );
|
||||||
LIBHTTP_API struct httplib_connection * httplib_download( struct httplib_context *ctx, const char *host, int port, int use_ssl, PRINTF_FORMAT_STRING(const char *request_fmt), ...) PRINTF_ARGS(5, 6);
|
LIBHTTP_API struct httplib_connection * httplib_download( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, PRINTF_FORMAT_STRING(const char *request_fmt), ...) PRINTF_ARGS(5, 6);
|
||||||
LIBHTTP_API char * httplib_error_string( int error_code, char *buf, size_t buf_len );
|
LIBHTTP_API char * httplib_error_string( int error_code, char *buf, size_t buf_len );
|
||||||
LIBHTTP_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 );
|
||||||
LIBHTTP_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 );
|
||||||
LIBHTTP_API enum debug_level_t httplib_get_debug_level( struct httplib_context *ctx );
|
LIBHTTP_API enum debug_level_t httplib_get_debug_level( struct lh_ctx_t *ctx );
|
||||||
LIBHTTP_API const char * httplib_get_header( const struct httplib_connection *conn, const char *name );
|
LIBHTTP_API const char * httplib_get_header( const struct httplib_connection *conn, const char *name );
|
||||||
LIBHTTP_API const char * httplib_get_option( const struct httplib_context *ctx, const char *name, char *buffer, size_t buflen );
|
LIBHTTP_API const char * httplib_get_option( const struct lh_ctx_t *ctx, const char *name, char *buffer, size_t buflen );
|
||||||
LIBHTTP_API uint64_t httplib_get_random( void );
|
LIBHTTP_API uint64_t httplib_get_random( void );
|
||||||
LIBHTTP_API int httplib_get_response( const struct httplib_context *ctx, struct httplib_connection *conn, int timeout );
|
LIBHTTP_API int httplib_get_response( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int timeout );
|
||||||
LIBHTTP_API const char * httplib_get_response_code_text( const struct httplib_context *ctx, struct httplib_connection *conn, int response_code );
|
LIBHTTP_API const char * httplib_get_response_code_text( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int response_code );
|
||||||
LIBHTTP_API void * httplib_get_user_connection_data( const struct httplib_connection *conn );
|
LIBHTTP_API void * httplib_get_user_connection_data( const struct httplib_connection *conn );
|
||||||
LIBHTTP_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 );
|
||||||
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 );
|
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 );
|
||||||
LIBHTTP_API struct tm * httplib_gmtime_r( const time_t *clock, struct tm *result );
|
LIBHTTP_API struct tm * httplib_gmtime_r( const time_t *clock, struct tm *result );
|
||||||
LIBHTTP_API int httplib_handle_form_request( const struct httplib_context *ctx, struct httplib_connection *conn, struct httplib_form_data_handler *fdh );
|
LIBHTTP_API int httplib_handle_form_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct httplib_form_data_handler *fdh );
|
||||||
LIBHTTP_API int httplib_kill( pid_t pid, int sig_num );
|
LIBHTTP_API int httplib_kill( pid_t pid, int sig_num );
|
||||||
LIBHTTP_API struct tm * httplib_localtime_r( const time_t *clock, struct tm *result );
|
LIBHTTP_API struct tm * httplib_localtime_r( const time_t *clock, struct tm *result );
|
||||||
LIBHTTP_API void httplib_lock_connection( struct httplib_connection *conn );
|
LIBHTTP_API void httplib_lock_connection( struct httplib_connection *conn );
|
||||||
LIBHTTP_API void httplib_lock_context( struct httplib_context *ctx );
|
LIBHTTP_API void httplib_lock_context( struct lh_ctx_t *ctx );
|
||||||
LIBHTTP_API char * httplib_md5( char buf[33], ... );
|
LIBHTTP_API char * httplib_md5( char buf[33], ... );
|
||||||
LIBHTTP_API int httplib_mkdir( const char *path, int mode );
|
LIBHTTP_API int httplib_mkdir( const char *path, int mode );
|
||||||
LIBHTTP_API DIR * httplib_opendir( const char *name );
|
LIBHTTP_API DIR * httplib_opendir( const char *name );
|
||||||
LIBHTTP_API int httplib_poll( struct pollfd *pfd, unsigned int nfds, int timeout );
|
LIBHTTP_API int httplib_poll( struct pollfd *pfd, unsigned int nfds, int timeout );
|
||||||
LIBHTTP_API int httplib_printf( const struct httplib_context *ctx, struct httplib_connection *, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(3, 4);
|
LIBHTTP_API int httplib_printf( const struct lh_ctx_t *ctx, struct httplib_connection *, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(3, 4);
|
||||||
LIBHTTP_API int httplib_pthread_cond_broadcast( pthread_cond_t *cv );
|
LIBHTTP_API int httplib_pthread_cond_broadcast( pthread_cond_t *cv );
|
||||||
LIBHTTP_API int httplib_pthread_cond_destroy( pthread_cond_t *cv );
|
LIBHTTP_API int httplib_pthread_cond_destroy( pthread_cond_t *cv );
|
||||||
LIBHTTP_API int httplib_pthread_cond_init( pthread_cond_t *cv, const pthread_condattr_t *attr );
|
LIBHTTP_API int httplib_pthread_cond_init( pthread_cond_t *cv, const pthread_condattr_t *attr );
|
||||||
@@ -664,19 +664,19 @@ LIBHTTP_API int httplib_pthread_mutex_trylock( pthread_mutex_t *mutex );
|
|||||||
LIBHTTP_API int httplib_pthread_mutex_unlock( pthread_mutex_t *mutex );
|
LIBHTTP_API int httplib_pthread_mutex_unlock( pthread_mutex_t *mutex );
|
||||||
LIBHTTP_API pthread_t httplib_pthread_self( void );
|
LIBHTTP_API pthread_t httplib_pthread_self( void );
|
||||||
LIBHTTP_API int httplib_pthread_setspecific( pthread_key_t key, void *value );
|
LIBHTTP_API int httplib_pthread_setspecific( pthread_key_t key, void *value );
|
||||||
LIBHTTP_API int httplib_read( const struct httplib_context *ctx, struct httplib_connection *, void *buf, size_t len );
|
LIBHTTP_API int httplib_read( const struct lh_ctx_t *ctx, struct httplib_connection *, void *buf, size_t len );
|
||||||
LIBHTTP_API struct dirent * httplib_readdir( DIR *dir );
|
LIBHTTP_API struct dirent * httplib_readdir( DIR *dir );
|
||||||
LIBHTTP_API int httplib_remove( const char *path );
|
LIBHTTP_API int httplib_remove( const char *path );
|
||||||
LIBHTTP_API void httplib_send_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers );
|
LIBHTTP_API void httplib_send_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers );
|
||||||
LIBHTTP_API void httplib_set_alloc_callback_func( httplib_alloc_callback_func log_func );
|
LIBHTTP_API void httplib_set_alloc_callback_func( httplib_alloc_callback_func log_func );
|
||||||
LIBHTTP_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 lh_ctx_t *ctx, const char *uri, httplib_authorization_handler handler, void *cbdata );
|
||||||
LIBHTTP_API enum debug_level_t httplib_set_debug_level( struct httplib_context *ctx, enum debug_level_t new_level );
|
LIBHTTP_API enum debug_level_t httplib_set_debug_level( struct lh_ctx_t *ctx, enum debug_level_t new_level );
|
||||||
LIBHTTP_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 lh_ctx_t *ctx, const char *uri, httplib_request_handler handler, void *cbdata );
|
||||||
LIBHTTP_API void httplib_set_user_connection_data( struct httplib_connection *conn, void *data );
|
LIBHTTP_API void httplib_set_user_connection_data( struct httplib_connection *conn, void *data );
|
||||||
LIBHTTP_API void httplib_set_websocket_handler( struct httplib_context *ctx, const char *uri, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, void *cbdata );
|
LIBHTTP_API void httplib_set_websocket_handler( struct lh_ctx_t *ctx, const char *uri, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, void *cbdata );
|
||||||
LIBHTTP_API struct httplib_context * httplib_start(const struct httplib_callbacks *callbacks, void *user_data, const struct httplib_option_t *options );
|
LIBHTTP_API struct lh_ctx_t * httplib_start(const struct httplib_callbacks *callbacks, void *user_data, const struct httplib_option_t *options );
|
||||||
LIBHTTP_API void httplib_stop( struct httplib_context *ctx );
|
LIBHTTP_API void httplib_stop( struct lh_ctx_t *ctx );
|
||||||
LIBHTTP_API int64_t httplib_store_body( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
LIBHTTP_API int64_t httplib_store_body( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
LIBHTTP_API int httplib_strcasecmp( const char *s1, const char *s2 );
|
LIBHTTP_API int httplib_strcasecmp( const char *s1, const char *s2 );
|
||||||
LIBHTTP_API const char * httplib_strcasestr( const char *big_str, const char *small_str );
|
LIBHTTP_API const char * httplib_strcasestr( const char *big_str, const char *small_str );
|
||||||
LIBHTTP_API char * httplib_strdup( const char *str );
|
LIBHTTP_API char * httplib_strdup( const char *str );
|
||||||
@@ -686,13 +686,13 @@ LIBHTTP_API char * httplib_strndup( const char *str, size_t len );
|
|||||||
LIBHTTP_API int httplib_system_exit( void );
|
LIBHTTP_API int httplib_system_exit( void );
|
||||||
LIBHTTP_API int httplib_system_init( void );
|
LIBHTTP_API int httplib_system_init( void );
|
||||||
LIBHTTP_API void httplib_unlock_connection( struct httplib_connection *conn );
|
LIBHTTP_API void httplib_unlock_connection( struct httplib_connection *conn );
|
||||||
LIBHTTP_API void httplib_unlock_context( struct httplib_context *ctx );
|
LIBHTTP_API void httplib_unlock_context( struct lh_ctx_t *ctx );
|
||||||
LIBHTTP_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 );
|
||||||
LIBHTTP_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 );
|
||||||
LIBHTTP_API const char * httplib_version( void );
|
LIBHTTP_API const char * httplib_version( void );
|
||||||
LIBHTTP_API int httplib_websocket_client_write( const struct httplib_context *ctx, struct httplib_connection *conn, int opcode, const char *data, size_t data_len );
|
LIBHTTP_API int httplib_websocket_client_write( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int opcode, const char *data, size_t data_len );
|
||||||
LIBHTTP_API int httplib_websocket_write( const struct httplib_context *ctx, struct httplib_connection *conn, int opcode, const char *data, size_t data_len );
|
LIBHTTP_API int httplib_websocket_write( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int opcode, const char *data, size_t data_len );
|
||||||
LIBHTTP_API int httplib_write( const struct httplib_context *ctx, struct httplib_connection * conn, const void *buf, size_t len );
|
LIBHTTP_API int httplib_write( const struct lh_ctx_t *ctx, struct httplib_connection * conn, const void *buf, size_t len );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -23,14 +23,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct httplib_context *XX_httplib_abort_start( struct httplib_context *ctx, const char *fmt, ... );
|
* struct lh_ctx_t *XX_httplib_abort_start( struct lh_ctx_t *ctx, const char *fmt, ... );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_abort_start() is called to do some cleanup work when
|
* The function XX_httplib_abort_start() is called to do some cleanup work when
|
||||||
* an error occured initializing a context. The function returns NULL which is
|
* an error occured initializing a context. The function returns NULL which is
|
||||||
* then further returned to the calling party.
|
* then further returned to the calling party.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_context *XX_httplib_abort_start( struct httplib_context *ctx, const char *fmt, ... ) {
|
struct lh_ctx_t *XX_httplib_abort_start( struct lh_ctx_t *ctx, const char *fmt, ... ) {
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_ssl.h"
|
#include "httplib_ssl.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_accept_new_connection( const struct socket *lostener, struct httplib_context *ctx );
|
* void XX_httplib_accept_new_connection( const struct socket *lostener, struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_accept_new_connection() is used to process new
|
* The function XX_httplib_accept_new_connection() is used to process new
|
||||||
* incoming connections to the server.
|
* incoming connections to the server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_accept_new_connection( const struct socket *listener, struct httplib_context *ctx ) {
|
void XX_httplib_accept_new_connection( const struct socket *listener, struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
struct socket so;
|
struct socket so;
|
||||||
char src_addr[IP_ADDR_STR_LEN];
|
char src_addr[IP_ADDR_STR_LEN];
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_addenv( const struct httplib_context *ctx, struct cgi_environment *env, const char *fmt, ... );
|
* void XX_httplib_addenv( const struct lh_ctx_t *ctx, struct cgi_environment *env, const char *fmt, ... );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_addenv() adds one item to the environment before
|
* The function XX_httplib_addenv() adds one item to the environment before
|
||||||
* a CGI script is called. The environment variable has the form
|
* a CGI script is called. The environment variable has the form
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
#if !defined(NO_CGI)
|
#if !defined(NO_CGI)
|
||||||
|
|
||||||
void XX_httplib_addenv( const struct httplib_context *ctx, struct cgi_environment *env, const char *fmt, ... ) {
|
void XX_httplib_addenv( const struct lh_ctx_t *ctx, struct cgi_environment *env, const char *fmt, ... ) {
|
||||||
|
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t space;
|
size_t space;
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_authorize( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep );
|
* bool XX_httplib_authorize( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_authorize() authorizes agains the open passwords
|
* The function XX_httplib_authorize() authorizes agains the open passwords
|
||||||
* file. It returns 1 if authorized.
|
* file. It returns 1 if authorized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_authorize( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep ) {
|
bool XX_httplib_authorize( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep ) {
|
||||||
|
|
||||||
struct read_auth_file_struct workdata;
|
struct read_auth_file_struct workdata;
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_check_acl( struct httplib_context *ctx, uint32_t remote_ip );
|
* int XX_httplib_check_acl( struct lh_ctx_t *ctx, uint32_t remote_ip );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_check_acl() is used to check of the socket address
|
* The function XX_httplib_check_acl() is used to check of the socket address
|
||||||
* of a connection is allowed according to the access control list. The
|
* of a connection is allowed according to the access control list. The
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
* allowed and 1 if the address is allowed.
|
* allowed and 1 if the address is allowed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_check_acl( struct httplib_context *ctx, uint32_t remote_ip ) {
|
int XX_httplib_check_acl( struct lh_ctx_t *ctx, uint32_t remote_ip ) {
|
||||||
|
|
||||||
int allowed;
|
int allowed;
|
||||||
int flag;
|
int flag;
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/* Return 1 if request is authorised, 0 otherwise. */
|
/* Return 1 if request is authorised, 0 otherwise. */
|
||||||
bool XX_httplib_check_authorization( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path ) {
|
bool XX_httplib_check_authorization( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path ) {
|
||||||
|
|
||||||
char fname[PATH_MAX];
|
char fname[PATH_MAX];
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_close_all_listening_sockets( struct httplib_context *ctx );
|
* void XX_httplib_close_all_listening_sockets( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_close_all_listening_sockets() closes all listening
|
* The function XX_httplib_close_all_listening_sockets() closes all listening
|
||||||
* sockets of a given context.
|
* sockets of a given context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_close_all_listening_sockets( struct httplib_context *ctx ) {
|
void XX_httplib_close_all_listening_sockets( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@@ -30,13 +30,13 @@
|
|||||||
#include "httplib_ssl.h"
|
#include "httplib_ssl.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_close_connection( struct httplib_context *ctx, struct httplib_connection *conn );
|
* void XX_httplib_close_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_close_connection() is the internal function which
|
* The function XX_httplib_close_connection() is the internal function which
|
||||||
* does the heavy lifting to close a connection.
|
* does the heavy lifting to close a connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_close_connection( struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_close_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
if ( ctx == NULL || conn == NULL ) return;
|
if ( ctx == NULL || conn == NULL ) return;
|
||||||
|
|
||||||
@@ -82,16 +82,16 @@ void XX_httplib_close_connection( struct httplib_context *ctx, struct httplib_co
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_close_connection( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* void httplib_close_connection( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function httplib_close_connection() closes the connection passed as a
|
* The function httplib_close_connection() closes the connection passed as a
|
||||||
* parameter to this function. The function does not return a success or
|
* parameter to this function. The function does not return a success or
|
||||||
* failure value.
|
* failure value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void httplib_close_connection( struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void httplib_close_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
struct httplib_context *client_ctx;
|
struct lh_ctx_t *client_ctx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( ctx == NULL || conn == NULL ) return;
|
if ( ctx == NULL || conn == NULL ) return;
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_close_socket_gracefully( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* void XX_httplib_close_socket_gracefully( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_close_socket_gracefully() closes a socket in a
|
* The function XX_httplib_close_socket_gracefully() closes a socket in a
|
||||||
* graceful way.
|
* graceful way.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_close_socket_gracefully( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_close_socket_gracefully( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
|
@@ -30,30 +30,30 @@
|
|||||||
#include "httplib_ssl.h"
|
#include "httplib_ssl.h"
|
||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
static struct httplib_connection * httplib_connect_client_impl( struct httplib_context *ctx, const struct httplib_client_options *client_options, int use_ssl );
|
static struct httplib_connection * httplib_connect_client_impl( struct lh_ctx_t *ctx, const struct httplib_client_options *client_options, int use_ssl );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct httplib_connection *httplib_connect_client_secure( struct httplib_context_*ctx, const struct httplib_client_options *client options, char *error buffer, size_t error_buffer_size );
|
* struct httplib_connection *httplib_connect_client_secure( struct lh_ctx_t *ctx, const struct httplib_client_options *client options );
|
||||||
*
|
*
|
||||||
* The function httplib_connect_client_secure() creates a secure connection as a
|
* The function httplib_connect_client_secure() creates a secure connection as a
|
||||||
* client to a remote server and returns a pointer to the connection
|
* client to a remote server and returns a pointer to the connection
|
||||||
* information, or NULL if an error occured.
|
* information, or NULL if an error occured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LIBHTTP_API struct httplib_connection *httplib_connect_client_secure( struct httplib_context *ctx, const struct httplib_client_options *client_options ) {
|
LIBHTTP_API struct httplib_connection *httplib_connect_client_secure( struct lh_ctx_t *ctx, const struct httplib_client_options *client_options ) {
|
||||||
|
|
||||||
return httplib_connect_client_impl( ctx, client_options, true );
|
return httplib_connect_client_impl( ctx, client_options, true );
|
||||||
|
|
||||||
} /* httplib_connect_client_secure */
|
} /* httplib_connect_client_secure */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct httplib_connection *httplib_connect_client( struct httplib_context *ctx, const char *host, int port, int use_ssl );
|
* struct httplib_connection *httplib_connect_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl );
|
||||||
*
|
*
|
||||||
* The function httplib_connect_client() connects to a remote server as a client
|
* The function httplib_connect_client() connects to a remote server as a client
|
||||||
* with the options of the connection provided as parameters.
|
* with the options of the connection provided as parameters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_connection *httplib_connect_client( struct httplib_context *ctx, const char *host, int port, int use_ssl ) {
|
struct httplib_connection *httplib_connect_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl ) {
|
||||||
|
|
||||||
struct httplib_client_options opts;
|
struct httplib_client_options opts;
|
||||||
|
|
||||||
@@ -68,13 +68,13 @@ struct httplib_connection *httplib_connect_client( struct httplib_context *ctx,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static struct httplib_connection *httplib_connect_client_impl( struct httplib_context *ctx, const struct httplib_client_options *client_options, int use_ssl );
|
* static struct httplib_connection *httplib_connect_client_impl( struct lh_ctx_t *ctx, const struct httplib_client_options *client_options, int use_ssl );
|
||||||
*
|
*
|
||||||
* The function httplib_connect_client_impl() is the background function doing the
|
* The function httplib_connect_client_impl() is the background function doing the
|
||||||
* heavy lifting to make connections as a client to remote servers.
|
* heavy lifting to make connections as a client to remote servers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct httplib_connection *httplib_connect_client_impl( struct httplib_context *ctx, const struct httplib_client_options *client_options, int use_ssl ) {
|
static struct httplib_connection *httplib_connect_client_impl( struct lh_ctx_t *ctx, const struct httplib_client_options *client_options, int use_ssl ) {
|
||||||
|
|
||||||
struct httplib_connection *conn;
|
struct httplib_connection *conn;
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
* has been established.
|
* has been established.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_connect_socket( struct httplib_context *ctx, const char *host, int port, int use_ssl, SOCKET *sock, union usa *sa ) {
|
bool XX_httplib_connect_socket( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, SOCKET *sock, union usa *sa ) {
|
||||||
|
|
||||||
int ip_ver;
|
int ip_ver;
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
* returned, otherwise NULL.
|
* returned, otherwise NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_connection *httplib_connect_websocket_client( struct httplib_context *ctx, const char *host, int port, int use_ssl, const char *path, const char *origin, httplib_websocket_data_handler data_func, httplib_websocket_close_handler close_func, void *user_data ) {
|
struct httplib_connection *httplib_connect_websocket_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, const char *path, const char *origin, httplib_websocket_data_handler data_func, httplib_websocket_close_handler close_func, void *user_data ) {
|
||||||
|
|
||||||
struct httplib_connection *conn;
|
struct httplib_connection *conn;
|
||||||
struct websocket_client_thread_data *thread_data;
|
struct websocket_client_thread_data *thread_data;
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_construct_etag( const struct httplib_context *ctx, char *buf, size_t buf_len, const struct file *filep );
|
* void XX_httplib_construct_etag( const struct lh_ctx_t *ctx, char *buf, size_t buf_len, const struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_construct_etag() is used to construct an etag which
|
* The function XX_httplib_construct_etag() is used to construct an etag which
|
||||||
* can be used to identify a file on a specific moment.
|
* can be used to identify a file on a specific moment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_construct_etag( const struct httplib_context *ctx, char *buf, size_t buf_len, const struct file *filep ) {
|
void XX_httplib_construct_etag( const struct lh_ctx_t *ctx, char *buf, size_t buf_len, const struct file *filep ) {
|
||||||
|
|
||||||
if ( filep != NULL && buf != NULL && buf_len > 0 ) {
|
if ( filep != NULL && buf != NULL && buf_len > 0 ) {
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#define QUEUE_SIZE(ctx) ((int)(ARRAY_SIZE(ctx->queue)))
|
#define QUEUE_SIZE(ctx) ((int)(ARRAY_SIZE(ctx->queue)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_consume_socket( struct httplib_context *ctx, struct socket *sp, int thread_index );
|
* int XX_httplib_consume_socket( struct lh_ctx_t *ctx, struct socket *sp, int thread_index );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_consume_socket() takes an accepted socket from the
|
* The function XX_httplib_consume_socket() takes an accepted socket from the
|
||||||
* queue for further processing.
|
* queue for further processing.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if defined(ALTERNATIVE_QUEUE)
|
#if defined(ALTERNATIVE_QUEUE)
|
||||||
|
|
||||||
int XX_httplib_consume_socket( struct httplib_context *ctx, struct socket *sp, int thread_index ) {
|
int XX_httplib_consume_socket( struct lh_ctx_t *ctx, struct socket *sp, int thread_index ) {
|
||||||
|
|
||||||
ctx->client_socks[thread_index].in_use = 0;
|
ctx->client_socks[thread_index].in_use = 0;
|
||||||
event_wait( ctx->client_wait_events[thread_index] );
|
event_wait( ctx->client_wait_events[thread_index] );
|
||||||
@@ -52,7 +52,7 @@ int XX_httplib_consume_socket( struct httplib_context *ctx, struct socket *sp, i
|
|||||||
#else /* ALTERNATIVE_QUEUE */
|
#else /* ALTERNATIVE_QUEUE */
|
||||||
|
|
||||||
/* Worker threads take accepted socket from the queue */
|
/* Worker threads take accepted socket from the queue */
|
||||||
int XX_httplib_consume_socket( struct httplib_context *ctx, struct socket *sp, int thread_index ) {
|
int XX_httplib_consume_socket( struct lh_ctx_t *ctx, struct socket *sp, int thread_index ) {
|
||||||
|
|
||||||
UNUSED_PARAMETER(thread_index);
|
UNUSED_PARAMETER(thread_index);
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct httplib_context *httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options );
|
* struct lh_ctx_t *httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options );
|
||||||
*
|
*
|
||||||
* The function httplib_create_client_context() creates a context to be used
|
* The function httplib_create_client_context() creates a context to be used
|
||||||
* for one simultaneous client connection. It is not possible to use one client
|
* for one simultaneous client connection. It is not possible to use one client
|
||||||
@@ -31,13 +31,13 @@
|
|||||||
* contains SSL context information which is specific for one connection.
|
* contains SSL context information which is specific for one connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_context *httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options ) {
|
struct lh_ctx_t *httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options ) {
|
||||||
|
|
||||||
struct httplib_context *ctx;
|
struct lh_ctx_t *ctx;
|
||||||
void (*exit_callback)(const struct httplib_context *ctx);
|
void (*exit_callback)(const struct lh_ctx_t *ctx);
|
||||||
|
|
||||||
exit_callback = NULL;
|
exit_callback = NULL;
|
||||||
ctx = httplib_calloc( 1, sizeof(struct httplib_context) );
|
ctx = httplib_calloc( 1, sizeof(struct lh_ctx_t) );
|
||||||
if ( ctx == NULL ) return NULL;
|
if ( ctx == NULL ) return NULL;
|
||||||
|
|
||||||
if ( callbacks != NULL ) {
|
if ( callbacks != NULL ) {
|
||||||
|
@@ -26,14 +26,14 @@
|
|||||||
#include "httplib_ssl.h"
|
#include "httplib_ssl.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_cry( enum debug_level_t debug_level, const struct httplib_context *ctx, const struct httplib_connection *conn, const char *fmt, ... );
|
* void httplib_cry( enum debug_level_t debug_level, const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *fmt, ... );
|
||||||
*
|
*
|
||||||
* The function httplib_cry() prints a formatted error message to the opened
|
* The function httplib_cry() prints a formatted error message to the opened
|
||||||
* error log stream. It first tries to use a user supplied error handler. If
|
* error log stream. It first tries to use a user supplied error handler. If
|
||||||
* that doesn't work, the alternative is to write to an error log file.
|
* that doesn't work, the alternative is to write to an error log file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void httplib_cry( enum debug_level_t debug_level, const struct httplib_context *ctx, const struct httplib_connection *conn, const char *fmt, ... ) {
|
void httplib_cry( enum debug_level_t debug_level, const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *fmt, ... ) {
|
||||||
|
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
char src_addr[IP_ADDR_STR_LEN];
|
char src_addr[IP_ADDR_STR_LEN];
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_delete_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
* void XX_httplib_delete_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_delete_file() deletes a file after a request over a
|
* The function XX_httplib_delete_file() deletes a file after a request over a
|
||||||
* connection.
|
* connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_delete_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path ) {
|
void XX_httplib_delete_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path ) {
|
||||||
|
|
||||||
struct de de;
|
struct de de;
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -23,14 +23,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_destroy_client_context( struct httplib_context *ctx );
|
* void httplib_destroy_client_context( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function httplib_destroy_client_context() destroys the context for a
|
* The function httplib_destroy_client_context() destroys the context for a
|
||||||
* client connection. This function should not be called for server contexts.
|
* client connection. This function should not be called for server contexts.
|
||||||
* Use httplib_stop() for server contexts instead.
|
* Use httplib_stop() for server contexts instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void httplib_destroy_client_context( struct httplib_context *ctx ) {
|
void httplib_destroy_client_context( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx == NULL ) return;
|
if ( ctx == NULL ) return;
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
void XX_httplib_dir_scan_callback( const struct httplib_context *ctx, struct de *de, void *data ) {
|
void XX_httplib_dir_scan_callback( const struct lh_ctx_t *ctx, struct de *de, void *data ) {
|
||||||
|
|
||||||
struct dir_scan_data *dsd;
|
struct dir_scan_data *dsd;
|
||||||
struct de* old_entries;
|
struct de* old_entries;
|
||||||
|
@@ -28,14 +28,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_discard_unread_request_data( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* void XX_httplib_discard_unread_request_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_discard_unread_request_data() discards any request
|
* The function XX_httplib_discard_unread_request_data() discards any request
|
||||||
* data on a connection which is not further needed but has alread been
|
* data on a connection which is not further needed but has alread been
|
||||||
* received.
|
* received.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_discard_unread_request_data( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_discard_unread_request_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
size_t to_read;
|
size_t to_read;
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
* and returns a pointer to the connection on success, or NULL on error.
|
* and returns a pointer to the connection on success, or NULL on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_connection * httplib_download( struct httplib_context *ctx, const char *host, int port, int use_ssl, const char *fmt, ... ) {
|
struct httplib_connection * httplib_download( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, const char *fmt, ... ) {
|
||||||
|
|
||||||
struct httplib_connection *conn;
|
struct httplib_connection *conn;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
void XX_httplib_fclose_on_exec( const struct httplib_context *ctx, struct file *filep, struct httplib_connection *conn ) {
|
void XX_httplib_fclose_on_exec( const struct lh_ctx_t *ctx, struct file *filep, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
if ( ctx == NULL || filep == NULL || filep->fp == NULL ) return;
|
if ( ctx == NULL || filep == NULL || filep->fp == NULL ) return;
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_fopen( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, const char *mode, struct file *filep );
|
* bool XX_httplib_fopen( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, const char *mode, struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_fopen() can be used to open a file which is either
|
* The function XX_httplib_fopen() can be used to open a file which is either
|
||||||
* in memory or on the disk. The path is in UTF-8 and therefore needs
|
* in memory or on the disk. The path is in UTF-8 and therefore needs
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
* of the same structure (bad cohesion).
|
* of the same structure (bad cohesion).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_fopen( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, const char *mode, struct file *filep ) {
|
bool XX_httplib_fopen( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, const char *mode, struct file *filep ) {
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_forward_body_data( const struct httplib_context *ctx, struct httplib_connection *conn, FILE *fp, SOCKET sock, SSL *ssl );
|
* bool XX_httplib_forward_body_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn, FILE *fp, SOCKET sock, SSL *ssl );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_forward_body_data() forwards body data to the
|
* The function XX_httplib_forward_body_data() forwards body data to the
|
||||||
* client. The function returns true if successful, and false otherwise.
|
* client. The function returns true if successful, and false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_forward_body_data( const struct httplib_context *ctx, struct httplib_connection *conn, FILE *fp, SOCKET sock, SSL *ssl ) {
|
bool XX_httplib_forward_body_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn, FILE *fp, SOCKET sock, SSL *ssl ) {
|
||||||
|
|
||||||
const char *expect;
|
const char *expect;
|
||||||
const char *body;
|
const char *body;
|
||||||
|
@@ -23,13 +23,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_free_config_options( struct htptlib_context *ctx );
|
* void XX_httplib_free_config_options( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_free_config_options() returns all the from the heap
|
* The function XX_httplib_free_config_options() returns all the from the heap
|
||||||
* allocated space to store config options back to the heap.
|
* allocated space to store config options back to the heap.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_free_config_options( struct httplib_context *ctx ) {
|
void XX_httplib_free_config_options( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx == NULL ) return;
|
if ( ctx == NULL ) return;
|
||||||
|
|
||||||
|
@@ -31,13 +31,13 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_free_context( struct httplib_context *ctx );
|
* void XX_httplib_free_context( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_free_context() is used to free the resources
|
* The function XX_httplib_free_context() is used to free the resources
|
||||||
* associated with a context.
|
* associated with a context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_free_context( struct httplib_context *ctx ) {
|
void XX_httplib_free_context( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
struct httplib_handler_info *tmp_rh;
|
struct httplib_handler_info *tmp_rh;
|
||||||
|
|
||||||
|
@@ -23,13 +23,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* enum debug_level_t httplib_get_debug_level( struct httplib_context *ctx );
|
* enum debug_level_t httplib_get_debug_level( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function httplib_get_debug_level() returns the debug level for a
|
* The function httplib_get_debug_level() returns the debug level for a
|
||||||
* context.
|
* context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum debug_level_t httplib_get_debug_level( struct httplib_context *ctx ) {
|
enum debug_level_t httplib_get_debug_level( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx == NULL ) return DEBUG_LEVEL_NONE;
|
if ( ctx == NULL ) return DEBUG_LEVEL_NONE;
|
||||||
return ctx->debug_level;
|
return ctx->debug_level;
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_ssl.h"
|
#include "httplib_ssl.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_get_first_ssl_listener_index( const struct httplib_context *ctx );
|
* int XX_httplib_get_first_ssl_listener_index( const struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_get_first_ssl_listener_index() returns the first
|
* The function XX_httplib_get_first_ssl_listener_index() returns the first
|
||||||
* index of a listening socket where SSL encryption is active.
|
* index of a listening socket where SSL encryption is active.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_get_first_ssl_listener_index( const struct httplib_context *ctx ) {
|
int XX_httplib_get_first_ssl_listener_index( const struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int idx;
|
int idx;
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
/* Look at the "path" extension and figure what mime type it has.
|
/* Look at the "path" extension and figure what mime type it has.
|
||||||
* Store mime type in the vector. */
|
* Store mime type in the vector. */
|
||||||
|
|
||||||
void XX_httplib_get_mime_type( const struct httplib_context *ctx, const char *path, struct vec *vec ) {
|
void XX_httplib_get_mime_type( const struct lh_ctx_t *ctx, const char *path, struct vec *vec ) {
|
||||||
|
|
||||||
struct vec ext_vec;
|
struct vec ext_vec;
|
||||||
struct vec mime_vec;
|
struct vec mime_vec;
|
||||||
|
@@ -27,7 +27,7 @@ static const char * store_int( char *buffer, size_t buflen, int value )
|
|||||||
static const char * store_str( char *buffer, size_t buflen, const char *value );
|
static const char * store_str( char *buffer, size_t buflen, const char *value );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* const char *httplib_get_option( const struct httplib_context *ctx, const char *name, char *buffer, size_t buflen );
|
* const char *httplib_get_option( const struct lh_ctx_t *ctx, const char *name, char *buffer, size_t buflen );
|
||||||
*
|
*
|
||||||
* The function httplib_get_option() returns the content of an option for a
|
* The function httplib_get_option() returns the content of an option for a
|
||||||
* given context. If an error occurs, NULL is returned. If the option is valid
|
* given context. If an error occurs, NULL is returned. If the option is valid
|
||||||
@@ -35,7 +35,7 @@ static const char * store_str( char *buffer, size_t buflen, const char *value )
|
|||||||
* string.
|
* string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *httplib_get_option( const struct httplib_context *ctx, const char *name, char *buffer, size_t buflen ) {
|
const char *httplib_get_option( const struct lh_ctx_t *ctx, const char *name, char *buffer, size_t buflen ) {
|
||||||
|
|
||||||
if ( name == NULL || buffer == NULL || buflen < 1 ) return NULL;
|
if ( name == NULL || buffer == NULL || buflen < 1 ) return NULL;
|
||||||
|
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* const char *XX_httplib_get_rel_url_at_current_server( const struct httplib_context *ctx, const char *uri, const struct httplib_connection *conn );
|
* const char *XX_httplib_get_rel_url_at_current_server( const struct lh_ctx_t *ctx, const char *uri, const struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_get_rel_url_at_current_server() returns the relative
|
* The function XX_httplib_get_rel_url_at_current_server() returns the relative
|
||||||
* uri at the current server.
|
* uri at the current server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *XX_httplib_get_rel_url_at_current_server( const struct httplib_context *ctx, const char *uri, const struct httplib_connection *conn ) {
|
const char *XX_httplib_get_rel_url_at_current_server( const struct lh_ctx_t *ctx, const char *uri, const struct httplib_connection *conn ) {
|
||||||
|
|
||||||
const char *server_domain;
|
const char *server_domain;
|
||||||
size_t server_domain_len;
|
size_t server_domain_len;
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
* and 0 otherwise.
|
* and 0 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_get_request_handler( struct httplib_context *ctx, struct httplib_connection *conn, int handler_type, httplib_request_handler *handler, httplib_websocket_connect_handler *connect_handler, httplib_websocket_ready_handler *ready_handler, httplib_websocket_data_handler *data_handler, httplib_websocket_close_handler *close_handler, httplib_authorization_handler *auth_handler, void **cbdata ) {
|
int XX_httplib_get_request_handler( struct lh_ctx_t *ctx, struct httplib_connection *conn, int handler_type, httplib_request_handler *handler, httplib_websocket_connect_handler *connect_handler, httplib_websocket_ready_handler *ready_handler, httplib_websocket_data_handler *data_handler, httplib_websocket_close_handler *close_handler, httplib_authorization_handler *auth_handler, void **cbdata ) {
|
||||||
|
|
||||||
const struct httplib_request_info *request_info;
|
const struct httplib_request_info *request_info;
|
||||||
const char *uri;
|
const char *uri;
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int httplib_get_response( const struct httplib_context *ctx, struct httplib_connection *conn, int timeout );
|
* int httplib_get_response( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int timeout );
|
||||||
*
|
*
|
||||||
* The function httplib_get_response() tries to get a response from a remote
|
* The function httplib_get_response() tries to get a response from a remote
|
||||||
* peer. This function does some dirty action by temporarily replacing the
|
* peer. This function does some dirty action by temporarily replacing the
|
||||||
@@ -40,11 +40,11 @@
|
|||||||
* place.
|
* place.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int httplib_get_response( const struct httplib_context *ctx, struct httplib_connection *conn, int timeout ) {
|
int httplib_get_response( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int timeout ) {
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
int ret;
|
int ret;
|
||||||
struct httplib_context rctx;
|
struct lh_ctx_t rctx;
|
||||||
|
|
||||||
if ( ctx == NULL || conn == NULL ) return -1;
|
if ( ctx == NULL || conn == NULL ) return -1;
|
||||||
|
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* const char *httplib_get_response_code_text( const struct httplib_context *ctx, struct httplib_connection *conn, int response_code );
|
* const char *httplib_get_response_code_text( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int response_code );
|
||||||
*
|
*
|
||||||
* The function httplib_get_response_code_text() returns a text associated with an
|
* The function httplib_get_response_code_text() returns a text associated with an
|
||||||
* HTTP response code.
|
* HTTP response code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *httplib_get_response_code_text( const struct httplib_context *ctx, struct httplib_connection *conn, int response_code ) {
|
const char *httplib_get_response_code_text( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int response_code ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See IANA HTTP status code assignment:
|
* See IANA HTTP status code assignment:
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
int httplib_get_server_ports( const struct httplib_context *ctx, int size, struct httplib_server_ports *ports ) {
|
int httplib_get_server_ports( const struct lh_ctx_t *ctx, int size, struct httplib_server_ports *ports ) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int cnt;
|
int cnt;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void *httplib_get_user_data( const struct httplib_context *ctx );
|
* void *httplib_get_user_data( const struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function httplib_get_user_data() returns a pointer to user data which is
|
* The function httplib_get_user_data() returns a pointer to user data which is
|
||||||
* associated with the context, or NULL if no user data has been registered.
|
* associated with the context, or NULL if no user data has been registered.
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
* httplib_start() function.
|
* httplib_start() function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *httplib_get_user_data( const struct httplib_context *ctx ) {
|
void *httplib_get_user_data( const struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx == NULL ) return NULL;
|
if ( ctx == NULL ) return NULL;
|
||||||
|
|
||||||
|
@@ -29,12 +29,12 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_getreq( const struct httplib_context *ctx, struct httplib_connection *conn, int *err );
|
* bool XX_httplib_getreq( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int *err );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_getreq() processes a request from a remote client.
|
* The function XX_httplib_getreq() processes a request from a remote client.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_getreq( const struct httplib_context *ctx, struct httplib_connection *conn, int *err ) {
|
bool XX_httplib_getreq( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int *err ) {
|
||||||
|
|
||||||
const char *cl;
|
const char *cl;
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_handle_cgi_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog );
|
* void XX_httplib_handle_cgi_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_handle_cgi_request() handles a request for a CGI
|
* The function XX_httplib_handle_cgi_request() handles a request for a CGI
|
||||||
* resource.
|
* resource.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#if !defined(NO_CGI)
|
#if !defined(NO_CGI)
|
||||||
|
|
||||||
void XX_httplib_handle_cgi_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog ) {
|
void XX_httplib_handle_cgi_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog ) {
|
||||||
|
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
void XX_httplib_handle_directory_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir ) {
|
void XX_httplib_handle_directory_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir ) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int sort_direction;
|
int sort_direction;
|
||||||
|
@@ -28,14 +28,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_handle_file_based_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *file );
|
* void XX_httplib_handle_file_based_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *file );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_handle_file_based_request() handles a request which
|
* The function XX_httplib_handle_file_based_request() handles a request which
|
||||||
* involves a file. This can either be a CGI request, an SSI request of a
|
* involves a file. This can either be a CGI request, an SSI request of a
|
||||||
* request for a static file.
|
* request for a static file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_handle_file_based_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *file ) {
|
void XX_httplib_handle_file_based_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *file ) {
|
||||||
|
|
||||||
#if !defined(NO_CGI)
|
#if !defined(NO_CGI)
|
||||||
const char *cgi_ext;
|
const char *cgi_ext;
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
static int url_encoded_field_found( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *key, size_t key_len, const char *filename, size_t filename_len, char *path, size_t path_len, struct httplib_form_data_handler *fdh ) {
|
static int url_encoded_field_found( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *key, size_t key_len, const char *filename, size_t filename_len, char *path, size_t path_len, struct httplib_form_data_handler *fdh ) {
|
||||||
|
|
||||||
char key_dec[1024];
|
char key_dec[1024];
|
||||||
char filename_dec[1024];
|
char filename_dec[1024];
|
||||||
@@ -77,7 +77,7 @@ static int url_encoded_field_found( const struct httplib_context *ctx, const str
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int url_encoded_field_get( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *key, size_t key_len, const char *value, size_t value_len, struct httplib_form_data_handler *fdh ) {
|
static int url_encoded_field_get( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *key, size_t key_len, const char *value, size_t value_len, struct httplib_form_data_handler *fdh ) {
|
||||||
|
|
||||||
char key_dec[1024];
|
char key_dec[1024];
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ static const char * search_boundary(const char *buf, size_t buf_len, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int httplib_handle_form_request( const struct httplib_context *ctx, struct httplib_connection *conn, struct httplib_form_data_handler *fdh ) {
|
int httplib_handle_form_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct httplib_form_data_handler *fdh ) {
|
||||||
|
|
||||||
const char *content_type;
|
const char *content_type;
|
||||||
char path[512];
|
char path[512];
|
||||||
|
@@ -29,14 +29,14 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_handle_not_modified_static_file_request( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep );
|
* void XX_httplib_handle_not_modified_static_file_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_handle_not_modified_static_file_request() is used to
|
* The function XX_httplib_handle_not_modified_static_file_request() is used to
|
||||||
* send a 304 response to a client to indicate that the requested resource has
|
* send a 304 response to a client to indicate that the requested resource has
|
||||||
* not been changed.
|
* not been changed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_handle_not_modified_static_file_request( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep ) {
|
void XX_httplib_handle_not_modified_static_file_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep ) {
|
||||||
|
|
||||||
char date[64];
|
char date[64];
|
||||||
char lm[64];
|
char lm[64];
|
||||||
|
@@ -30,13 +30,13 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static void print_props( const struct httplib_context *ctx, struct httplib_connection *conn, const char *uri, struct file *filep );
|
* static void print_props( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *uri, struct file *filep );
|
||||||
*
|
*
|
||||||
* The function print_props() writes the PROPFIND properties for a collection
|
* The function print_props() writes the PROPFIND properties for a collection
|
||||||
* event.
|
* event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void print_props( const struct httplib_context *ctx, struct httplib_connection *conn, const char *uri, struct file *filep ) {
|
static void print_props( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *uri, struct file *filep ) {
|
||||||
|
|
||||||
char mtime[64];
|
char mtime[64];
|
||||||
|
|
||||||
@@ -63,13 +63,13 @@ static void print_props( const struct httplib_context *ctx, struct httplib_conne
|
|||||||
} /* print_props */
|
} /* print_props */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static void print_dav_dir_entry( const struct httplib_context *ctx, struct de *de, void *data );
|
* static void print_dav_dir_entry( const struct lh_ctx_t *ctx, struct de *de, void *data );
|
||||||
*
|
*
|
||||||
* The function print_dav_dir_entry() is used to send the properties of a
|
* The function print_dav_dir_entry() is used to send the properties of a
|
||||||
* webdav directory to the remote client.
|
* webdav directory to the remote client.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void print_dav_dir_entry( const struct httplib_context *ctx, struct de *de, void *data ) {
|
static void print_dav_dir_entry( const struct lh_ctx_t *ctx, struct de *de, void *data ) {
|
||||||
|
|
||||||
char href[PATH_MAX];
|
char href[PATH_MAX];
|
||||||
char href_encoded[PATH_MAX * 3 /* worst case */];
|
char href_encoded[PATH_MAX * 3 /* worst case */];
|
||||||
@@ -91,12 +91,12 @@ static void print_dav_dir_entry( const struct httplib_context *ctx, struct de *d
|
|||||||
} /* print_dav_dir_entry */
|
} /* print_dav_dir_entry */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_handle_propfind( const stuct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
* void XX_httplib_handle_propfind( const stuct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httlib_handle_propfind() handles a propfind request.
|
* The function XX_httlib_handle_propfind() handles a propfind request.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_handle_propfind( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep ) {
|
void XX_httplib_handle_propfind( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep ) {
|
||||||
|
|
||||||
const char *depth;
|
const char *depth;
|
||||||
char date[64];
|
char date[64];
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_handle_request( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* void XX_httplib_handle_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_handle_request() handles an incoming request. This
|
* The function XX_httplib_handle_request() handles an incoming request. This
|
||||||
* is the heart of the LibHTTP's logic. This function is called when the
|
* is the heart of the LibHTTP's logic. This function is called when the
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
* to take: serve a file, or a directory, or call embedded function, etcetera.
|
* to take: serve a file, or a directory, or call embedded function, etcetera.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_handle_request( struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_handle_request( struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
struct httplib_request_info *ri;
|
struct httplib_request_info *ri;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
* request for a static file.
|
* request for a static file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_handle_static_file_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep, const char *mime_type, const char *additional_headers ) {
|
void XX_httplib_handle_static_file_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep, const char *mime_type, const char *additional_headers ) {
|
||||||
|
|
||||||
char date[64];
|
char date[64];
|
||||||
char lm[64];
|
char lm[64];
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
* request on a connection.
|
* request on a connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_handle_websocket_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, int is_callback_resource, httplib_websocket_connect_handler ws_connect_handler, httplib_websocket_ready_handler ws_ready_handler, httplib_websocket_data_handler ws_data_handler, httplib_websocket_close_handler ws_close_handler, void *cbData ) {
|
void XX_httplib_handle_websocket_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, int is_callback_resource, httplib_websocket_connect_handler ws_connect_handler, httplib_websocket_ready_handler ws_ready_handler, httplib_websocket_data_handler ws_data_handler, httplib_websocket_close_handler ws_close_handler, void *cbData ) {
|
||||||
|
|
||||||
const char *websock_key;
|
const char *websock_key;
|
||||||
const char *version;
|
const char *version;
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_init_options( struct httplib_context *ctx );
|
* bool XX_httplib_init_options( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_init_options() sets the options of a newly created
|
* The function XX_httplib_init_options() sets the options of a newly created
|
||||||
* context to reasonablei default values. When succesful, the function returns
|
* context to reasonablei default values. When succesful, the function returns
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
* cleanup.
|
* cleanup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_init_options( struct httplib_context *ctx ) {
|
bool XX_httplib_init_options( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx == NULL ) return true;
|
if ( ctx == NULL ) return true;
|
||||||
|
|
||||||
|
@@ -45,13 +45,13 @@ static void *cryptolib_dll_handle; /* Store the crypto library handle. */
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_initialize_ssl( struct httplib_context *ctx );
|
* int XX_httplib_initialize_ssl( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_initialize_ssl() initializes the use of SSL
|
* The function XX_httplib_initialize_ssl() initializes the use of SSL
|
||||||
* encrypted communication on the given context.
|
* encrypted communication on the given context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_initialize_ssl( struct httplib_context *ctx ) {
|
int XX_httplib_initialize_ssl( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
* is_put_or_delete_request: out: put/delete file?
|
* is_put_or_delete_request: out: put/delete file?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_interpret_uri( const struct httplib_context *ctx, struct httplib_connection *conn, char *filename, size_t filename_buf_len, struct file *filep, bool *is_found, bool *is_script_resource, bool *is_websocket_request, bool *is_put_or_delete_request ) {
|
void XX_httplib_interpret_uri( const struct lh_ctx_t *ctx, struct httplib_connection *conn, char *filename, size_t filename_buf_len, struct file *filep, bool *is_found, bool *is_script_resource, bool *is_websocket_request, bool *is_put_or_delete_request ) {
|
||||||
|
|
||||||
/* TODO (high): Restructure this function */
|
/* TODO (high): Restructure this function */
|
||||||
|
|
||||||
|
@@ -25,14 +25,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_is_authorized_for_put( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* bool XX_httplib_is_authorized_for_put( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_is_authorized_for_put() returns true, if the client
|
* The function XX_httplib_is_authorized_for_put() returns true, if the client
|
||||||
* on the connection has authorization to use put and equivalent methods to
|
* on the connection has authorization to use put and equivalent methods to
|
||||||
* write information to the server.
|
* write information to the server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_is_authorized_for_put( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
bool XX_httplib_is_authorized_for_put( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
struct file file = STRUCT_FILE_INITIALIZER;
|
struct file file = STRUCT_FILE_INITIALIZER;
|
||||||
const char *passfile;
|
const char *passfile;
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_is_file_in_memory( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, struct file *filep );
|
* bool XX_httplib_is_file_in_memory( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_is_file_in_memory() returns true, if a file defined
|
* The function XX_httplib_is_file_in_memory() returns true, if a file defined
|
||||||
* by a specific path is located in memory.
|
* by a specific path is located in memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_is_file_in_memory( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, struct file *filep ) {
|
bool XX_httplib_is_file_in_memory( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, struct file *filep ) {
|
||||||
|
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
@@ -28,14 +28,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_is_not_modified( const struct httplib_context *ctx, const struct httplib_connection *conn, const struct file *filep );
|
* bool XX_httplib_is_not_modified( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const struct file *filep );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_is_not_modified() returns true, if a resource has
|
* The function XX_httplib_is_not_modified() returns true, if a resource has
|
||||||
* not been modified sinze a given datetime and a 304 response should therefore
|
* not been modified sinze a given datetime and a 304 response should therefore
|
||||||
* be sufficient.
|
* be sufficient.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_is_not_modified( const struct httplib_context *ctx, const struct httplib_connection *conn, const struct file *filep ) {
|
bool XX_httplib_is_not_modified( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const struct file *filep ) {
|
||||||
|
|
||||||
char etag[64];
|
char etag[64];
|
||||||
const char *ims = httplib_get_header( conn, "If-Modified-Since" );
|
const char *ims = httplib_get_header( conn, "If-Modified-Since" );
|
||||||
|
@@ -60,7 +60,7 @@ static int dlclose( void *handle ) {
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw );
|
* XX_httplib_load_dll( struct lh_ctx_t *ctx, const char *dll_name, struct ssl_func *sw );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_load_dll() is used to load the SSL library in a
|
* The function XX_httplib_load_dll() is used to load the SSL library in a
|
||||||
* dynamic way. The function returns either a handle to the dll, or NULL if an
|
* dynamic way. The function returns either a handle to the dll, or NULL if an
|
||||||
@@ -69,7 +69,7 @@ static int dlclose( void *handle ) {
|
|||||||
|
|
||||||
#if !defined(NO_SSL) && !defined(NO_SSL_DL)
|
#if !defined(NO_SSL) && !defined(NO_SSL_DL)
|
||||||
|
|
||||||
void *XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw ) {
|
void *XX_httplib_load_dll( struct lh_ctx_t *ctx, const char *dll_name, struct ssl_func *sw ) {
|
||||||
|
|
||||||
union {
|
union {
|
||||||
void *p;
|
void *p;
|
||||||
|
@@ -29,12 +29,12 @@
|
|||||||
#include "httplib_pthread.h"
|
#include "httplib_pthread.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_lock_context( struct httplib_context *ctx );
|
* void httplib_lock_context( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function httplib_lock_context() puts a lock on the context.
|
* The function httplib_lock_context() puts a lock on the context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void httplib_lock_context( struct httplib_context *ctx ) {
|
void httplib_lock_context( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx != NULL ) httplib_pthread_mutex_lock( & ctx->nonce_mutex );
|
if ( ctx != NULL ) httplib_pthread_mutex_lock( & ctx->nonce_mutex );
|
||||||
|
|
||||||
@@ -43,12 +43,12 @@ void httplib_lock_context( struct httplib_context *ctx ) {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_unlock_context( struct httplib_context *ctx );
|
* void httplib_unlock_context( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function httplib_unlock_context() removes the current lock from the context.
|
* The function httplib_unlock_context() removes the current lock from the context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void httplib_unlock_context( struct httplib_context *ctx ) {
|
void httplib_unlock_context( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
if ( ctx != NULL ) httplib_pthread_mutex_unlock( & ctx->nonce_mutex );
|
if ( ctx != NULL ) httplib_pthread_mutex_unlock( & ctx->nonce_mutex );
|
||||||
|
|
||||||
|
@@ -32,12 +32,12 @@
|
|||||||
static const char *header_val( const struct httplib_connection *conn, const char *header );
|
static const char *header_val( const struct httplib_connection *conn, const char *header );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_log_access( const struct httplib_context *ctx, const struct httplib_connection *conn );
|
* void XX_httplib_log_access( const struct lh_ctx_t *ctx, const struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_log_access() logs an access of a client.
|
* The function XX_httplib_log_access() logs an access of a client.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_log_access( const struct httplib_context *ctx, const struct httplib_connection *conn ) {
|
void XX_httplib_log_access( const struct lh_ctx_t *ctx, const struct httplib_connection *conn ) {
|
||||||
|
|
||||||
const struct httplib_request_info *ri;
|
const struct httplib_request_info *ri;
|
||||||
struct file fi;
|
struct file fi;
|
||||||
|
@@ -518,10 +518,10 @@ struct httplib_handler_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct httplib_context;
|
* struct lh_ctx_t;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct httplib_context {
|
struct lh_ctx_t {
|
||||||
|
|
||||||
volatile enum ctx_status_t status; /* Should we stop event loop */
|
volatile enum ctx_status_t status; /* Should we stop event loop */
|
||||||
SSL_CTX *ssl_ctx; /* SSL context */
|
SSL_CTX *ssl_ctx; /* SSL context */
|
||||||
@@ -644,17 +644,17 @@ struct httplib_connection { /* */
|
|||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
|
|
||||||
struct worker_thread_args {
|
struct worker_thread_args {
|
||||||
struct httplib_context *ctx;
|
struct lh_ctx_t * ctx;
|
||||||
int index;
|
int index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct websocket_client_thread_data {
|
struct websocket_client_thread_data {
|
||||||
struct httplib_context *ctx;
|
struct lh_ctx_t * ctx;
|
||||||
struct httplib_connection *conn;
|
struct httplib_connection * conn;
|
||||||
httplib_websocket_data_handler data_handler;
|
httplib_websocket_data_handler data_handler;
|
||||||
httplib_websocket_close_handler close_handler;
|
httplib_websocket_close_handler close_handler;
|
||||||
void *callback_data;
|
void * callback_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uriprot_tp {
|
struct uriprot_tp {
|
||||||
@@ -786,127 +786,127 @@ void SHA1Final( unsigned char digest[20], SHA1_CTX *context );
|
|||||||
void SHA1Init( SHA1_CTX *context );
|
void SHA1Init( SHA1_CTX *context );
|
||||||
void SHA1Update( SHA1_CTX *context, const unsigned char *data, uint32_t len );
|
void SHA1Update( SHA1_CTX *context, const unsigned char *data, uint32_t len );
|
||||||
|
|
||||||
struct httplib_context *XX_httplib_abort_start( struct httplib_context *ctx, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
|
struct lh_ctx_t * XX_httplib_abort_start( struct lh_ctx_t *ctx, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
|
||||||
void XX_httplib_accept_new_connection( const struct socket *listener, struct httplib_context *ctx );
|
void XX_httplib_accept_new_connection( const struct socket *listener, struct lh_ctx_t *ctx );
|
||||||
bool XX_httplib_authorize( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep );
|
bool XX_httplib_authorize( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep );
|
||||||
const char * XX_httplib_builtin_mime_ext( int index );
|
const char * XX_httplib_builtin_mime_ext( int index );
|
||||||
const char * XX_httplib_builtin_mime_type( int index );
|
const char * XX_httplib_builtin_mime_type( int index );
|
||||||
int XX_httplib_check_acl( struct httplib_context *ctx, uint32_t remote_ip );
|
int XX_httplib_check_acl( struct lh_ctx_t *ctx, uint32_t remote_ip );
|
||||||
bool XX_httplib_check_authorization( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
bool XX_httplib_check_authorization( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
bool 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 );
|
bool 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 lh_ctx_t *ctx );
|
||||||
void XX_httplib_close_connection( struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_close_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
void XX_httplib_close_socket_gracefully( const struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_close_socket_gracefully( const struct lh_ctx_t *ctx, 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 );
|
||||||
bool XX_httplib_connect_socket( struct httplib_context *ctx, const char *host, int port, int use_ssl, SOCKET *sock, union usa *sa );
|
bool XX_httplib_connect_socket( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, SOCKET *sock, union usa *sa );
|
||||||
void XX_httplib_construct_etag( const struct httplib_context *ctx, char *buf, size_t buf_len, const struct file *filep );
|
void XX_httplib_construct_etag( const struct lh_ctx_t *ctx, char *buf, size_t buf_len, const struct file *filep );
|
||||||
int XX_httplib_consume_socket( struct httplib_context *ctx, struct socket *sp, int thread_index );
|
int XX_httplib_consume_socket( struct lh_ctx_t *ctx, struct socket *sp, int thread_index );
|
||||||
void XX_httplib_delete_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
void XX_httplib_delete_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
void XX_httplib_dir_scan_callback( const struct httplib_context *ctx, struct de *de, void *data );
|
void XX_httplib_dir_scan_callback( const struct lh_ctx_t *ctx, struct de *de, void *data );
|
||||||
void XX_httplib_discard_unread_request_data( const struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_discard_unread_request_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
int XX_httplib_fclose( struct file *filep );
|
int XX_httplib_fclose( struct file *filep );
|
||||||
void XX_httplib_fclose_on_exec( const struct httplib_context *ctx, struct file *filep, struct httplib_connection *conn );
|
void XX_httplib_fclose_on_exec( const struct lh_ctx_t *ctx, struct file *filep, struct httplib_connection *conn );
|
||||||
const char * XX_httplib_fgets( char *buf, size_t size, struct file *filep, char **p );
|
const char * XX_httplib_fgets( char *buf, size_t size, struct file *filep, char **p );
|
||||||
bool XX_httplib_fopen( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, const char *mode, struct file *filep );
|
bool XX_httplib_fopen( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, const char *mode, struct file *filep );
|
||||||
bool XX_httplib_forward_body_data( const struct httplib_context *ctx, struct httplib_connection *conn, FILE *fp, SOCKET sock, SSL *ssl );
|
bool XX_httplib_forward_body_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn, FILE *fp, SOCKET sock, SSL *ssl );
|
||||||
void XX_httplib_free_config_options( struct httplib_context *ctx );
|
void XX_httplib_free_config_options( struct lh_ctx_t *ctx );
|
||||||
void XX_httplib_free_context( struct httplib_context *ctx );
|
void XX_httplib_free_context( struct lh_ctx_t *ctx );
|
||||||
const char * XX_httplib_get_header( const struct httplib_request_info *ri, const char *name );
|
const char * XX_httplib_get_header( const struct httplib_request_info *ri, const char *name );
|
||||||
void XX_httplib_get_mime_type( const struct httplib_context *ctx, const char *path, struct vec *vec );
|
void XX_httplib_get_mime_type( const struct lh_ctx_t *ctx, const char *path, struct vec *vec );
|
||||||
const char * XX_httplib_get_rel_url_at_current_server( const struct httplib_context *ctx, const char *uri, const struct httplib_connection *conn );
|
const char * XX_httplib_get_rel_url_at_current_server( const struct lh_ctx_t *ctx, const char *uri, const struct httplib_connection *conn );
|
||||||
uint32_t XX_httplib_get_remote_ip( const struct httplib_connection *conn );
|
uint32_t XX_httplib_get_remote_ip( const struct httplib_connection *conn );
|
||||||
int XX_httplib_get_request_handler( struct httplib_context *ctx, struct httplib_connection *conn, int handler_type, httplib_request_handler *handler, httplib_websocket_connect_handler *connect_handler, httplib_websocket_ready_handler *ready_handler, httplib_websocket_data_handler *data_handler, httplib_websocket_close_handler *close_handler, httplib_authorization_handler *auth_handler, void **cbdata );
|
int XX_httplib_get_request_handler( struct lh_ctx_t *ctx, struct httplib_connection *conn, int handler_type, httplib_request_handler *handler, httplib_websocket_connect_handler *connect_handler, httplib_websocket_ready_handler *ready_handler, httplib_websocket_data_handler *data_handler, httplib_websocket_close_handler *close_handler, httplib_authorization_handler *auth_handler, void **cbdata );
|
||||||
int XX_httplib_get_request_len( const char *buf, int buflen );
|
int XX_httplib_get_request_len( const char *buf, int buflen );
|
||||||
void XX_httplib_get_system_name( char **sysName );
|
void XX_httplib_get_system_name( char **sysName );
|
||||||
enum uri_type_t XX_httplib_get_uri_type( const char *uri );
|
enum uri_type_t XX_httplib_get_uri_type( const char *uri );
|
||||||
bool XX_httplib_getreq( const struct httplib_context *ctx, struct httplib_connection *conn, int *err );
|
bool XX_httplib_getreq( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int *err );
|
||||||
void XX_httplib_handle_cgi_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog );
|
void XX_httplib_handle_cgi_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog );
|
||||||
void XX_httplib_handle_directory_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir );
|
void XX_httplib_handle_directory_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir );
|
||||||
void XX_httplib_handle_file_based_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
void XX_httplib_handle_file_based_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
void XX_httplib_handle_not_modified_static_file_request( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep );
|
void XX_httplib_handle_not_modified_static_file_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep );
|
||||||
void XX_httplib_handle_propfind( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
void XX_httplib_handle_propfind( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
void XX_httplib_handle_request( struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_handle_request( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
void XX_httplib_handle_ssi_file_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
void XX_httplib_handle_ssi_file_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
void XX_httplib_handle_static_file_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep, const char *mime_type, const char *additional_headers );
|
void XX_httplib_handle_static_file_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep, const char *mime_type, const char *additional_headers );
|
||||||
void XX_httplib_handle_websocket_request( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, int is_callback_resource, httplib_websocket_connect_handler ws_connect_handler, httplib_websocket_ready_handler ws_ready_handler, httplib_websocket_data_handler ws_data_handler, httplib_websocket_close_handler ws_close_handler, void *cbData );
|
void XX_httplib_handle_websocket_request( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, int is_callback_resource, httplib_websocket_connect_handler ws_connect_handler, httplib_websocket_ready_handler ws_ready_handler, httplib_websocket_data_handler ws_data_handler, httplib_websocket_close_handler ws_close_handler, void *cbData );
|
||||||
bool XX_httplib_header_has_option( const char *header, const char *option );
|
bool XX_httplib_header_has_option( const char *header, const char *option );
|
||||||
bool XX_httplib_init_options( struct httplib_context *ctx );
|
bool XX_httplib_init_options( struct lh_ctx_t *ctx );
|
||||||
void XX_httplib_interpret_uri( const struct httplib_context *ctx, struct httplib_connection *conn, char *filename, size_t filename_buf_len, struct file *filep, bool *is_found, bool *is_script_resource, bool *is_websocket_request, bool *is_put_or_delete_request );
|
void XX_httplib_interpret_uri( const struct lh_ctx_t *ctx, struct httplib_connection *conn, char *filename, size_t filename_buf_len, struct file *filep, bool *is_found, bool *is_script_resource, bool *is_websocket_request, bool *is_put_or_delete_request );
|
||||||
bool XX_httplib_is_authorized_for_put( const struct httplib_context *ctx, struct httplib_connection *conn );
|
bool XX_httplib_is_authorized_for_put( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
bool XX_httplib_is_file_in_memory( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path, struct file *filep );
|
bool XX_httplib_is_file_in_memory( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
bool XX_httplib_is_file_opened( const struct file *filep );
|
bool XX_httplib_is_file_opened( const struct file *filep );
|
||||||
bool XX_httplib_is_not_modified( const struct httplib_context *ctx, const struct httplib_connection *conn, const struct file *filep );
|
bool XX_httplib_is_not_modified( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const struct file *filep );
|
||||||
bool XX_httplib_is_put_or_delete_method( const struct httplib_connection *conn );
|
bool XX_httplib_is_put_or_delete_method( const struct httplib_connection *conn );
|
||||||
bool XX_httplib_is_valid_http_method( const char *method );
|
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 );
|
||||||
bool XX_httplib_is_websocket_protocol( const struct httplib_connection *conn );
|
bool XX_httplib_is_websocket_protocol( const struct httplib_connection *conn );
|
||||||
void * XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw );
|
void * XX_httplib_load_dll( struct lh_ctx_t *ctx, const char *dll_name, struct ssl_func *sw );
|
||||||
void XX_httplib_log_access( const struct httplib_context *ctx, const struct httplib_connection *conn );
|
void XX_httplib_log_access( const struct lh_ctx_t *ctx, const struct httplib_connection *conn );
|
||||||
LIBHTTP_THREAD XX_httplib_master_thread( void *thread_func_param );
|
LIBHTTP_THREAD XX_httplib_master_thread( void *thread_func_param );
|
||||||
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( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
void XX_httplib_mkcol( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
bool XX_httplib_must_hide_file( const struct httplib_context *ctx, const char *path );
|
bool XX_httplib_must_hide_file( const struct lh_ctx_t *ctx, 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( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
void XX_httplib_open_auth_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
bool XX_httplib_option_value_to_bool( const char *value, bool *config );
|
bool XX_httplib_option_value_to_bool( const char *value, bool *config );
|
||||||
bool XX_httplib_option_value_to_int( const char *value, int *config );
|
bool XX_httplib_option_value_to_int( const char *value, int *config );
|
||||||
int XX_httplib_parse_auth_header( const struct httplib_context *ctx, struct httplib_connection *conn, char *buf, size_t buf_size, struct ah *ah );
|
int XX_httplib_parse_auth_header( const struct lh_ctx_t *ctx, 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 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( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog, struct cgi_environment *env );
|
void XX_httplib_prepare_cgi_environment( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog, struct cgi_environment *env );
|
||||||
void XX_httplib_print_dir_entry( const struct httplib_context *ctx, struct de *de );
|
void XX_httplib_print_dir_entry( const struct lh_ctx_t *ctx, struct de *de );
|
||||||
void XX_httplib_process_new_connection( struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_process_new_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
bool XX_httplib_process_options( struct httplib_context *ctx, const struct httplib_option_t *options );
|
bool XX_httplib_process_options( struct lh_ctx_t *ctx, const struct httplib_option_t *options );
|
||||||
void XX_httplib_produce_socket( struct httplib_context *ctx, const struct socket *sp );
|
void XX_httplib_produce_socket( struct lh_ctx_t *ctx, const struct socket *sp );
|
||||||
int XX_httplib_pull( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len, double timeout );
|
int XX_httplib_pull( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len, double timeout );
|
||||||
int XX_httplib_pull_all( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len );
|
int XX_httplib_pull_all( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len );
|
||||||
int64_t XX_httplib_push_all( const struct httplib_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len );
|
int64_t XX_httplib_push_all( const struct lh_ctx_t *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len );
|
||||||
int XX_httplib_put_dir( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
int XX_httplib_put_dir( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
void XX_httplib_put_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
void XX_httplib_put_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
bool XX_httplib_read_auth_file( const struct httplib_context *ctx, struct file *filep, struct read_auth_file_struct *workdata );
|
bool XX_httplib_read_auth_file( const struct lh_ctx_t *ctx, struct file *filep, struct read_auth_file_struct *workdata );
|
||||||
int XX_httplib_read_request( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread );
|
int XX_httplib_read_request( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread );
|
||||||
void XX_httplib_read_websocket( const struct httplib_context *ctx, struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *callback_data );
|
void XX_httplib_read_websocket( const struct lh_ctx_t *ctx, struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *callback_data );
|
||||||
void XX_httplib_redirect_to_https_port( const struct httplib_context *ctx, struct httplib_connection *conn, int ssl_index );
|
void XX_httplib_redirect_to_https_port( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int ssl_index );
|
||||||
int XX_httplib_refresh_trust( const struct httplib_context *ctx, struct httplib_connection *conn );
|
int XX_httplib_refresh_trust( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
void XX_httplib_remove_bad_file( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path );
|
void XX_httplib_remove_bad_file( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path );
|
||||||
int XX_httplib_remove_directory( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir );
|
int XX_httplib_remove_directory( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir );
|
||||||
void XX_httplib_remove_double_dots_and_double_slashes( char *s );
|
void XX_httplib_remove_double_dots_and_double_slashes( char *s );
|
||||||
void XX_httplib_reset_per_request_attributes( struct httplib_connection *conn );
|
void XX_httplib_reset_per_request_attributes( struct httplib_connection *conn );
|
||||||
int XX_httplib_scan_directory( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir, void *data, void (*cb)(const struct httplib_context *ctx, struct de *, void *) );
|
int XX_httplib_scan_directory( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir, void *data, void (*cb)(const struct lh_ctx_t *ctx, struct de *, void *) );
|
||||||
void XX_httplib_send_authorization_request( struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_send_authorization_request( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
void XX_httplib_send_file_data( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep, int64_t offset, int64_t len );
|
void XX_httplib_send_file_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep, int64_t offset, int64_t len );
|
||||||
void XX_httplib_send_http_error( const struct httplib_context *ctx, struct httplib_connection *, int, PRINTF_FORMAT_STRING(const char *fmt), ... ) PRINTF_ARGS(4, 5);
|
void XX_httplib_send_http_error( const struct lh_ctx_t *ctx, struct httplib_connection *, int, PRINTF_FORMAT_STRING(const char *fmt), ... ) PRINTF_ARGS(4, 5);
|
||||||
int XX_httplib_send_no_cache_header( const struct httplib_context *ctx, struct httplib_connection *conn );
|
int XX_httplib_send_no_cache_header( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
void XX_httplib_send_options( const struct httplib_context *ctx, struct httplib_connection *conn );
|
void XX_httplib_send_options( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
int XX_httplib_send_static_cache_header( const struct httplib_context *ctx, struct httplib_connection *conn );
|
int XX_httplib_send_static_cache_header( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
int XX_httplib_send_websocket_handshake( const struct httplib_context *ctx, struct httplib_connection *conn, const char *websock_key );
|
int XX_httplib_send_websocket_handshake( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *websock_key );
|
||||||
int XX_httplib_set_acl_option( struct httplib_context *ctx );
|
int XX_httplib_set_acl_option( struct lh_ctx_t *ctx );
|
||||||
void XX_httplib_set_close_on_exec( SOCKET sock );
|
void XX_httplib_set_close_on_exec( SOCKET sock );
|
||||||
bool XX_httplib_set_gpass_option( struct httplib_context *ctx );
|
bool XX_httplib_set_gpass_option( struct lh_ctx_t *ctx );
|
||||||
void XX_httplib_set_handler_type( struct httplib_context *ctx, const char *uri, int handler_type, int is_delete_request, httplib_request_handler handler, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, httplib_authorization_handler auth_handler, void *cbdata );
|
void XX_httplib_set_handler_type( struct lh_ctx_t *ctx, const char *uri, int handler_type, int is_delete_request, httplib_request_handler handler, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, httplib_authorization_handler auth_handler, void *cbdata );
|
||||||
int XX_httplib_set_non_blocking_mode( SOCKET sock );
|
int XX_httplib_set_non_blocking_mode( SOCKET sock );
|
||||||
int XX_httplib_set_ports_option( struct httplib_context *ctx );
|
int XX_httplib_set_ports_option( struct lh_ctx_t *ctx );
|
||||||
int XX_httplib_set_sock_timeout( SOCKET sock, int milliseconds );
|
int XX_httplib_set_sock_timeout( SOCKET sock, int milliseconds );
|
||||||
int XX_httplib_set_tcp_nodelay( SOCKET sock, bool nodelay_on );
|
int XX_httplib_set_tcp_nodelay( SOCKET sock, bool nodelay_on );
|
||||||
void XX_httplib_set_thread_name( const struct httplib_context *ctx, const char *name );
|
void XX_httplib_set_thread_name( const struct lh_ctx_t *ctx, const char *name );
|
||||||
int XX_httplib_set_throttle( const char *spec, uint32_t remote_ip, const char *uri );
|
int XX_httplib_set_throttle( const char *spec, uint32_t remote_ip, const char *uri );
|
||||||
bool XX_httplib_set_uid_option( struct httplib_context *ctx );
|
bool XX_httplib_set_uid_option( struct lh_ctx_t *ctx );
|
||||||
bool XX_httplib_should_decode_url( const struct httplib_context *ctx );
|
bool XX_httplib_should_decode_url( const struct lh_ctx_t *ctx );
|
||||||
bool XX_httplib_should_keep_alive( const struct httplib_context *ctx, const struct httplib_connection *conn );
|
bool XX_httplib_should_keep_alive( const struct lh_ctx_t *ctx, const struct httplib_connection *conn );
|
||||||
char * XX_httplib_skip( char **buf, const char *delimiters );
|
char * XX_httplib_skip( char **buf, const char *delimiters );
|
||||||
char * XX_httplib_skip_quoted( char **buf, const char *delimiters, const char *whitespace, char quotechar );
|
char * XX_httplib_skip_quoted( char **buf, const char *delimiters, const char *whitespace, char quotechar );
|
||||||
void XX_httplib_sockaddr_to_string(char *buf, size_t len, const union usa *usa );
|
void XX_httplib_sockaddr_to_string(char *buf, size_t len, const union usa *usa );
|
||||||
pid_t XX_httplib_spawn_process( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog, char *envblk, char *envp[], int fdin[2], int fdout[2], int fderr[2], const char *dir );
|
pid_t XX_httplib_spawn_process( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog, char *envblk, char *envp[], int fdin[2], int fdout[2], int fderr[2], const char *dir );
|
||||||
int XX_httplib_start_thread_with_id( httplib_thread_func_t func, void *param, pthread_t *threadidptr );
|
int XX_httplib_start_thread_with_id( httplib_thread_func_t func, void *param, pthread_t *threadidptr );
|
||||||
int XX_httplib_stat( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
int XX_httplib_stat( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep );
|
||||||
int XX_httplib_substitute_index_file( const struct httplib_context *ctx, struct httplib_connection *conn, char *path, size_t path_len, struct file *filep );
|
int XX_httplib_substitute_index_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, char *path, size_t path_len, struct file *filep );
|
||||||
const char * XX_httplib_suggest_connection_header( const struct httplib_context *ctx, const struct httplib_connection *conn );
|
const char * XX_httplib_suggest_connection_header( const struct lh_ctx_t *ctx, const struct httplib_connection *conn );
|
||||||
LIBHTTP_THREAD XX_httplib_websocket_client_thread( void *data );
|
LIBHTTP_THREAD XX_httplib_websocket_client_thread( void *data );
|
||||||
int XX_httplib_websocket_write_exec( const struct httplib_context *ctx, struct httplib_connection *conn, int opcode, const char *data, size_t dataLen, uint32_t masking_key );
|
int XX_httplib_websocket_write_exec( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int opcode, const char *data, size_t dataLen, uint32_t masking_key );
|
||||||
LIBHTTP_THREAD XX_httplib_worker_thread( void *thread_func_param );
|
LIBHTTP_THREAD XX_httplib_worker_thread( void *thread_func_param );
|
||||||
|
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ LIBHTTP_THREAD XX_httplib_master_thread( void *thread_func_param ) {
|
|||||||
|
|
||||||
static void master_thread_run(void *thread_func_param) {
|
static void master_thread_run(void *thread_func_param) {
|
||||||
|
|
||||||
struct httplib_context *ctx = (struct httplib_context *)thread_func_param;
|
struct lh_ctx_t *ctx = (struct lh_ctx_t *)thread_func_param;
|
||||||
struct httplib_workerTLS tls;
|
struct httplib_workerTLS tls;
|
||||||
struct pollfd *pfd;
|
struct pollfd *pfd;
|
||||||
int i;
|
int i;
|
||||||
|
@@ -29,14 +29,14 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_mkcol( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
* void XX_httplib_mkcol( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_mkcol() handles a MKCOL command from a remote
|
* The function XX_httplib_mkcol() handles a MKCOL command from a remote
|
||||||
* client. The MKCOL method is used to create a new collection resource at the
|
* client. The MKCOL method is used to create a new collection resource at the
|
||||||
* location specificied by the request URI.
|
* location specificied by the request URI.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_mkcol( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path ) {
|
void XX_httplib_mkcol( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path ) {
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
int body_len;
|
int body_len;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_must_hide_file( const struct httplib_context *ctx, const char *path );
|
* bool XX_httplib_must_hide_file( const struct lh_ctx_t *ctx, const char *path );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_must_hide_file() returns true, if a file must be
|
* The function XX_httplib_must_hide_file() returns true, if a file must be
|
||||||
* hidden from browsing by the remote client. A used provided list of file
|
* hidden from browsing by the remote client. A used provided list of file
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
* the patterns defined by the user.
|
* the patterns defined by the user.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_must_hide_file( const struct httplib_context *ctx, const char *path ) {
|
bool XX_httplib_must_hide_file( const struct lh_ctx_t *ctx, const char *path ) {
|
||||||
|
|
||||||
const char *pw_pattern;
|
const char *pw_pattern;
|
||||||
const char *pattern;
|
const char *pattern;
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
* or search for .htpasswd in the requested directory.
|
* or search for .htpasswd in the requested directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_open_auth_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, struct file *filep ) {
|
void XX_httplib_open_auth_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, struct file *filep ) {
|
||||||
|
|
||||||
char name[PATH_MAX];
|
char name[PATH_MAX];
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
* Return 1 on success. Always initializes the ah structure.
|
* Return 1 on success. Always initializes the ah structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_parse_auth_header( const struct httplib_context *ctx, struct httplib_connection *conn, char *buf, size_t buf_size, struct ah *ah ) {
|
int XX_httplib_parse_auth_header( const struct lh_ctx_t *ctx, struct httplib_connection *conn, char *buf, size_t buf_size, struct ah *ah ) {
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_prepare_cgi_environment( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog, struct cgi_environment *env );
|
* void XX_httplib_prepare_cgi_environment( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog, struct cgi_environment *env );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_prepare_cgi_environment() is used to prepare all
|
* The function XX_httplib_prepare_cgi_environment() is used to prepare all
|
||||||
* environment variables before a CGI script is called.
|
* environment variables before a CGI script is called.
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if !defined(NO_CGI)
|
#if !defined(NO_CGI)
|
||||||
|
|
||||||
void XX_httplib_prepare_cgi_environment( const struct httplib_context *ctx, struct httplib_connection *conn, const char *prog, struct cgi_environment *env ) {
|
void XX_httplib_prepare_cgi_environment( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *prog, struct cgi_environment *env ) {
|
||||||
|
|
||||||
const char *s;
|
const char *s;
|
||||||
struct vec var_vec;
|
struct vec var_vec;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
void XX_httplib_print_dir_entry( const struct httplib_context *ctx, struct de *de ) {
|
void XX_httplib_print_dir_entry( const struct lh_ctx_t *ctx, struct de *de ) {
|
||||||
|
|
||||||
char size[64];
|
char size[64];
|
||||||
char mod[64];
|
char mod[64];
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
int httplib_printf( const struct httplib_context *ctx, struct httplib_connection *conn, const char *fmt, ... ) {
|
int httplib_printf( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *fmt, ... ) {
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int result;
|
int result;
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_process_new_connection( struct httplib_context *ctx, struct httplib_connection *conn );
|
* void XX_httplib_process_new_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_process_new_connection() is used to process a new
|
* The function XX_httplib_process_new_connection() is used to process a new
|
||||||
* incoming connection on a socket.
|
* incoming connection on a socket.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_process_new_connection( struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_process_new_connection( struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
struct httplib_request_info *ri;
|
struct httplib_request_info *ri;
|
||||||
int keep_alive;
|
int keep_alive;
|
||||||
|
@@ -22,16 +22,16 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
static bool check_bool( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, bool *config );
|
static bool check_bool( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, bool *config );
|
||||||
static bool check_dbg( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, enum debug_level_t *config );
|
static bool check_dbg( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, enum debug_level_t *config );
|
||||||
static bool check_dir( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
static bool check_dir( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
static bool check_file( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
static bool check_file( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
static bool check_int( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, int *config, int minval, int maxval );
|
static bool check_int( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, int *config, int minval, int maxval );
|
||||||
static bool check_patt( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
static bool check_patt( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
static bool check_str( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
static bool check_str( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_process_options( struct httplib_context *ctx, const struct httplib_option_t *options );
|
* bool XX_httplib_process_options( struct lh_ctx_t *ctx, const struct httplib_option_t *options );
|
||||||
*
|
*
|
||||||
* The function process_options() processes the user supplied options and adds
|
* The function process_options() processes the user supplied options and adds
|
||||||
* them to the central option list of the context. If en error occurs, the
|
* them to the central option list of the context. If en error occurs, the
|
||||||
@@ -40,7 +40,7 @@ static bool check_str( struct httplib_context *ctx, const struct httplib_opti
|
|||||||
* generated.
|
* generated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_process_options( struct httplib_context *ctx, const struct httplib_option_t *options ) {
|
bool XX_httplib_process_options( struct lh_ctx_t *ctx, const struct httplib_option_t *options ) {
|
||||||
|
|
||||||
if ( ctx == NULL ) return true;
|
if ( ctx == NULL ) return true;
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ bool XX_httplib_process_options( struct httplib_context *ctx, const struct httpl
|
|||||||
} /* XX_httplib_process_options */
|
} /* XX_httplib_process_options */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_bool( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, bool *config );
|
* static bool check_bool( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, bool *config );
|
||||||
*
|
*
|
||||||
* The function check_bool() checks if an option is equal to a boolean config
|
* The function check_bool() checks if an option is equal to a boolean config
|
||||||
* parameter and stores the value if that is the case. If the value cannot be
|
* parameter and stores the value if that is the case. If the value cannot be
|
||||||
@@ -111,7 +111,7 @@ bool XX_httplib_process_options( struct httplib_context *ctx, const struct httpl
|
|||||||
* false is returned.
|
* false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_bool( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, bool *config ) {
|
static bool check_bool( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, bool *config ) {
|
||||||
|
|
||||||
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ static bool check_bool( struct httplib_context *ctx, const struct httplib_option
|
|||||||
} /* check_bool */
|
} /* check_bool */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_dir( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
* static bool check_dir( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
*
|
*
|
||||||
* The function check_dir() checks if an option is equal to a directory config
|
* The function check_dir() checks if an option is equal to a directory config
|
||||||
* parameter and stores the value if that is the case. If the value cannot be
|
* parameter and stores the value if that is the case. If the value cannot be
|
||||||
@@ -138,7 +138,7 @@ static bool check_bool( struct httplib_context *ctx, const struct httplib_option
|
|||||||
* false is returned.
|
* false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_dir( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
static bool check_dir( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
||||||
|
|
||||||
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ static bool check_dir( struct httplib_context *ctx, const struct httplib_option_
|
|||||||
} /* check_dir */
|
} /* check_dir */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_patt( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
* static bool check_patt( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
*
|
*
|
||||||
* The function check_patt() checks if an option is equal to a pattern config
|
* The function check_patt() checks if an option is equal to a pattern config
|
||||||
* parameter and stores the value if that is the case. If the value cannot be
|
* parameter and stores the value if that is the case. If the value cannot be
|
||||||
@@ -171,7 +171,7 @@ static bool check_dir( struct httplib_context *ctx, const struct httplib_option_
|
|||||||
* false is returned.
|
* false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_patt( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
static bool check_patt( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
||||||
|
|
||||||
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ static bool check_patt( struct httplib_context *ctx, const struct httplib_option
|
|||||||
} /* check_patt */
|
} /* check_patt */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_file( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
* static bool check_file( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
*
|
*
|
||||||
* The function check_file() checks if an option is equal to a filename config
|
* The function check_file() checks if an option is equal to a filename config
|
||||||
* parameter and stores the value if that is the case. If the value cannot be
|
* parameter and stores the value if that is the case. If the value cannot be
|
||||||
@@ -204,7 +204,7 @@ static bool check_patt( struct httplib_context *ctx, const struct httplib_option
|
|||||||
* false is returned.
|
* false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_file( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
static bool check_file( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
||||||
|
|
||||||
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ static bool check_file( struct httplib_context *ctx, const struct httplib_option
|
|||||||
} /* check_file */
|
} /* check_file */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_str( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
* static bool check_str( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config );
|
||||||
*
|
*
|
||||||
* The function check_str() checks if an option is equal to a string config
|
* The function check_str() checks if an option is equal to a string config
|
||||||
* parameter and stores the value if that is the case. If the value cannot be
|
* parameter and stores the value if that is the case. If the value cannot be
|
||||||
@@ -237,7 +237,7 @@ static bool check_file( struct httplib_context *ctx, const struct httplib_option
|
|||||||
* false is returned.
|
* false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_str( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
static bool check_str( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, char **config ) {
|
||||||
|
|
||||||
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
if ( ctx == NULL || option == NULL || option->name == NULL || name == NULL || config == NULL ) {
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ static bool check_str( struct httplib_context *ctx, const struct httplib_option_
|
|||||||
} /* check_str */
|
} /* check_str */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_int( struct httplib_context *ctx, const struct httplib_opion_t *option, const char *name, int *config, int minval, int maxval );
|
* static bool check_int( struct lh_ctx_t *ctx, const struct httplib_opion_t *option, const char *name, int *config, int minval, int maxval );
|
||||||
*
|
*
|
||||||
* The function check_int() checks in an option is equal to an integer config
|
* The function check_int() checks in an option is equal to an integer config
|
||||||
* parameter and stores the value if that is the case. If the value cannot be
|
* parameter and stores the value if that is the case. If the value cannot be
|
||||||
@@ -270,7 +270,7 @@ static bool check_str( struct httplib_context *ctx, const struct httplib_option_
|
|||||||
* valud, also false is returned.
|
* valud, also false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_int( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, int *config, int minval, int maxval ) {
|
static bool check_int( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, int *config, int minval, int maxval ) {
|
||||||
|
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ static bool check_int( struct httplib_context *ctx, const struct httplib_option_
|
|||||||
} /* check_int */
|
} /* check_int */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static bool check_dbg( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name );
|
* static bool check_dbg( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name );
|
||||||
*
|
*
|
||||||
* The function check_dbg() checks if an option is equal to a debug level
|
* The function check_dbg() checks if an option is equal to a debug level
|
||||||
* config parameter and stores the value if that is the case. If the value
|
* config parameter and stores the value if that is the case. If the value
|
||||||
@@ -307,7 +307,7 @@ static bool check_int( struct httplib_context *ctx, const struct httplib_option_
|
|||||||
* valid, also false is returned.
|
* valid, also false is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_dbg( struct httplib_context *ctx, const struct httplib_option_t *option, const char *name, enum debug_level_t *config ) {
|
static bool check_dbg( struct lh_ctx_t *ctx, const struct httplib_option_t *option, const char *name, enum debug_level_t *config ) {
|
||||||
|
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
@@ -29,14 +29,14 @@
|
|||||||
#include "httplib_pthread.h"
|
#include "httplib_pthread.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_produce_socket( struct httplib_context *ctx, const struct socket *sp );
|
* void XX_httplib_produce_socket( struct lh_ctx_t *ctx, const struct socket *sp );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_produce_socket() is used to produce a socket.
|
* The function XX_httplib_produce_socket() is used to produce a socket.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ALTERNATIVE_QUEUE)
|
#if defined(ALTERNATIVE_QUEUE)
|
||||||
|
|
||||||
void XX_httplib_produce_socket( struct httplib_context *ctx, const struct socket *sp ) {
|
void XX_httplib_produce_socket( struct lh_ctx_t *ctx, const struct socket *sp ) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ void XX_httplib_produce_socket( struct httplib_context *ctx, const struct socket
|
|||||||
* Master thread adds accepted socket to a queue
|
* Master thread adds accepted socket to a queue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_produce_socket( struct httplib_context *ctx, const struct socket *sp ) {
|
void XX_httplib_produce_socket( struct lh_ctx_t *ctx, const struct socket *sp ) {
|
||||||
|
|
||||||
#define QUEUE_SIZE(ctx) ((int)(ARRAY_SIZE(ctx->queue)))
|
#define QUEUE_SIZE(ctx) ((int)(ARRAY_SIZE(ctx->queue)))
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
* Return negative value on error, or number of bytes read on success.
|
* Return negative value on error, or number of bytes read on success.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_pull( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len, double timeout ) {
|
int XX_httplib_pull( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len, double timeout ) {
|
||||||
|
|
||||||
int nread;
|
int nread;
|
||||||
int err;
|
int err;
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
int XX_httplib_pull_all( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len ) {
|
int XX_httplib_pull_all( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int len ) {
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
int nread;
|
int nread;
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static int64_t push( const struct httplib_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len, double timeout );
|
* static int64_t push( const struct lh_ctx_t *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len, double timeout );
|
||||||
*
|
*
|
||||||
* The function push() writes data to the I/O channel, opened file descriptor,
|
* The function push() writes data to the I/O channel, opened file descriptor,
|
||||||
* socket or SSL descriptor. The function returns the number of bytes which
|
* socket or SSL descriptor. The function returns the number of bytes which
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
* been written.
|
* been written.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int64_t push( const struct httplib_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len, double timeout ) {
|
static int64_t push( const struct lh_ctx_t *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len, double timeout ) {
|
||||||
|
|
||||||
struct timespec start;
|
struct timespec start;
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
@@ -146,13 +146,13 @@ static int64_t push( const struct httplib_context *ctx, FILE *fp, SOCKET sock, S
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int64_t XX_httplib_push_all( const struct httplib_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len );
|
* int64_t XX_httplib_push_all( const struct lh_ctx_t *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_push_all() pushes all data in a buffer to a socket.
|
* The function XX_httplib_push_all() pushes all data in a buffer to a socket.
|
||||||
* The number of bytes written is returned.
|
* The number of bytes written is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int64_t XX_httplib_push_all( const struct httplib_context *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len ) {
|
int64_t XX_httplib_push_all( const struct lh_ctx_t *ctx, FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len ) {
|
||||||
|
|
||||||
double timeout;
|
double timeout;
|
||||||
int64_t n;
|
int64_t n;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_put_dir( struct httplib_connection *conn, const char *path );
|
* int XX_httplib_put_dir( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_put_dir() creates a directory mentioned in a PUT
|
* The function XX_httplib_put_dir() creates a directory mentioned in a PUT
|
||||||
* request including all intermediate subdirectories. The following values can
|
* request including all intermediate subdirectories. The following values can
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
* Return -2 if path can not be created.
|
* Return -2 if path can not be created.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_put_dir( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path ) {
|
int XX_httplib_put_dir( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path ) {
|
||||||
|
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_put_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path );
|
* void XX_httplib_put_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_put_file() processes a file PUT request coming from
|
* The function XX_httplib_put_file() processes a file PUT request coming from
|
||||||
* a remote client.
|
* a remote client.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_put_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path ) {
|
void XX_httplib_put_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path ) {
|
||||||
|
|
||||||
struct file file = STRUCT_FILE_INITIALIZER;
|
struct file file = STRUCT_FILE_INITIALIZER;
|
||||||
const char *range;
|
const char *range;
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
static int httplib_read_inner( const struct httplib_context *ctx, struct httplib_connection *conn, void *buffie, size_t len ) {
|
static int httplib_read_inner( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *buffie, size_t len ) {
|
||||||
|
|
||||||
int64_t n;
|
int64_t n;
|
||||||
int64_t buffered_len;
|
int64_t buffered_len;
|
||||||
@@ -101,7 +101,7 @@ static int httplib_read_inner( const struct httplib_context *ctx, struct httplib
|
|||||||
} /* httplib_read_inner */
|
} /* httplib_read_inner */
|
||||||
|
|
||||||
|
|
||||||
static char httplib_getc( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
static char httplib_getc( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ static char httplib_getc( const struct httplib_context *ctx, struct httplib_conn
|
|||||||
} /* httplib_getc */
|
} /* httplib_getc */
|
||||||
|
|
||||||
|
|
||||||
int httplib_read( const struct httplib_context *ctx, struct httplib_connection *conn, void *buf, size_t len ) {
|
int httplib_read( const struct lh_ctx_t *ctx, struct httplib_connection *conn, void *buf, size_t len ) {
|
||||||
|
|
||||||
if ( len > INT_MAX ) len = INT_MAX;
|
if ( len > INT_MAX ) len = INT_MAX;
|
||||||
|
|
||||||
|
@@ -28,14 +28,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_read_auth_file( const struct httplib_context *ctx, struct file *filep, struct read_auth_file_struct *workdata );
|
* bool XX_httplib_read_auth_file( const struct lh_ctx_t *ctx, struct file *filep, struct read_auth_file_struct *workdata );
|
||||||
*
|
*
|
||||||
* The function XX_httpib_read_auth_file() loops over the password file to
|
* The function XX_httpib_read_auth_file() loops over the password file to
|
||||||
* read its contents. Include statements are honored which lets the routine
|
* read its contents. Include statements are honored which lets the routine
|
||||||
* also open and scan child files.
|
* also open and scan child files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_read_auth_file( const struct httplib_context *ctx, struct file *filep, struct read_auth_file_struct *workdata ) {
|
bool XX_httplib_read_auth_file( const struct lh_ctx_t *ctx, struct file *filep, struct read_auth_file_struct *workdata ) {
|
||||||
|
|
||||||
int is_authorized;
|
int is_authorized;
|
||||||
struct file fp;
|
struct file fp;
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_read_request( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread );
|
* int XX_httplib_read_request( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_read_request() keeps reading the input (which can
|
* The function XX_httplib_read_request() keeps reading the input (which can
|
||||||
* either be an opened file descriptor, a socket sock or an SSL descriptor ssl)
|
* either be an opened file descriptor, a socket sock or an SSL descriptor ssl)
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
* is incremented by the number of bytes read.
|
* is incremented by the number of bytes read.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_read_request( const struct httplib_context *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread ) {
|
int XX_httplib_read_request( const struct lh_ctx_t *ctx, FILE *fp, struct httplib_connection *conn, char *buf, int bufsiz, int *nread ) {
|
||||||
|
|
||||||
int request_len;
|
int request_len;
|
||||||
int n;
|
int n;
|
||||||
|
@@ -28,12 +28,12 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_read_websocket( const struct httplib_context *ctx, struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *calback_data );
|
* void XX_httplib_read_websocket( const struct lh_ctx_t *ctx, struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *calback_data );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_read_websocket() reads from a websocket connection.
|
* The function XX_httplib_read_websocket() reads from a websocket connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_read_websocket( const struct httplib_context *ctx, struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *callback_data ) {
|
void XX_httplib_read_websocket( const struct lh_ctx_t *ctx, struct httplib_connection *conn, httplib_websocket_data_handler ws_data_handler, void *callback_data ) {
|
||||||
|
|
||||||
/* Pointer to the beginning of the portion of the incoming websocket
|
/* Pointer to the beginning of the portion of the incoming websocket
|
||||||
* message queue.
|
* message queue.
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_redirect_to_https_port( const struct httplib_context *ctx, struct httplib_connection *conn, int ssl_index );
|
* void XX_httplib_redirect_to_https_port( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int ssl_index );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_redirect_to_https_port() redirects a request to an
|
* The function XX_httplib_redirect_to_https_port() redirects a request to an
|
||||||
* encrypted connection over HTTPS.
|
* encrypted connection over HTTPS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_redirect_to_https_port( const struct httplib_context *ctx, struct httplib_connection *conn, int ssl_index ) {
|
void XX_httplib_redirect_to_https_port( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int ssl_index ) {
|
||||||
|
|
||||||
char host[1024+1];
|
char host[1024+1];
|
||||||
const char *host_header;
|
const char *host_header;
|
||||||
|
@@ -41,7 +41,7 @@ static long int data_check = 0;
|
|||||||
|
|
||||||
#if !defined(NO_SSL)
|
#if !defined(NO_SSL)
|
||||||
|
|
||||||
int XX_httplib_refresh_trust( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
int XX_httplib_refresh_trust( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
volatile int *p_reload_lock;
|
volatile int *p_reload_lock;
|
||||||
struct stat cert_buf;
|
struct stat cert_buf;
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_remove_bad_file( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path );
|
* void XX_httplib_remove_bad_file( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_remove_bad_file() removes an invalid file and throws
|
* The function XX_httplib_remove_bad_file() removes an invalid file and throws
|
||||||
* an error message if this does not succeed.
|
* an error message if this does not succeed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_remove_bad_file( const struct httplib_context *ctx, const struct httplib_connection *conn, const char *path ) {
|
void XX_httplib_remove_bad_file( const struct lh_ctx_t *ctx, const struct httplib_connection *conn, const char *path ) {
|
||||||
|
|
||||||
int r = httplib_remove( path );
|
int r = httplib_remove( path );
|
||||||
|
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_remove_directory( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir );
|
* int XX_httplib_remove_directory( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_remove_directory() removes recursively a directory
|
* The function XX_httplib_remove_directory() removes recursively a directory
|
||||||
* tree.
|
* tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_remove_directory( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir ) {
|
int XX_httplib_remove_directory( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir ) {
|
||||||
|
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
|
|
||||||
int XX_httplib_scan_directory( const struct httplib_context *ctx, struct httplib_connection *conn, const char *dir, void *data, void (*cb)(const struct httplib_context *ctx, struct de *, void *) ) {
|
int XX_httplib_scan_directory( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *dir, void *data, void (*cb)(const struct lh_ctx_t *ctx, struct de *, void *) ) {
|
||||||
|
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "httplib_pthread.h"
|
#include "httplib_pthread.h"
|
||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
void XX_httplib_send_authorization_request( struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_send_authorization_request( struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
char date[64];
|
char date[64];
|
||||||
time_t curtime;
|
time_t curtime;
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_send_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers );
|
* void httplib_send_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers );
|
||||||
*
|
*
|
||||||
* The function httplib_send_file() sends a file to the other peer. Optionally
|
* The function httplib_send_file() sends a file to the other peer. Optionally
|
||||||
* the MIME type and additional headers can be specified.
|
* the MIME type and additional headers can be specified.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void httplib_send_file( const struct httplib_context *ctx, struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers ) {
|
void httplib_send_file( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *path, const char *mime_type, const char *additional_headers ) {
|
||||||
|
|
||||||
struct file file = STRUCT_FILE_INITIALIZER;
|
struct file file = STRUCT_FILE_INITIALIZER;
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
* Send len bytes from the opened file to the client.
|
* Send len bytes from the opened file to the client.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_send_file_data( const struct httplib_context *ctx, struct httplib_connection *conn, struct file *filep, int64_t offset, int64_t len ) {
|
void XX_httplib_send_file_data( const struct lh_ctx_t *ctx, struct httplib_connection *conn, struct file *filep, int64_t offset, int64_t len ) {
|
||||||
|
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "httplib_string.h"
|
#include "httplib_string.h"
|
||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
void XX_httplib_send_http_error( const struct httplib_context *ctx, struct httplib_connection *conn, int status, const char *fmt, ... ) {
|
void XX_httplib_send_http_error( const struct lh_ctx_t *ctx, struct httplib_connection *conn, int status, const char *fmt, ... ) {
|
||||||
|
|
||||||
char buf[MG_BUF_LEN];
|
char buf[MG_BUF_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
int XX_httplib_send_no_cache_header( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
int XX_httplib_send_no_cache_header( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send all current and obsolete cache opt-out directives.
|
* Send all current and obsolete cache opt-out directives.
|
||||||
|
@@ -29,13 +29,13 @@
|
|||||||
#include "httplib_utils.h"
|
#include "httplib_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void XX_httplib_send_options( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* void XX_httplib_send_options( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_send_options() sends a list of allowed options a
|
* The function XX_httplib_send_options() sends a list of allowed options a
|
||||||
* client can use to connect to the server.
|
* client can use to connect to the server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_send_options( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
void XX_httplib_send_options( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
char date[64];
|
char date[64];
|
||||||
time_t curtime;
|
time_t curtime;
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httlib_send_static_cache_header( const struct httplib_context *ctx, struct httplib_connection *conn );
|
* int XX_httlib_send_static_cache_header( const struct lh_ctx_t *ctx, struct httplib_connection *conn );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_send_static_cache_header() sends cache headers
|
* The function XX_httplib_send_static_cache_header() sends cache headers
|
||||||
* depending on the cache setting of the current context.
|
* depending on the cache setting of the current context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_send_static_cache_header( const struct httplib_context *ctx, struct httplib_connection *conn ) {
|
int XX_httplib_send_static_cache_header( const struct lh_ctx_t *ctx, struct httplib_connection *conn ) {
|
||||||
|
|
||||||
if ( ctx == NULL || conn == NULL ) return 0;
|
if ( ctx == NULL || conn == NULL ) return 0;
|
||||||
|
|
||||||
|
@@ -32,13 +32,13 @@
|
|||||||
#define B64_SHA_LEN (sizeof(sha)*2)
|
#define B64_SHA_LEN (sizeof(sha)*2)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_send_websocket_handshake( const struct httplib_context *ctx, struct httplib_connection *conn, const char *websock_key );
|
* int XX_httplib_send_websocket_handshake( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *websock_key );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_send_websocket_handshake() sends a handshake over
|
* The function XX_httplib_send_websocket_handshake() sends a handshake over
|
||||||
* a websocket connection.
|
* a websocket connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_send_websocket_handshake( const struct httplib_context *ctx, struct httplib_connection *conn, const char *websock_key ) {
|
int XX_httplib_send_websocket_handshake( const struct lh_ctx_t *ctx, struct httplib_connection *conn, const char *websock_key ) {
|
||||||
|
|
||||||
static const char *magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
static const char *magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||||
const char *protocol;
|
const char *protocol;
|
||||||
|
@@ -28,12 +28,12 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_set_acl_option( struct httplib_context *ctx );
|
* int XX_httplib_set_acl_option( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_set_acl_option() sets the ACL option for a context.
|
* The function XX_httplib_set_acl_option() sets the ACL option for a context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_set_acl_option( struct httplib_context *ctx ) {
|
int XX_httplib_set_acl_option( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
return XX_httplib_check_acl( ctx, (uint32_t)0x7f000001UL ) != -1;
|
return XX_httplib_check_acl( ctx, (uint32_t)0x7f000001UL ) != -1;
|
||||||
|
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_set_auth_handler( struct httplib_context *ctx, const char *uri, httplib_request_handler handler, void *cbdata );
|
* void httplib_set_auth_handler( struct lh_ctx_t *ctx, const char *uri, httplib_request_handler handler, void *cbdata );
|
||||||
*
|
*
|
||||||
* The function httplib_set_auth_handler() sets the callback function which handles
|
* The function httplib_set_auth_handler() sets the callback function which handles
|
||||||
* authorization requests.
|
* authorization requests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LIBHTTP_API void httplib_set_auth_handler( struct httplib_context *ctx, const char *uri, httplib_request_handler handler, void *cbdata ) {
|
LIBHTTP_API void httplib_set_auth_handler( struct lh_ctx_t *ctx, const char *uri, httplib_request_handler handler, void *cbdata ) {
|
||||||
|
|
||||||
XX_httplib_set_handler_type( ctx, uri, AUTH_HANDLER, (handler == NULL), NULL, NULL, NULL, NULL, NULL, handler, cbdata );
|
XX_httplib_set_handler_type( ctx, uri, AUTH_HANDLER, (handler == NULL), NULL, NULL, NULL, NULL, NULL, handler, cbdata );
|
||||||
|
|
||||||
|
@@ -23,13 +23,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* enum debug_level_t httplib_set_debug_level( struct httplib_context *ctx, enum debug_level_t new_level );
|
* enum debug_level_t httplib_set_debug_level( struct lh_ctx_t *ctx, enum debug_level_t new_level );
|
||||||
*
|
*
|
||||||
* The function httplib_get_debug_level() sets the debug level for a context
|
* The function httplib_get_debug_level() sets the debug level for a context
|
||||||
* and returns the previous debug level.
|
* and returns the previous debug level.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum debug_level_t httplib_set_debug_level( struct httplib_context *ctx, enum debug_level_t new_level ) {
|
enum debug_level_t httplib_set_debug_level( struct lh_ctx_t *ctx, enum debug_level_t new_level ) {
|
||||||
|
|
||||||
enum debug_level_t prev_level;
|
enum debug_level_t prev_level;
|
||||||
|
|
||||||
|
@@ -28,14 +28,14 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_set_gpass_option( struct httplib_context *ctx );
|
* bool XX_httplib_set_gpass_option( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_set_gpass_option() sets the global password file
|
* The function XX_httplib_set_gpass_option() sets the global password file
|
||||||
* option for a context. The function returns false when an error occurs and
|
* option for a context. The function returns false when an error occurs and
|
||||||
* true when successful.
|
* true when successful.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_set_gpass_option( struct httplib_context *ctx ) {
|
bool XX_httplib_set_gpass_option( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
struct file file = STRUCT_FILE_INITIALIZER;
|
struct file file = STRUCT_FILE_INITIALIZER;
|
||||||
const char *path;
|
const char *path;
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
* sets callback handlers to uri's.
|
* sets callback handlers to uri's.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void XX_httplib_set_handler_type( struct httplib_context *ctx, const char *uri, int handler_type, int is_delete_request, httplib_request_handler handler, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, httplib_authorization_handler auth_handler, void *cbdata ) {
|
void XX_httplib_set_handler_type( struct lh_ctx_t *ctx, const char *uri, int handler_type, int is_delete_request, httplib_request_handler handler, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, httplib_authorization_handler auth_handler, void *cbdata ) {
|
||||||
|
|
||||||
struct httplib_handler_info *tmp_rh;
|
struct httplib_handler_info *tmp_rh;
|
||||||
struct httplib_handler_info **lastref;
|
struct httplib_handler_info **lastref;
|
||||||
|
@@ -31,14 +31,14 @@
|
|||||||
static bool parse_port_string( const struct vec *vec, struct socket *so, int *ip_version );
|
static bool parse_port_string( const struct vec *vec, struct socket *so, int *ip_version );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int XX_httplib_set_ports_option( struct httplib_context *ctx );
|
* int XX_httplib_set_ports_option( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_set_ports_option() set the port options for a
|
* The function XX_httplib_set_ports_option() set the port options for a
|
||||||
* context. The function returns the total number of ports opened, or 0 if no
|
* context. The function returns the total number of ports opened, or 0 if no
|
||||||
* ports have been opened.
|
* ports have been opened.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int XX_httplib_set_ports_option( struct httplib_context *ctx ) {
|
int XX_httplib_set_ports_option( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
const char *list;
|
const char *list;
|
||||||
char error_string[ERROR_STRING_LEN];
|
char error_string[ERROR_STRING_LEN];
|
||||||
|
@@ -28,13 +28,13 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void httplib_set_request_handler( httplib_context *ctx, const char *uri, httplib_request_handler handler, void *cbdata );
|
* void httplib_set_request_handler( struct lh_ctx_t *ctx, const char *uri, httplib_request_handler handler, void *cbdata );
|
||||||
*
|
*
|
||||||
* The function httplib_set_request_handler() sets a request handler for a specific
|
* The function httplib_set_request_handler() sets a request handler for a specific
|
||||||
* uri in a server context.
|
* uri in a server context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LIBHTTP_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 lh_ctx_t *ctx, const char *uri, httplib_request_handler handler, void *cbdata ) {
|
||||||
|
|
||||||
XX_httplib_set_handler_type( ctx, uri, REQUEST_HANDLER, (handler == NULL), handler, NULL, NULL, NULL, NULL, NULL, cbdata );
|
XX_httplib_set_handler_type( ctx, uri, REQUEST_HANDLER, (handler == NULL), handler, NULL, NULL, NULL, NULL, NULL, cbdata );
|
||||||
|
|
||||||
|
@@ -31,14 +31,14 @@
|
|||||||
static void *ssllib_dll_handle; /* Store the ssl library handle. */
|
static void *ssllib_dll_handle; /* Store the ssl library handle. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_set_ssl_option( struct httplib_context *ctx );
|
* bool XX_httplib_set_ssl_option( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_set_ssl_option() loads the SSL library in a dynamic
|
* The function XX_httplib_set_ssl_option() loads the SSL library in a dynamic
|
||||||
* way. The function returns false if an error occured, otherwise true.
|
* way. The function returns false if an error occured, otherwise true.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(NO_SSL)
|
#if !defined(NO_SSL)
|
||||||
bool XX_httplib_set_ssl_option( struct httplib_context *ctx ) {
|
bool XX_httplib_set_ssl_option( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
const char *pem;
|
const char *pem;
|
||||||
int callback_ret;
|
int callback_ret;
|
||||||
|
@@ -54,7 +54,7 @@ typedef struct tagTHREADNAME_INFO {
|
|||||||
|
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
void XX_httplib_set_thread_name( const struct httplib_context *ctx, const char *name ) {
|
void XX_httplib_set_thread_name( const struct lh_ctx_t *ctx, const char *name ) {
|
||||||
|
|
||||||
char thread_name[16+1]; /* 16 = Max. thread length in Linux/OSX/.. */
|
char thread_name[16+1]; /* 16 = Max. thread length in Linux/OSX/.. */
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "httplib_main.h"
|
#include "httplib_main.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bool XX_httplib_set_uid_option( struct httplib_contect *ctx );
|
* bool XX_httplib_set_uid_option( struct lh_ctx_t *ctx );
|
||||||
*
|
*
|
||||||
* The function XX_httplib_set_uid_option() runs on systems which support it
|
* The function XX_httplib_set_uid_option() runs on systems which support it
|
||||||
* the context in the security environment of a specific user. The function can
|
* the context in the security environment of a specific user. The function can
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
* False is returned in case a problem is detected, true otherwise.
|
* False is returned in case a problem is detected, true otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool XX_httplib_set_uid_option( struct httplib_context *ctx ) {
|
bool XX_httplib_set_uid_option( struct lh_ctx_t *ctx ) {
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user