Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.c @ 5073:52eb762c68a9
Proxy: fixed do_write handling in previous commit.
As rightfully complained by MSVC, do_write variable was used uninitialized.
Correct fix is to set it's initial value based on event happened.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 18 Feb 2013 15:08:46 +0000 |
parents | 7fa7e60a7f66 |
children | 93713d4b99c3 |
comparison
equal
deleted
inserted
replaced
5072:7fa7e60a7f66 | 5073:52eb762c68a9 |
---|---|
53 static void ngx_http_upstream_upgraded_read_upstream(ngx_http_request_t *r, | 53 static void ngx_http_upstream_upgraded_read_upstream(ngx_http_request_t *r, |
54 ngx_http_upstream_t *u); | 54 ngx_http_upstream_t *u); |
55 static void ngx_http_upstream_upgraded_write_upstream(ngx_http_request_t *r, | 55 static void ngx_http_upstream_upgraded_write_upstream(ngx_http_request_t *r, |
56 ngx_http_upstream_t *u); | 56 ngx_http_upstream_t *u); |
57 static void ngx_http_upstream_process_upgraded(ngx_http_request_t *r, | 57 static void ngx_http_upstream_process_upgraded(ngx_http_request_t *r, |
58 ngx_uint_t from_upstream); | 58 ngx_uint_t from_upstream, ngx_uint_t do_write); |
59 static void | 59 static void |
60 ngx_http_upstream_process_non_buffered_downstream(ngx_http_request_t *r); | 60 ngx_http_upstream_process_non_buffered_downstream(ngx_http_request_t *r); |
61 static void | 61 static void |
62 ngx_http_upstream_process_non_buffered_upstream(ngx_http_request_t *r, | 62 ngx_http_upstream_process_non_buffered_upstream(ngx_http_request_t *r, |
63 ngx_http_upstream_t *u); | 63 ngx_http_upstream_t *u); |
2430 } | 2430 } |
2431 | 2431 |
2432 if (u->peer.connection->read->ready | 2432 if (u->peer.connection->read->ready |
2433 || u->buffer.pos != u->buffer.last) | 2433 || u->buffer.pos != u->buffer.last) |
2434 { | 2434 { |
2435 ngx_http_upstream_process_upgraded(r, 1); | 2435 ngx_http_upstream_process_upgraded(r, 1, 1); |
2436 } | 2436 } |
2437 | 2437 |
2438 if (c->read->ready | 2438 if (c->read->ready |
2439 || r->header_in->pos != r->header_in->last) | 2439 || r->header_in->pos != r->header_in->last) |
2440 { | 2440 { |
2441 ngx_http_upstream_process_upgraded(r, 0); | 2441 ngx_http_upstream_process_upgraded(r, 0, 1); |
2442 } | 2442 } |
2443 } | 2443 } |
2444 | 2444 |
2445 | 2445 |
2446 static void | 2446 static void |
2447 ngx_http_upstream_upgraded_read_downstream(ngx_http_request_t *r) | 2447 ngx_http_upstream_upgraded_read_downstream(ngx_http_request_t *r) |
2448 { | 2448 { |
2449 ngx_http_upstream_process_upgraded(r, 0); | 2449 ngx_http_upstream_process_upgraded(r, 0, 0); |
2450 } | 2450 } |
2451 | 2451 |
2452 | 2452 |
2453 static void | 2453 static void |
2454 ngx_http_upstream_upgraded_write_downstream(ngx_http_request_t *r) | 2454 ngx_http_upstream_upgraded_write_downstream(ngx_http_request_t *r) |
2455 { | 2455 { |
2456 ngx_http_upstream_process_upgraded(r, 1); | 2456 ngx_http_upstream_process_upgraded(r, 1, 1); |
2457 } | 2457 } |
2458 | 2458 |
2459 | 2459 |
2460 static void | 2460 static void |
2461 ngx_http_upstream_upgraded_read_upstream(ngx_http_request_t *r, | 2461 ngx_http_upstream_upgraded_read_upstream(ngx_http_request_t *r, |
2462 ngx_http_upstream_t *u) | 2462 ngx_http_upstream_t *u) |
2463 { | 2463 { |
2464 ngx_http_upstream_process_upgraded(r, 1); | 2464 ngx_http_upstream_process_upgraded(r, 1, 0); |
2465 } | 2465 } |
2466 | 2466 |
2467 | 2467 |
2468 static void | 2468 static void |
2469 ngx_http_upstream_upgraded_write_upstream(ngx_http_request_t *r, | 2469 ngx_http_upstream_upgraded_write_upstream(ngx_http_request_t *r, |
2470 ngx_http_upstream_t *u) | 2470 ngx_http_upstream_t *u) |
2471 { | 2471 { |
2472 ngx_http_upstream_process_upgraded(r, 0); | 2472 ngx_http_upstream_process_upgraded(r, 0, 1); |
2473 } | 2473 } |
2474 | 2474 |
2475 | 2475 |
2476 static void | 2476 static void |
2477 ngx_http_upstream_process_upgraded(ngx_http_request_t *r, | 2477 ngx_http_upstream_process_upgraded(ngx_http_request_t *r, |
2478 ngx_uint_t from_upstream) | 2478 ngx_uint_t from_upstream, ngx_uint_t do_write) |
2479 { | 2479 { |
2480 size_t size; | 2480 size_t size; |
2481 ssize_t n; | 2481 ssize_t n; |
2482 ngx_buf_t *b; | 2482 ngx_buf_t *b; |
2483 ngx_uint_t do_write; | |
2484 ngx_connection_t *c, *downstream, *upstream, *dst, *src; | 2483 ngx_connection_t *c, *downstream, *upstream, *dst, *src; |
2485 ngx_http_upstream_t *u; | 2484 ngx_http_upstream_t *u; |
2486 ngx_http_core_loc_conf_t *clcf; | 2485 ngx_http_core_loc_conf_t *clcf; |
2487 | 2486 |
2488 c = r->connection; | 2487 c = r->connection; |