1
0
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:
Lammert Bies
2016-12-28 04:34:22 +01:00
parent 02322ff27b
commit defb3219d0
4 changed files with 4 additions and 6 deletions

View File

@@ -60,7 +60,6 @@ struct httplib_option XX_httplib_config_options[] = {
{ "ssl_cipher_list", CONFIG_TYPE_STRING, NULL },
{ "ssl_protocol_version", CONFIG_TYPE_NUMBER, "0" },
{ "websocket_timeout_ms", CONFIG_TYPE_NUMBER, "30000" },
{ "decode_url", CONFIG_TYPE_BOOLEAN, "yes" },
{ "websocket_root", CONFIG_TYPE_DIRECTORY, NULL },
{ "access_control_allow_origin", CONFIG_TYPE_STRING, "*" },
{ "error_pages", CONFIG_TYPE_DIRECTORY, NULL },

View File

@@ -419,7 +419,6 @@ enum {
SSL_CIPHER_LIST,
SSL_PROTOCOL_VERSION,
WEBSOCKET_TIMEOUT,
DECODE_URL,
WEBSOCKET_ROOT,
ACCESS_CONTROL_ALLOW_ORIGIN,
ERROR_PAGES,
@@ -606,6 +605,7 @@ struct httplib_context {
struct ttimers *timers;
#endif
bool allow_sendfile_call;
bool decode_url;
bool enable_directory_listing;
bool enable_keep_alive;
bool ssl_short_trust;

View File

@@ -26,9 +26,6 @@
bool XX_httplib_should_decode_url( const struct httplib_connection *conn ) {
if ( conn == NULL || conn->ctx == NULL ) return false;
if ( conn->ctx->cfg[DECODE_URL] == NULL ) return false;
return ( ! httplib_strcasecmp( conn->ctx->cfg[DECODE_URL], "yes" ) );
return ( conn != NULL && conn->ctx != NULL && conn->ctx->decode_url );
} /* XX_httplib_should_decode_url */

View File

@@ -285,6 +285,7 @@ static bool process_options ( struct httplib_context *ctx, const struct httplib_
if ( ctx == NULL ) return false;
ctx->allow_sendfile_call = true;
ctx->decode_url = true;
ctx->enable_directory_listing = true;
ctx->enable_keep_alive = 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 ) {
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_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 );