diff --git a/src/httplib_config_options.c b/src/httplib_config_options.c index 3580c686..5c63bfba 100644 --- a/src/httplib_config_options.c +++ b/src/httplib_config_options.c @@ -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 }, diff --git a/src/httplib_main.h b/src/httplib_main.h index a780df06..a7f645c3 100644 --- a/src/httplib_main.h +++ b/src/httplib_main.h @@ -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; diff --git a/src/httplib_should_decode_url.c b/src/httplib_should_decode_url.c index 73462e12..8930dcac 100644 --- a/src/httplib_should_decode_url.c +++ b/src/httplib_should_decode_url.c @@ -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 */ diff --git a/src/httplib_start.c b/src/httplib_start.c index 19aa18e9..6037aa0c 100644 --- a/src/httplib_start.c +++ b/src/httplib_start.c @@ -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 );