Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 2049:2a92804f4109
*) back out r2040
*) refactor ngx_palloc()
*) introduce ngx_pnalloc()
*) additional pool blocks have smaller header
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 17 Jun 2008 15:00:30 +0000 |
parents | f1cff424caeb |
children | 5657037448d1 |
comparison
equal
deleted
inserted
replaced
2048:824615f3b4ec | 2049:2a92804f4109 |
---|---|
962 | 962 |
963 u->headers_in.status_n = ctx->status; | 963 u->headers_in.status_n = ctx->status; |
964 u->state->status = ctx->status; | 964 u->state->status = ctx->status; |
965 | 965 |
966 u->headers_in.status_line.len = ctx->status_end - ctx->status_start; | 966 u->headers_in.status_line.len = ctx->status_end - ctx->status_start; |
967 u->headers_in.status_line.data = ngx_palloc(r->pool, | 967 u->headers_in.status_line.data = ngx_pnalloc(r->pool, |
968 u->headers_in.status_line.len); | 968 u->headers_in.status_line.len); |
969 if (u->headers_in.status_line.data == NULL) { | 969 if (u->headers_in.status_line.data == NULL) { |
970 return NGX_ERROR; | 970 return NGX_ERROR; |
971 } | 971 } |
972 | 972 |
973 ngx_memcpy(u->headers_in.status_line.data, ctx->status_start, | 973 ngx_memcpy(u->headers_in.status_line.data, ctx->status_start, |
1218 h->hash = r->header_hash; | 1218 h->hash = r->header_hash; |
1219 | 1219 |
1220 h->key.len = r->header_name_end - r->header_name_start; | 1220 h->key.len = r->header_name_end - r->header_name_start; |
1221 h->value.len = r->header_end - r->header_start; | 1221 h->value.len = r->header_end - r->header_start; |
1222 | 1222 |
1223 h->key.data = ngx_palloc(r->pool, | 1223 h->key.data = ngx_pnalloc(r->pool, |
1224 h->key.len + 1 + h->value.len + 1 + h->key.len); | 1224 h->key.len + 1 + h->value.len + 1 + h->key.len); |
1225 if (h->key.data == NULL) { | 1225 if (h->key.data == NULL) { |
1226 return NGX_ERROR; | 1226 return NGX_ERROR; |
1227 } | 1227 } |
1228 | 1228 |
1398 } | 1398 } |
1399 | 1399 |
1400 v->len = r->headers_in.x_forwarded_for->value.len | 1400 v->len = r->headers_in.x_forwarded_for->value.len |
1401 + sizeof(", ") - 1 + r->connection->addr_text.len; | 1401 + sizeof(", ") - 1 + r->connection->addr_text.len; |
1402 | 1402 |
1403 p = ngx_palloc(r->pool, v->len); | 1403 p = ngx_pnalloc(r->pool, v->len); |
1404 if (p == NULL) { | 1404 if (p == NULL) { |
1405 return NGX_ERROR; | 1405 return NGX_ERROR; |
1406 } | 1406 } |
1407 | 1407 |
1408 v->data = p; | 1408 v->data = p; |
1433 | 1433 |
1434 v->valid = 1; | 1434 v->valid = 1; |
1435 v->no_cacheable = 0; | 1435 v->no_cacheable = 0; |
1436 v->not_found = 0; | 1436 v->not_found = 0; |
1437 | 1437 |
1438 v->data = ngx_palloc(r->connection->pool, NGX_SIZE_T_LEN); | 1438 v->data = ngx_pnalloc(r->connection->pool, NGX_SIZE_T_LEN); |
1439 | 1439 |
1440 if (v->data == NULL) { | 1440 if (v->data == NULL) { |
1441 return NGX_ERROR; | 1441 return NGX_ERROR; |
1442 } | 1442 } |
1443 | 1443 |
1490 return NGX_DECLINED; | 1490 return NGX_DECLINED; |
1491 } | 1491 } |
1492 | 1492 |
1493 len = prefix + pr->replacement.text.len + h->value.len - pr->redirect.len; | 1493 len = prefix + pr->replacement.text.len + h->value.len - pr->redirect.len; |
1494 | 1494 |
1495 data = ngx_palloc(r->pool, len); | 1495 data = ngx_pnalloc(r->pool, len); |
1496 if (data == NULL) { | 1496 if (data == NULL) { |
1497 return NGX_ERROR; | 1497 return NGX_ERROR; |
1498 } | 1498 } |
1499 | 1499 |
1500 p = data; | 1500 p = data; |
1542 while (*(uintptr_t *) e.ip) { | 1542 while (*(uintptr_t *) e.ip) { |
1543 lcode = *(ngx_http_script_len_code_pt *) e.ip; | 1543 lcode = *(ngx_http_script_len_code_pt *) e.ip; |
1544 len += lcode(&e); | 1544 len += lcode(&e); |
1545 } | 1545 } |
1546 | 1546 |
1547 data = ngx_palloc(r->pool, len); | 1547 data = ngx_pnalloc(r->pool, len); |
1548 if (data == NULL) { | 1548 if (data == NULL) { |
1549 return NGX_ERROR; | 1549 return NGX_ERROR; |
1550 } | 1550 } |
1551 | 1551 |
1552 p = data; | 1552 p = data; |