Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 3006:95972b9e790b
ngx_http_upstream_create() to cleanup the previous upstream after
internal redirect
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 27 Jul 2009 13:25:29 +0000 |
parents | 4121acaf7a04 |
children | f958084d4c12 |
comparison
equal
deleted
inserted
replaced
3005:5bc8811728f8 | 3006:95972b9e790b |
---|---|
346 { ngx_string("POST"), NGX_HTTP_POST }, | 346 { ngx_string("POST"), NGX_HTTP_POST }, |
347 { ngx_null_string, 0 } | 347 { ngx_null_string, 0 } |
348 }; | 348 }; |
349 | 349 |
350 | 350 |
351 ngx_int_t | |
352 ngx_http_upstream_create(ngx_http_request_t *r) | |
353 { | |
354 ngx_http_upstream_t *u; | |
355 | |
356 u = r->upstream; | |
357 | |
358 if (u && u->cleanup) { | |
359 ngx_http_upstream_cleanup(r); | |
360 *u->cleanup = NULL; | |
361 } | |
362 | |
363 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); | |
364 if (u == NULL) { | |
365 return NGX_ERROR; | |
366 } | |
367 | |
368 r->upstream = u; | |
369 | |
370 u->peer.log = r->connection->log; | |
371 u->peer.log_error = NGX_ERROR_ERR; | |
372 #if (NGX_THREADS) | |
373 u->peer.lock = &r->connection->lock; | |
374 #endif | |
375 | |
376 return NGX_OK; | |
377 } | |
378 | |
379 | |
351 void | 380 void |
352 ngx_http_upstream_init(ngx_http_request_t *r) | 381 ngx_http_upstream_init(ngx_http_request_t *r) |
353 { | 382 { |
354 ngx_str_t *host; | 383 ngx_str_t *host; |
355 ngx_uint_t i; | 384 ngx_uint_t i; |