comparison src/http/modules/ngx_http_uwsgi_module.c @ 3629:a2a3378824ba

fix r3628
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Jun 2010 15:27:06 +0000
parents cf47471a9eda
children b5819529738a
comparison
equal deleted inserted replaced
3628:cf47471a9eda 3629:a2a3378824ba
32 ngx_str_t uwsgi_string; 32 ngx_str_t uwsgi_string;
33 33
34 ngx_uint_t modifier1; 34 ngx_uint_t modifier1;
35 ngx_uint_t modifier2; 35 ngx_uint_t modifier2;
36 } ngx_http_uwsgi_loc_conf_t; 36 } ngx_http_uwsgi_loc_conf_t;
37
38
39 typedef struct {
40 ngx_uint_t status;
41 ngx_uint_t status_count;
42 u_char *status_start;
43 u_char *status_end;
44 } ngx_http_uwsgi_ctx_t;
45
46
47 #define NGX_HTTP_UWSGI_PARSE_NO_HEADER 20
48 37
49 38
50 static ngx_int_t ngx_http_uwsgi_eval(ngx_http_request_t *r, 39 static ngx_int_t ngx_http_uwsgi_eval(ngx_http_request_t *r,
51 ngx_http_uwsgi_loc_conf_t *uwcf); 40 ngx_http_uwsgi_loc_conf_t *uwcf);
52 static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r); 41 static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r);
422 411
423 static ngx_int_t 412 static ngx_int_t
424 ngx_http_uwsgi_handler(ngx_http_request_t *r) 413 ngx_http_uwsgi_handler(ngx_http_request_t *r)
425 { 414 {
426 ngx_int_t rc; 415 ngx_int_t rc;
416 ngx_http_status_t *status;
427 ngx_http_upstream_t *u; 417 ngx_http_upstream_t *u;
428 ngx_http_uwsgi_ctx_t *ctx;
429 ngx_http_uwsgi_loc_conf_t *uwcf; 418 ngx_http_uwsgi_loc_conf_t *uwcf;
430 419
431 if (r->subrequest_in_memory) { 420 if (r->subrequest_in_memory) {
432 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 421 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
433 "ngx_http_uwsgi_module does not support " 422 "ngx_http_uwsgi_module does not support "
437 426
438 if (ngx_http_upstream_create(r) != NGX_OK) { 427 if (ngx_http_upstream_create(r) != NGX_OK) {
439 return NGX_HTTP_INTERNAL_SERVER_ERROR; 428 return NGX_HTTP_INTERNAL_SERVER_ERROR;
440 } 429 }
441 430
442 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_uwsgi_ctx_t)); 431 status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t));
443 if (ctx == NULL) { 432 if (status == NULL) {
444 return NGX_HTTP_INTERNAL_SERVER_ERROR; 433 return NGX_HTTP_INTERNAL_SERVER_ERROR;
445 } 434 }
446 435
447 ngx_http_set_ctx(r, ctx, ngx_http_uwsgi_module); 436 ngx_http_set_ctx(r, status, ngx_http_uwsgi_module);
448 437
449 uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); 438 uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
450 439
451 if (uwcf->uwsgi_lengths) { 440 if (uwcf->uwsgi_lengths) {
452 if (ngx_http_uwsgi_eval(r, uwcf) != NGX_OK) { 441 if (ngx_http_uwsgi_eval(r, uwcf) != NGX_OK) {
842 831
843 832
844 static ngx_int_t 833 static ngx_int_t
845 ngx_http_uwsgi_reinit_request(ngx_http_request_t *r) 834 ngx_http_uwsgi_reinit_request(ngx_http_request_t *r)
846 { 835 {
847 ngx_http_uwsgi_ctx_t *ctx; 836 ngx_http_status_t *status;
848 837
849 ctx = ngx_http_get_module_ctx(r, ngx_http_uwsgi_module); 838 status = ngx_http_get_module_ctx(r, ngx_http_uwsgi_module);
850 839
851 if (ctx == NULL) { 840 if (status == NULL) {
852 return NGX_OK; 841 return NGX_OK;
853 } 842 }
854 843
855 ctx->status = 0; 844 status->code = 0;
856 ctx->status_count = 0; 845 status->count = 0;
857 ctx->status_start = NULL; 846 status->start = NULL;
858 ctx->status_end = NULL; 847 status->end = NULL;
859 848
860 r->upstream->process_header = ngx_http_uwsgi_process_status_line; 849 r->upstream->process_header = ngx_http_uwsgi_process_status_line;
861 850
862 return NGX_OK; 851 return NGX_OK;
863 } 852 }