1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-08-06 05:02:40 +03:00

Replaced httplib_request_info with lh_rqi_t

This commit is contained in:
Lammert Bies
2017-01-02 03:25:52 +01:00
parent ad5ed828a0
commit 61aeb7718f
12 changed files with 21 additions and 21 deletions

View File

@@ -152,7 +152,7 @@ struct lh_con_t; /* Handle for the individual connection */
/************************************************************************************************/ /************************************************************************************************/
/* */ /* */
/* This structure contains information about the HTTP request. */ /* This structure contains information about the HTTP request. */
struct httplib_request_info { /* */ struct lh_rqi_t { /* */
const char * request_method; /* "GET", "POST", etc */ const char * request_method; /* "GET", "POST", etc */
const char * request_uri; /* URL-decoded URI (absolute or relative, as in the request) */ const char * request_uri; /* URL-decoded URI (absolute or relative, as in the request) */
const char * local_uri; /* URL-decoded URI (relative). Can be NULL if request_uri is not a resource at the server host */ const char * local_uri; /* URL-decoded URI (relative). Can be NULL if request_uri is not a resource at the server host */
@@ -176,7 +176,7 @@ struct httplib_request_info { /* */
/************************************************************************************************/ /************************************************************************************************/
/* Client certificate information (part of httplib_request_info) */ /* Client certificate information (part of lh_rqi_t) */
struct client_cert { struct client_cert {
const char *subject; const char *subject;
const char *issuer; const char *issuer;
@@ -300,7 +300,7 @@ LIBHTTP_API int httplib_modify_passwords_file(const char *passwords_file_name, c
/* Return information associated with the request. */ /* Return information associated with the request. */
LIBHTTP_API const struct httplib_request_info *httplib_get_request_info( const struct lh_con_t *conn ); LIBHTTP_API const struct lh_rqi_t *httplib_get_request_info( const struct lh_con_t *conn );
/* Send data to the client. /* Send data to the client.

View File

@@ -28,7 +28,7 @@
#include "httplib_main.h" #include "httplib_main.h"
/* Return HTTP header value, or NULL if not found. */ /* Return HTTP header value, or NULL if not found. */
const char *XX_httplib_get_header( const struct httplib_request_info *ri, const char *name ) { const char *XX_httplib_get_header( const struct lh_rqi_t *ri, const char *name ) {
int i; int i;

View File

@@ -37,7 +37,7 @@
int XX_httplib_get_request_handler( struct lh_ctx_t *ctx, struct lh_con_t *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 lh_con_t *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 lh_rqi_t *request_info;
const char *uri; const char *uri;
size_t urilen; size_t urilen;
struct httplib_handler_info *tmp_rh; struct httplib_handler_info *tmp_rh;

View File

@@ -27,7 +27,7 @@
#include "httplib_main.h" #include "httplib_main.h"
const struct httplib_request_info *httplib_get_request_info( const struct lh_con_t *conn ) { const struct lh_rqi_t *httplib_get_request_info( const struct lh_con_t *conn ) {
if ( conn == NULL ) return NULL; if ( conn == NULL ) return NULL;

View File

@@ -56,7 +56,7 @@ void XX_httplib_handle_cgi_request( const struct lh_ctx_t *ctx, struct lh_con_t
char error_string[ERROR_STRING_LEN]; char error_string[ERROR_STRING_LEN];
char *ptr; char *ptr;
const char *cptr; const char *cptr;
struct httplib_request_info ri; struct lh_rqi_t ri;
struct cgi_environment blk; struct cgi_environment blk;
FILE *in; FILE *in;
FILE *out; FILE *out;

View File

@@ -524,7 +524,7 @@ int httplib_handle_form_request( const struct lh_ctx_t *ctx, struct lh_con_t *co
const char *boundary; const char *boundary;
size_t bl; size_t bl;
ptrdiff_t used; ptrdiff_t used;
struct httplib_request_info part_header; struct lh_rqi_t part_header;
char *hbuf; char *hbuf;
char *hend; char *hend;
char *fbeg; char *fbeg;

View File

@@ -40,7 +40,7 @@
void XX_httplib_handle_request( struct lh_ctx_t *ctx, struct lh_con_t *conn ) { void XX_httplib_handle_request( struct lh_ctx_t *ctx, struct lh_con_t *conn ) {
struct httplib_request_info *ri; struct lh_rqi_t *ri;
char path[PATH_MAX]; char path[PATH_MAX];
int uri_len; int uri_len;
int ssl_index; int ssl_index;

View File

@@ -39,7 +39,7 @@ static const char *header_val( const struct lh_con_t *conn, const char *header )
void XX_httplib_log_access( const struct lh_ctx_t *ctx, const struct lh_con_t *conn ) { void XX_httplib_log_access( const struct lh_ctx_t *ctx, const struct lh_con_t *conn ) {
const struct httplib_request_info *ri; const struct lh_rqi_t *ri;
struct file fi; struct file fi;
char date[64]; char date[64];
char src_addr[IP_ADDR_STR_LEN]; char src_addr[IP_ADDR_STR_LEN];

View File

@@ -616,7 +616,7 @@ struct lh_ctx_t {
/****************************************************************************************/ /****************************************************************************************/
struct lh_con_t { /* */ struct lh_con_t { /* */
struct httplib_request_info request_info; /* The request info of the connection */ struct lh_rqi_t request_info; /* The request info of the connection */
SSL * ssl; /* SSL descriptor */ SSL * ssl; /* SSL descriptor */
SSL_CTX * client_ssl_ctx; /* SSL context for client connections */ SSL_CTX * client_ssl_ctx; /* SSL context for client connections */
struct socket client; /* Connected client */ struct socket client; /* Connected client */
@@ -811,7 +811,7 @@ bool XX_httplib_fopen( const struct lh_ctx_t *ctx, const struct lh_con_t *conn
bool XX_httplib_forward_body_data( const struct lh_ctx_t *ctx, struct lh_con_t *conn, FILE *fp, SOCKET sock, SSL *ssl ); bool XX_httplib_forward_body_data( const struct lh_ctx_t *ctx, struct lh_con_t *conn, FILE *fp, SOCKET sock, SSL *ssl );
void XX_httplib_free_config_options( struct lh_ctx_t *ctx ); void XX_httplib_free_config_options( struct lh_ctx_t *ctx );
void XX_httplib_free_context( struct lh_ctx_t *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 lh_rqi_t *ri, const char *name );
void XX_httplib_get_mime_type( const struct lh_ctx_t *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 lh_ctx_t *ctx, const char *uri, const struct lh_con_t *conn ); const char * XX_httplib_get_rel_url_at_current_server( const struct lh_ctx_t *ctx, const char *uri, const struct lh_con_t *conn );
uint32_t XX_httplib_get_remote_ip( const struct lh_con_t *conn ); uint32_t XX_httplib_get_remote_ip( const struct lh_con_t *conn );
@@ -852,8 +852,8 @@ 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 lh_ctx_t *ctx, struct lh_con_t *conn, char *buf, size_t buf_size, struct ah *ah ); int XX_httplib_parse_auth_header( const struct lh_ctx_t *ctx, struct lh_con_t *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 lh_rqi_t *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 lh_rqi_t *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 );

View File

@@ -28,7 +28,7 @@
#include "httplib_main.h" #include "httplib_main.h"
/* /*
* int XX_httplib_parse_http_headers( char **buf, struct httplib_request_info *ri ); * int XX_httplib_parse_http_headers( char **buf, struct lh_rqi_t *ri );
* *
* The function XX_httplib_parse_http_headers() parses the HTTP headers from * The function XX_httplib_parse_http_headers() parses the HTTP headers from
* the given buffer. The buf pointer is advanced to the point where parsing * the given buffer. The buf pointer is advanced to the point where parsing
@@ -36,7 +36,7 @@
* headers read is returned, or a negative value if an error occured. * headers read is returned, or a negative value if an error occured.
*/ */
int XX_httplib_parse_http_headers( char **buf, struct httplib_request_info *ri ) { int XX_httplib_parse_http_headers( char **buf, struct lh_rqi_t *ri ) {
int i; int i;

View File

@@ -28,21 +28,21 @@
#include "httplib_main.h" #include "httplib_main.h"
/* /*
* 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 lh_rqi_t *ri );
* *
* The function XX_httplib_parse_http_message() parses an HTTP request and * The function XX_httplib_parse_http_message() parses an HTTP request and
* fills in the httplib_request_info structure. This function modifies the buffer by * fills in the lh_rqi_t structure. This function modifies the buffer by
* NUL terminating HTTP request components, header names and header values. * NUL terminating HTTP request components, header names and header values.
* Parameters: * Parameters:
* buf (in/out) pointer to the HTTP header to parse and split * buf (in/out) pointer to the HTTP header to parse and split
* len (in) length of the HTTP header buffer * len (in) length of the HTTP header buffer
* ri (out) parsed header as a httplib_request_info structure * ri (out) parsed header as a lh_rqi_t structure
* The parameters buf and ri must be valid pointers (not NULL) with a length * The parameters buf and ri must be valid pointers (not NULL) with a length
* larger than zero. On error the function return a negative value, otherwise * larger than zero. On error the function return a negative value, otherwise
* the length of the request is returned. * the length of the request is returned.
*/ */
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 lh_rqi_t *ri ) {
int is_request; int is_request;
int request_length; int request_length;

View File

@@ -37,7 +37,7 @@
void XX_httplib_process_new_connection( struct lh_ctx_t *ctx, struct lh_con_t *conn ) { void XX_httplib_process_new_connection( struct lh_ctx_t *ctx, struct lh_con_t *conn ) {
struct httplib_request_info *ri; struct lh_rqi_t *ri;
int keep_alive; int keep_alive;
int discard_len; int discard_len;
bool was_error; bool was_error;