mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-09 03:22:45 +03:00
decode_url now fast
This commit is contained in:
@@ -60,7 +60,6 @@ struct httplib_option XX_httplib_config_options[] = {
|
|||||||
{ "ssl_cipher_list", CONFIG_TYPE_STRING, NULL },
|
{ "ssl_cipher_list", CONFIG_TYPE_STRING, NULL },
|
||||||
{ "ssl_protocol_version", CONFIG_TYPE_NUMBER, "0" },
|
{ "ssl_protocol_version", CONFIG_TYPE_NUMBER, "0" },
|
||||||
{ "websocket_timeout_ms", CONFIG_TYPE_NUMBER, "30000" },
|
{ "websocket_timeout_ms", CONFIG_TYPE_NUMBER, "30000" },
|
||||||
{ "decode_url", CONFIG_TYPE_BOOLEAN, "yes" },
|
|
||||||
{ "websocket_root", CONFIG_TYPE_DIRECTORY, NULL },
|
{ "websocket_root", CONFIG_TYPE_DIRECTORY, NULL },
|
||||||
{ "access_control_allow_origin", CONFIG_TYPE_STRING, "*" },
|
{ "access_control_allow_origin", CONFIG_TYPE_STRING, "*" },
|
||||||
{ "error_pages", CONFIG_TYPE_DIRECTORY, NULL },
|
{ "error_pages", CONFIG_TYPE_DIRECTORY, NULL },
|
||||||
|
@@ -419,7 +419,6 @@ enum {
|
|||||||
SSL_CIPHER_LIST,
|
SSL_CIPHER_LIST,
|
||||||
SSL_PROTOCOL_VERSION,
|
SSL_PROTOCOL_VERSION,
|
||||||
WEBSOCKET_TIMEOUT,
|
WEBSOCKET_TIMEOUT,
|
||||||
DECODE_URL,
|
|
||||||
WEBSOCKET_ROOT,
|
WEBSOCKET_ROOT,
|
||||||
ACCESS_CONTROL_ALLOW_ORIGIN,
|
ACCESS_CONTROL_ALLOW_ORIGIN,
|
||||||
ERROR_PAGES,
|
ERROR_PAGES,
|
||||||
@@ -606,6 +605,7 @@ struct httplib_context {
|
|||||||
struct ttimers *timers;
|
struct ttimers *timers;
|
||||||
#endif
|
#endif
|
||||||
bool allow_sendfile_call;
|
bool allow_sendfile_call;
|
||||||
|
bool decode_url;
|
||||||
bool enable_directory_listing;
|
bool enable_directory_listing;
|
||||||
bool enable_keep_alive;
|
bool enable_keep_alive;
|
||||||
bool ssl_short_trust;
|
bool ssl_short_trust;
|
||||||
|
@@ -26,9 +26,6 @@
|
|||||||
|
|
||||||
bool XX_httplib_should_decode_url( const struct httplib_connection *conn ) {
|
bool XX_httplib_should_decode_url( const struct httplib_connection *conn ) {
|
||||||
|
|
||||||
if ( conn == NULL || conn->ctx == NULL ) return false;
|
return ( conn != NULL && conn->ctx != NULL && conn->ctx->decode_url );
|
||||||
if ( conn->ctx->cfg[DECODE_URL] == NULL ) return false;
|
|
||||||
|
|
||||||
return ( ! httplib_strcasecmp( conn->ctx->cfg[DECODE_URL], "yes" ) );
|
|
||||||
|
|
||||||
} /* XX_httplib_should_decode_url */
|
} /* XX_httplib_should_decode_url */
|
||||||
|
@@ -285,6 +285,7 @@ static bool process_options ( struct httplib_context *ctx, const struct httplib_
|
|||||||
if ( ctx == NULL ) return false;
|
if ( ctx == NULL ) return false;
|
||||||
|
|
||||||
ctx->allow_sendfile_call = true;
|
ctx->allow_sendfile_call = true;
|
||||||
|
ctx->decode_url = true;
|
||||||
ctx->enable_directory_listing = true;
|
ctx->enable_directory_listing = true;
|
||||||
ctx->enable_keep_alive = false;
|
ctx->enable_keep_alive = false;
|
||||||
ctx->ssl_short_trust = false;
|
ctx->ssl_short_trust = false;
|
||||||
@@ -294,6 +295,7 @@ static bool process_options ( struct httplib_context *ctx, const struct httplib_
|
|||||||
while ( options != NULL && options->name != NULL ) {
|
while ( options != NULL && options->name != NULL ) {
|
||||||
|
|
||||||
if ( ! httplib_strcasecmp( options->name, "allow_sendfile_call" ) ) ctx->allow_sendfile_call = XX_httplib_option_value_to_bool( options->value );
|
if ( ! httplib_strcasecmp( options->name, "allow_sendfile_call" ) ) ctx->allow_sendfile_call = XX_httplib_option_value_to_bool( options->value );
|
||||||
|
else if ( ! httplib_strcasecmp( options->name, "decode_url" ) ) ctx->decode_url = XX_httplib_option_value_to_bool( options->value );
|
||||||
else if ( ! httplib_strcasecmp( options->name, "enable_directory_listing" ) ) ctx->enable_directory_listing = XX_httplib_option_value_to_bool( options->value );
|
else if ( ! httplib_strcasecmp( options->name, "enable_directory_listing" ) ) ctx->enable_directory_listing = XX_httplib_option_value_to_bool( options->value );
|
||||||
else if ( ! httplib_strcasecmp( options->name, "enable_keep_alive" ) ) ctx->enable_keep_alive = XX_httplib_option_value_to_bool( options->value );
|
else if ( ! httplib_strcasecmp( options->name, "enable_keep_alive" ) ) ctx->enable_keep_alive = XX_httplib_option_value_to_bool( options->value );
|
||||||
else if ( ! httplib_strcasecmp( options->name, "ssl_short_trust" ) ) ctx->ssl_short_trust = XX_httplib_option_value_to_bool( options->value );
|
else if ( ! httplib_strcasecmp( options->name, "ssl_short_trust" ) ) ctx->ssl_short_trust = XX_httplib_option_value_to_bool( options->value );
|
||||||
|
Reference in New Issue
Block a user