50 static void *ngx_http_uwsgi_create_loc_conf(
ngx_conf_t *cf);
51 static char *ngx_http_uwsgi_merge_loc_conf(
ngx_conf_t *cf,
void *parent,
105 &ngx_http_uwsgi_modifier_bounds },
112 &ngx_http_uwsgi_modifier_bounds },
116 ngx_http_uwsgi_store,
216 ngx_http_uwsgi_cache,
223 ngx_http_uwsgi_cache_key,
233 &ngx_http_uwsgi_module },
268 &ngx_http_uwsgi_next_upstream_masks },
319 &ngx_http_uwsgi_next_upstream_masks },
370 ngx_http_uwsgi_create_loc_conf,
371 ngx_http_uwsgi_merge_loc_conf
377 &ngx_http_uwsgi_module_ctx,
378 ngx_http_uwsgi_commands,
391 static ngx_str_t ngx_http_uwsgi_hide_headers[] = {
431 "ngx_http_uwsgi_module does not support "
432 "subrequests in memory");
441 if (status == NULL) {
450 if (ngx_http_uwsgi_eval(r, uwcf) !=
NGX_OK) {
463 u->create_key = ngx_http_uwsgi_create_key;
475 if (u->
pipe == NULL) {
512 "%s in upstream \"%V\"", url.
err, &url.
url);
569 u_char ch, *lowcase_key;
570 size_t key_len, val_len, len, allocated;
596 while (*(uintptr_t *) le.
ip) {
599 key_len = lcode(&le);
602 skip_empty = lcode(&le);
604 for (val_len = 0; *(uintptr_t *) le.
ip; val_len += lcode (&le)) {
607 le.
ip +=
sizeof(uintptr_t);
609 if (skip_empty && val_len == 0) {
613 len += 2 + key_len + 2 + val_len;
632 if (ignored == NULL) {
642 if (i >= part->
nelts) {
643 if (part->
next == NULL) {
653 if (allocated < header[i].key.
len) {
654 allocated = header[
i].
key.
len + 16;
656 if (lowcase_key == NULL) {
663 for (n = 0; n < header[
i].
key.
len; n++) {
666 if (ch >=
'A' && ch <=
'Z') {
669 }
else if (ch ==
'-') {
678 ignored[header_params++] = &header[
i];
683 len += 2 +
sizeof(
"HTTP_") - 1 + header[i].key.
len
692 if (len > 0 && len < 2) {
694 "uwsgi request is too little: %uz", len);
712 *b->
last++ = (u_char) (len & 0xff);
713 *b->
last++ = (u_char) ((len >> 8) & 0xff);
726 while (*(uintptr_t *) le.
ip) {
729 key_len = (u_char) lcode (&le);
732 skip_empty = lcode(&le);
734 for (val_len = 0; *(uintptr_t *) le.
ip; val_len += lcode(&le)) {
737 le.
ip +=
sizeof(uintptr_t);
739 if (skip_empty && val_len == 0) {
742 while (*(uintptr_t *) e.
ip) {
746 e.
ip +=
sizeof(uintptr_t);
753 *e.
pos++ = (u_char) (key_len & 0xff);
754 *e.
pos++ = (u_char) ((key_len >> 8) & 0xff);
759 *e.
pos++ = (u_char) (val_len & 0xff);
760 *e.
pos++ = (u_char) ((val_len >> 8) & 0xff);
762 while (*(uintptr_t *) e.
ip) {
767 e.
ip +=
sizeof(uintptr_t);
770 "uwsgi param: \"%*s: %*s\"",
771 key_len, e.
pos - (key_len + 2 + val_len),
772 val_len, e.
pos - val_len);
785 if (i >= part->
nelts) {
786 if (part->
next == NULL) {
795 for (n = 0; n < header_params; n++) {
796 if (&header[i] == ignored[n]) {
801 key_len =
sizeof(
"HTTP_") - 1 + header[i].key.
len;
802 *b->
last++ = (u_char) (key_len & 0xff);
803 *b->
last++ = (u_char) ((key_len >> 8) & 0xff);
806 for (n = 0; n < header[
i].
key.
len; n++) {
809 if (ch >=
'a' && ch <=
'z') {
812 }
else if (ch ==
'-') {
820 *b->
last++ = (u_char) (val_len & 0xff);
821 *b->
last++ = (u_char) ((val_len >> 8) & 0xff);
825 "uwsgi param: \"%*s: %*s\"",
826 key_len, b->
last - (key_len + 2 + val_len),
827 val_len, b->
last - val_len);
850 if (cl->
next == NULL) {
877 if (status == NULL) {
883 status->
start = NULL;
903 if (status == NULL) {
917 return ngx_http_uwsgi_process_header(r);
937 "http uwsgi status %ui \"%V\"",
942 return ngx_http_uwsgi_process_header(r);
1006 "http uwsgi header: \"%V: %V\"", &h->
key, &h->
value);
1016 "http uwsgi header done");
1030 "upstream sent invalid status \"%V\"",
1041 "302 Moved Temporarily");
1070 "upstream sent invalid header");
1081 "abort http uwsgi request");
1091 "finalize http uwsgi request");
1098 ngx_http_uwsgi_create_loc_conf(
ngx_conf_t *cf)
1131 #if (NGX_HTTP_CACHE)
1158 ngx_http_uwsgi_merge_loc_conf(
ngx_conf_t *cf,
void *parent,
void *child)
1210 "there must be at least 2 \"uwsgi_buffers\"");
1216 if (size < conf->upstream.bufs.size) {
1234 "\"uwsgi_busy_buffers_size\" must be equal to or greater "
1235 "than the maximum of the value of \"uwsgi_buffer_size\" and "
1236 "one of the \"uwsgi_buffers\"");
1245 "\"uwsgi_busy_buffers_size\" must be less than "
1246 "the size of all \"uwsgi_buffers\" minus one buffer");
1265 "\"uwsgi_temp_file_write_size\" must be equal to or greater than "
1266 "the maximum of the value of \"uwsgi_buffer_size\" and "
1267 "one of the \"uwsgi_buffers\"");
1287 "\"uwsgi_max_temp_file_size\" must be equal to zero to disable "
1288 "temporary files usage or must be equal to or greater than "
1289 "the maximum of the value of \"uwsgi_buffer_size\" and "
1290 "one of the \"uwsgi_buffers\"");
1314 &ngx_http_uwsgi_temp_path)
1320 #if (NGX_HTTP_CACHE)
1331 "\"uwsgi_cache\" zone \"%V\" is unknown",
1354 if (conf->
upstream.cache_methods == 0) {
1361 prev->
upstream.cache_bypass, NULL);
1369 if (conf->cache_key.value.data == NULL) {
1370 conf->cache_key = prev->cache_key;
1377 prev->
upstream.cache_lock_timeout, 5000);
1393 hash.
name =
"uwsgi_hide_headers_hash";
1396 &prev->
upstream, ngx_http_uwsgi_hide_headers, &hash)
1414 clcf->
handler = ngx_http_uwsgi_handler;
1421 if (ngx_http_uwsgi_merge_params(cf, conf, prev) !=
NGX_OK) {
1438 #if (NGX_HTTP_CACHE)
1483 if (conf->
params == NULL) {
1502 #if (NGX_HTTP_CACHE)
1508 if (ngx_array_init(¶ms_merged, cf->
temp_pool, 4,
1515 for (i = 0; i < nsrc; i++) {
1525 h = ngx_http_uwsgi_cache_headers;
1529 src = params_merged.
elts;
1530 nsrc = params_merged.
nelts;
1532 for (i = 0; i < nsrc; i++) {
1552 src = params_merged.
elts;
1553 nsrc = params_merged.
nelts;
1558 for (i = 0; i < nsrc; i++) {
1560 if (src[i].key.
len >
sizeof(
"HTTP_") - 1
1571 hk->
value = (
void *) 1;
1573 if (src[i].value.len == 0) {
1598 + src[i].key.
len +
sizeof(uintptr_t) - 1)
1599 & ~(
sizeof(uintptr_t) - 1);
1630 *code = (uintptr_t) NULL;
1638 *code = (uintptr_t) NULL;
1646 *code = (uintptr_t) NULL;
1654 hash.
name =
"uwsgi_params_hash";
1674 return "is duplicate";
1678 clcf->
handler = ngx_http_uwsgi_handler;
1733 return "is duplicate";
1743 #if (NGX_HTTP_CACHE)
1748 return "is incompatible with \"uwsgi_cache\"";
1779 #if (NGX_HTTP_CACHE)
1791 return "is duplicate";
1800 return "is incompatible with \"uwsgi_store\"";
1804 &ngx_http_uwsgi_module);
1805 if (uwcf->
upstream.cache == NULL) {
1823 if (uwcf->cache_key.value.data) {
1824 return "is duplicate";
1830 ccv.
value = &value[1];