diff options
author | Jan Pazdziora <jpazdziora@redhat.com> | 2013-12-05 14:32:13 +0800 |
---|---|---|
committer | Jan Pazdziora <jpazdziora@redhat.com> | 2013-12-05 14:35:45 +0800 |
commit | 0a627d35147820e09ac1bd5b27993cdbd30df5ae (patch) | |
tree | 9945517341ebedd4c5280ef15d7c867b04da58bc | |
parent | c7d84548203f175da28a438ea7cb446c73d75cbf (diff) | |
download | mod_intercept_form_submit-0a627d35147820e09ac1bd5b27993cdbd30df5ae.tar.gz mod_intercept_form_submit-0a627d35147820e09ac1bd5b27993cdbd30df5ae.tar.xz mod_intercept_form_submit-0a627d35147820e09ac1bd5b27993cdbd30df5ae.zip |
Strip parameters like charset from request's Content-Type.
-rw-r--r-- | mod_intercept_form_submit.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/mod_intercept_form_submit.c b/mod_intercept_form_submit.c index 195f451..4d14990 100644 --- a/mod_intercept_form_submit.c +++ b/mod_intercept_form_submit.c @@ -428,13 +428,21 @@ void intercept_form_submit_init(request_rec * r) { return; } const char * content_type = apr_table_get(r->headers_in, "Content-Type"); - if (content_type && !apr_strnatcasecmp(content_type, _INTERCEPT_CONTENT_TYPE)) { - ap_filter_t * the_filter = ap_add_input_filter("intercept_form_submit_filter", NULL, r, r->connection); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "inserted filter intercept_form_submit_filter, starting intercept_form_submit_filter_prefetch"); - intercept_form_submit_filter_prefetch(r, config, the_filter); - } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "skipping, no " _INTERCEPT_CONTENT_TYPE); + if (content_type) { + char * content_type_pure = apr_pstrdup(r->pool, content_type); + char * sep; + if ((sep = strchr(content_type_pure, ';'))) { + *sep = '\0'; + } + apr_collapse_spaces(content_type_pure, content_type_pure); + if (!apr_strnatcasecmp(content_type_pure, _INTERCEPT_CONTENT_TYPE)) { + ap_filter_t * the_filter = ap_add_input_filter("intercept_form_submit_filter", NULL, r, r->connection); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "inserted filter intercept_form_submit_filter, starting intercept_form_submit_filter_prefetch"); + intercept_form_submit_filter_prefetch(r, config, the_filter); + return; + } } + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "skipping, no " _INTERCEPT_CONTENT_TYPE); } void * create_dir_conf(apr_pool_t * pool, char * dir) { |