comparison src/http/modules/ngx_http_scgi_module.c @ 692:6db6e93f55ee NGINX_1_3_9

nginx 1.3.9 *) Feature: support for chunked transfer encoding while reading client request body. *) Feature: the $request_time and $msec variables can now be used not only in the "log_format" directive. *) Bugfix: cache manager and cache loader processes might not be able to start if more than 512 listen sockets were used. *) Bugfix: in the ngx_http_dav_module.
author Igor Sysoev <http://sysoev.ru>
date Tue, 27 Nov 2012 00:00:00 +0400
parents 4dcaf40cc702
children 88a1b4797f2e
comparison
equal deleted inserted replaced
691:acfd484db0ca 692:6db6e93f55ee
531 531
532 532
533 static ngx_int_t 533 static ngx_int_t
534 ngx_http_scgi_create_request(ngx_http_request_t *r) 534 ngx_http_scgi_create_request(ngx_http_request_t *r)
535 { 535 {
536 off_t content_length_n;
536 u_char ch, *key, *val, *lowcase_key; 537 u_char ch, *key, *val, *lowcase_key;
537 size_t len, key_len, val_len, allocated; 538 size_t len, key_len, val_len, allocated;
538 ngx_buf_t *b; 539 ngx_buf_t *b;
539 ngx_str_t *content_length; 540 ngx_str_t content_length;
540 ngx_uint_t i, n, hash, skip_empty, header_params; 541 ngx_uint_t i, n, hash, skip_empty, header_params;
541 ngx_chain_t *cl, *body; 542 ngx_chain_t *cl, *body;
542 ngx_list_part_t *part; 543 ngx_list_part_t *part;
543 ngx_table_elt_t *header, **ignored; 544 ngx_table_elt_t *header, **ignored;
544 ngx_http_script_code_pt code; 545 ngx_http_script_code_pt code;
545 ngx_http_script_engine_t e, le; 546 ngx_http_script_engine_t e, le;
546 ngx_http_scgi_loc_conf_t *scf; 547 ngx_http_scgi_loc_conf_t *scf;
547 ngx_http_script_len_code_pt lcode; 548 ngx_http_script_len_code_pt lcode;
548 static ngx_str_t zero = ngx_string("0"); 549 u_char buffer[NGX_OFF_T_LEN];
549 550
550 content_length = r->headers_in.content_length ? 551 content_length_n = 0;
551 &r->headers_in.content_length->value : &zero; 552 body = r->upstream->request_bufs;
552 553
553 len = sizeof("CONTENT_LENGTH") + content_length->len + 1; 554 while (body) {
555 content_length_n += ngx_buf_size(body->buf);
556 body = body->next;
557 }
558
559 content_length.data = buffer;
560 content_length.len = ngx_sprintf(buffer, "%O", content_length_n) - buffer;
561
562 len = sizeof("CONTENT_LENGTH") + content_length.len + 1;
554 563
555 header_params = 0; 564 header_params = 0;
556 ignored = NULL; 565 ignored = NULL;
557 566
558 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module); 567 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
670 return NGX_ERROR; 679 return NGX_ERROR;
671 } 680 }
672 681
673 cl->buf = b; 682 cl->buf = b;
674 683
675 b->last = ngx_snprintf(b->last, 684 b->last = ngx_sprintf(b->last, "%ui:CONTENT_LENGTH%Z%V%Z",
676 NGX_SIZE_T_LEN + 1 + sizeof("CONTENT_LENGTH") 685 len, &content_length);
677 + NGX_OFF_T_LEN + 1,
678 "%ui:CONTENT_LENGTH%Z%V%Z",
679 len, content_length);
680 686
681 if (scf->params_len) { 687 if (scf->params_len) {
682 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); 688 ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
683 689
684 e.ip = scf->params->elts; 690 e.ip = scf->params->elts;