comparison src/http/modules/ngx_http_dav_module.c @ 7609:f609c0ac2972

Dav: added checks for chunked to body presence conditions. These checks were missed when chunked support was introduced. And also added an explicit error message to ngx_http_dav_copy_move_handler() (it was missed for some reason, in contrast to DELETE and MKCOL handlers).
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 23 Dec 2019 20:39:27 +0300
parents b399246ea45d
children 1bde031b59ff
comparison
equal deleted inserted replaced
7608:4718a646187a 7609:f609c0ac2972
310 ngx_uint_t i, d, dir; 310 ngx_uint_t i, d, dir;
311 ngx_str_t path; 311 ngx_str_t path;
312 ngx_file_info_t fi; 312 ngx_file_info_t fi;
313 ngx_http_dav_loc_conf_t *dlcf; 313 ngx_http_dav_loc_conf_t *dlcf;
314 314
315 if (r->headers_in.content_length_n > 0) { 315 if (r->headers_in.content_length_n > 0 || r->headers_in.chunked) {
316 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 316 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
317 "DELETE with body is unsupported"); 317 "DELETE with body is unsupported");
318 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; 318 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
319 } 319 }
320 320
493 { 493 {
494 u_char *p; 494 u_char *p;
495 size_t root; 495 size_t root;
496 ngx_str_t path; 496 ngx_str_t path;
497 497
498 if (r->headers_in.content_length_n > 0) { 498 if (r->headers_in.content_length_n > 0 || r->headers_in.chunked) {
499 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 499 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
500 "MKCOL with body is unsupported"); 500 "MKCOL with body is unsupported");
501 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; 501 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
502 } 502 }
503 503
547 ngx_table_elt_t *dest, *over; 547 ngx_table_elt_t *dest, *over;
548 ngx_ext_rename_file_t ext; 548 ngx_ext_rename_file_t ext;
549 ngx_http_dav_copy_ctx_t copy; 549 ngx_http_dav_copy_ctx_t copy;
550 ngx_http_dav_loc_conf_t *dlcf; 550 ngx_http_dav_loc_conf_t *dlcf;
551 551
552 if (r->headers_in.content_length_n > 0) { 552 if (r->headers_in.content_length_n > 0 || r->headers_in.chunked) {
553 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
554 "COPY and MOVE with body are unsupported");
553 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE; 555 return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
554 } 556 }
555 557
556 dest = r->headers_in.destination; 558 dest = r->headers_in.destination;
557 559