Welcome! Log In Create A New Profile

Advanced

Re: 400 bad request for http m-post method

Maxim Dounin
October 05, 2016 11:28AM
Hello!

On Wed, Oct 05, 2016 at 10:40:05AM -0400, nixcoder wrote:

> Hi,
> I'm getting the below error in nginx reverse proxy server. It seems the
> proxy server does not recognize the http method: "M-POST" ? Is there a way i
> can allow these incoming requests ?
>
> nginx.1 | xxxx.xxx.xxx 10.x.xx.x - - [05/Oct/2016:10:31:57 +0000] "M-POST
> /cimom HTTP/1.1" 400 166 "-" "-"
> nginx.1 | xxxx.xxx.xxx 10.x.xx.x - - [05/Oct/2016:10:31:57 +0000] "M-POST
> /cimom HTTP/1.1" 400 166 "-" "-"

Only "A" .. "Z" and "_" are allowed in method names by nginx.
If you want to allow "M-POST", please try the following patch:

# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1475681003 -10800
# Wed Oct 05 18:23:23 2016 +0300
# Node ID fb39836bb3708b26629eaea06fe1221e39daa253
# Parent 9b9ae81cd4f01ed60e7bab323d49b470cec69d9e
Allowed '-' in method names.

It is used at least by SOAP (M-POST method, defined by RFC 2774) and
by WebDAV versioning (VERSION-CONTROL and BASELINE-CONTROL methods,
defined by RFC 3253).

diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -149,7 +149,7 @@ ngx_http_parse_request_line(ngx_http_req
break;
}

- if ((ch < 'A' || ch > 'Z') && ch != '_') {
+ if ((ch < 'A' || ch > 'Z') && ch != '_' && ch != '-') {
return NGX_HTTP_PARSE_INVALID_METHOD;
}

@@ -270,7 +270,7 @@ ngx_http_parse_request_line(ngx_http_req
break;
}

- if ((ch < 'A' || ch > 'Z') && ch != '_') {
+ if ((ch < 'A' || ch > 'Z') && ch != '_' && ch != '-') {
return NGX_HTTP_PARSE_INVALID_METHOD;
}



--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

400 bad request for http m-post method

nixcoder October 05, 2016 10:40AM

Re: 400 bad request for http m-post method

Maxim Dounin October 05, 2016 11:28AM

Re: 400 bad request for http m-post method

nixcoder October 08, 2016 11:05AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 217
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready