Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-03-30 22:59:26 +0400
committerIgor Sysoev <igor@sysoev.ru>2007-03-30 22:59:26 +0400
commit3e933d2919ed7672127e4bd766f213c75a6ea3c4 (patch)
treebf39b0fd163a28a35afb6225b7af963653fac605 /src
parent9b6548f4e4eda4cf38c4274a9a8c45efe53b6d9c (diff)
disable TRACE method
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_parse.c6
-rw-r--r--src/http/ngx_http_request.c7
-rw-r--r--src/http/ngx_http_request.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
index 135208ef0..6d0f84877 100644
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -146,6 +146,12 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b)
r->method = NGX_HTTP_MKCOL;
}
+ if (m[0] == 'T' && m[1] == 'R'
+ && m[2] == 'A' && m[3] == 'C' && m[4] == 'E')
+ {
+ r->method = NGX_HTTP_TRACE;
+ }
+
break;
case 6:
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index afc1d644d..1a2e1bc27 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1267,6 +1267,13 @@ ngx_http_process_request_header(ngx_http_request_t *r)
return NGX_ERROR;
}
+ if (r->method & (NGX_HTTP_TRACE)) {
+ ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
+ "client sent TRACE method");
+ ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
+ return NGX_ERROR;
+ }
+
if (r->headers_in.transfer_encoding
&& ngx_strstr(r->headers_in.transfer_encoding->value.data, "chunked"))
{
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 787b36155..939e16960 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -37,6 +37,7 @@
#define NGX_HTTP_PROPPATCH 0x0800
#define NGX_HTTP_LOCK 0x1000
#define NGX_HTTP_UNLOCK 0x2000
+#define NGX_HTTP_TRACE 0x4000
#define NGX_HTTP_CONNECTION_CLOSE 1
#define NGX_HTTP_CONNECTION_KEEP_ALIVE 2