comparison src/http/modules/ngx_http_fastcgi_module.c @ 1699:976db8c6fb64

return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header()
author Igor Sysoev <igor@sysoev.ru>
date Sun, 09 Dec 2007 08:22:35 +0000
parents 70202cd85645
children 7f3350b18e75
comparison
equal deleted inserted replaced
1698:70202cd85645 1699:976db8c6fb64
885 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); 885 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
886 886
887 if (f == NULL) { 887 if (f == NULL) {
888 f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); 888 f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t));
889 if (f == NULL) { 889 if (f == NULL) {
890 return NGX_HTTP_INTERNAL_SERVER_ERROR; 890 return NGX_ERROR;
891 } 891 }
892 892
893 ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); 893 ngx_http_set_ctx(r, f, ngx_http_fastcgi_module);
894 } 894 }
895 895
1061 1061
1062 /* a header line has been parsed successfully */ 1062 /* a header line has been parsed successfully */
1063 1063
1064 h = ngx_list_push(&u->headers_in.headers); 1064 h = ngx_list_push(&u->headers_in.headers);
1065 if (h == NULL) { 1065 if (h == NULL) {
1066 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1066 return NGX_ERROR;
1067 } 1067 }
1068 1068
1069 if (f->split_parts && f->split_parts->nelts) { 1069 if (f->split_parts && f->split_parts->nelts) {
1070 1070
1071 part = f->split_parts->elts; 1071 part = f->split_parts->elts;
1075 size += part[i].end - part[i].start; 1075 size += part[i].end - part[i].start;
1076 } 1076 }
1077 1077
1078 p = ngx_palloc(r->pool, size); 1078 p = ngx_palloc(r->pool, size);
1079 if (p == NULL) { 1079 if (p == NULL) {
1080 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1080 return NGX_ERROR;
1081 } 1081 }
1082 1082
1083 buf.pos = p; 1083 buf.pos = p;
1084 1084
1085 for (i = 0; i < f->split_parts->nelts; i++) { 1085 for (i = 0; i < f->split_parts->nelts; i++) {
1103 h->value.data = r->header_start; 1103 h->value.data = r->header_start;
1104 h->value.data[h->value.len] = '\0'; 1104 h->value.data[h->value.len] = '\0';
1105 1105
1106 h->lowcase_key = ngx_palloc(r->pool, h->key.len); 1106 h->lowcase_key = ngx_palloc(r->pool, h->key.len);
1107 if (h->lowcase_key == NULL) { 1107 if (h->lowcase_key == NULL) {
1108 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1108 return NGX_ERROR;
1109 } 1109 }
1110 1110
1111 } else { 1111 } else {
1112 1112
1113 h->key.len = r->header_name_end - r->header_name_start; 1113 h->key.len = r->header_name_end - r->header_name_start;
1115 1115
1116 h->key.data = ngx_palloc(r->pool, 1116 h->key.data = ngx_palloc(r->pool,
1117 h->key.len + 1 + h->value.len + 1 1117 h->key.len + 1 + h->value.len + 1
1118 + h->key.len); 1118 + h->key.len);
1119 if (h->key.data == NULL) { 1119 if (h->key.data == NULL) {
1120 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1120 return NGX_ERROR;
1121 } 1121 }
1122 1122
1123 h->value.data = h->key.data + h->key.len + 1; 1123 h->value.data = h->key.data + h->key.len + 1;
1124 h->lowcase_key = h->key.data + h->key.len + 1 1124 h->lowcase_key = h->key.data + h->key.len + 1
1125 + h->value.len + 1; 1125 + h->value.len + 1;
1143 1143
1144 hh = ngx_hash_find(&umcf->headers_in_hash, h->hash, 1144 hh = ngx_hash_find(&umcf->headers_in_hash, h->hash,
1145 h->lowcase_key, h->key.len); 1145 h->lowcase_key, h->key.len);
1146 1146
1147 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { 1147 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
1148 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1148 return NGX_ERROR;
1149 } 1149 }
1150 1150
1151 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1151 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1152 "http fastcgi header: \"%V: %V\"", 1152 "http fastcgi header: \"%V: %V\"",
1153 &h->key, &h->value); 1153 &h->key, &h->value);
1236 1236
1237 if (f->split_parts == NULL) { 1237 if (f->split_parts == NULL) {
1238 f->split_parts = ngx_array_create(r->pool, 1, 1238 f->split_parts = ngx_array_create(r->pool, 1,
1239 sizeof(ngx_http_fastcgi_split_part_t)); 1239 sizeof(ngx_http_fastcgi_split_part_t));
1240 if (f->split_parts == NULL) { 1240 if (f->split_parts == NULL) {
1241 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1241 return NGX_ERROR;
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 part = ngx_array_push(f->split_parts); 1245 part = ngx_array_push(f->split_parts);
1246 1246