Index: trunk/willow/src/include/ptalloc.h |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | struct pttsswrap { |
51 | 51 | static void pttsswrapdtor(void *p) { |
52 | 52 | pta_block **pt = (pta_block **)p, *n = *pt, *o; |
53 | | - while (o = n) { |
| 53 | + while ((o = n) != NULL) { |
54 | 54 | n = n->next; |
55 | 55 | free(o); |
56 | 56 | } |
Index: trunk/willow/src/include/flalloc.h |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | flalloc_dtor(void *p) |
24 | 24 | { |
25 | 25 | T *n = (T *)p, *o; |
26 | | - while (o = n) { |
| 26 | + while ((o = n) != NULL) { |
27 | 27 | n = n->_freelist_next; |
28 | 28 | ::operator delete(o); |
29 | 29 | } |
Index: trunk/willow/src/willow/flowio.cc |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | /* _off was increased by the previous send, reduce _saved |
120 | 120 | * appropriately |
121 | 121 | */ |
122 | | - if (_off >= _saved) |
| 122 | + if (_off >= (ssize_t)_saved) |
123 | 123 | _saved = _off = 0; |
124 | 124 | else |
125 | 125 | _saved -= _off; |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | | - if (_off >= _saved) |
| 143 | + if (_off >= (ssize_t)_saved) |
144 | 144 | _off = _saved = 0; |
145 | 145 | |
146 | 146 | read = s->read(_savebuf + _off + _saved, DIOBUFSZ - (_off + _saved)); |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | discard += wrote; |
212 | 212 | _counter += wrote; |
213 | 213 | |
214 | | - if (len == wrote) { |
| 214 | + if ((ssize_t)len == wrote) { |
215 | 215 | return sink_result_okay; |
216 | 216 | } else { |
217 | 217 | _sink_spigot->sp_cork(); |
— | — | @@ -243,7 +243,7 @@ |
244 | 244 | discard += wrote; |
245 | 245 | _counter += wrote; |
246 | 246 | |
247 | | - if (len == wrote) { |
| 247 | + if ((ssize_t)len == wrote) { |
248 | 248 | return sink_result_okay; |
249 | 249 | } else { |
250 | 250 | _sink_spigot->sp_cork(); |
Index: trunk/willow/src/willow/whttp.cc |
— | — | @@ -330,7 +330,6 @@ |
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | | - WDEBUG((WLOG_DEBUG, format("whttp: _group=%d") % _group)); |
335 | 334 | _client_spigot->sp_disconnect(); |
336 | 335 | map<string,int>::iterator it; |
337 | 336 | map<imstring,int>::iterator mit; |
— | — | @@ -376,7 +375,14 @@ |
377 | 376 | void |
378 | 377 | httpcllr::start_backend_request(imstring const &host, imstring const &path) |
379 | 378 | { |
380 | | -pair<wsocket *, backend *> ke = bpools.find(_group)->second.get_keptalive(); |
| 379 | +pair<wsocket *, backend *> ke; |
| 380 | + |
| 381 | + /* |
| 382 | + * Never try to send a POST request over keepalive - if the connection |
| 383 | + * breaks we don't have the POST data anymore so we can't retry. |
| 384 | + */ |
| 385 | + if (_header_parser->_http_reqtype != REQTYPE_POST) |
| 386 | + ke = bpools.find(_group)->second.get_keptalive(); |
381 | 387 | |
382 | 388 | _request_host = host; |
383 | 389 | _request_path = path; |
— | — | @@ -463,6 +469,7 @@ |
464 | 470 | httpcllr::backend_write_headers_done(void) |
465 | 471 | { |
466 | 472 | if (_header_parser->_http_reqtype == REQTYPE_POST) { |
| 473 | +std::cout<<"POST "<<_header_parser->_content_length<<" bytes\n"; |
467 | 474 | /* |
468 | 475 | * Connect the client to the backend and read the POST data. |
469 | 476 | */ |
— | — | @@ -576,6 +583,13 @@ |
577 | 584 | * HTTP 1.0, insert a dechunking filter. |
578 | 585 | */ |
579 | 586 | _backend_spigot->sp_disconnect(); |
| 587 | + |
| 588 | + if (_backend_headers->_response == 304 && _backend_headers->_content_length < 0) { |
| 589 | + /* No body */ |
| 590 | + send_body_to_client_done(); |
| 591 | + return; |
| 592 | + } |
| 593 | + |
580 | 594 | if (_backend_headers->_flags.f_chunked && _header_parser->_http_vers == http10) { |
581 | 595 | _dechunking_filter = new dechunking_filter; |
582 | 596 | _backend_spigot->sp_connect(_dechunking_filter); |
— | — | @@ -609,6 +623,7 @@ |
610 | 624 | } |
611 | 625 | _client_sink->_counter = 0; |
612 | 626 | } |
| 627 | + |
613 | 628 | _backend_spigot->sp_uncork(); |
614 | 629 | } |
615 | 630 | |
Index: trunk/willow/src/willow/wnet.cc |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | |
60 | 60 | bool wnet_exit; |
61 | 61 | vector<wsocket *> awaks; |
62 | | -int cawak; |
| 62 | +size_t cawak; |
63 | 63 | |
64 | 64 | void |
65 | 65 | wnet_add_accept_wakeup(wsocket *s) |
Index: trunk/willow/src/willow/willow.cc |
— | — | @@ -88,11 +88,10 @@ |
89 | 89 | ptdealloc(void *p) |
90 | 90 | { |
91 | 91 | vector<pta_block *> *v = (vector<pta_block *> *)p; |
92 | | -std::cout<<"ptdealloc\n"; |
93 | 92 | for (vector<pta_block *>::iterator it = v->begin(), end = v->end(); |
94 | 93 | it != end; ++it) { |
95 | 94 | pta_block *n = *it, *o; |
96 | | - while (o = n) { |
| 95 | + while ((o = n) != NULL) { |
97 | 96 | n = n->next; |
98 | 97 | delete [] (char *)o->addr; |
99 | 98 | free(o); |
Index: trunk/willow/src/willow/whttp_header.cc |
— | — | @@ -84,23 +84,23 @@ |
85 | 85 | static struct htypent { |
86 | 86 | char *name; |
87 | 87 | int n; |
88 | | - int len; |
| 88 | + size_t len; |
89 | 89 | } list[] = { |
90 | | - { "transfer-encoding", H_TRANSFER_ENCODING }, |
91 | | - { "content-length", H_CONTENT_LENGTH }, |
92 | | - { "user-agent", H_USER_AGENT }, |
93 | | - { "host", H_HOST }, |
94 | | - { "connection", H_CONNECTION }, |
95 | | - { "location", H_LOCATION }, |
96 | | - { "x-willow-backend-group", H_X_WILLOW_BACKEND_GROUP }, |
97 | | - { "x-willow-follow-redirect", H_X_WILLOW_FOLLOW_REDIRECT }, |
98 | | - { "keep-alive", H_IGNORE }, |
99 | | - { "te", H_IGNORE }, |
100 | | - { "trailers", H_IGNORE }, |
101 | | - { "upgrade", H_IGNORE }, |
102 | | - { "proxy-authenticate", H_IGNORE }, |
103 | | - { "proxy-connection", H_IGNORE }, |
104 | | - { 0, 0 } |
| 90 | + { "transfer-encoding", H_TRANSFER_ENCODING, 0 }, |
| 91 | + { "content-length", H_CONTENT_LENGTH, 0 }, |
| 92 | + { "user-agent", H_USER_AGENT, 0 }, |
| 93 | + { "host", H_HOST, 0 }, |
| 94 | + { "connection", H_CONNECTION, 0 }, |
| 95 | + { "location", H_LOCATION, 0 }, |
| 96 | + { "x-willow-backend-group", H_X_WILLOW_BACKEND_GROUP, 0 }, |
| 97 | + { "x-willow-follow-redirect", H_X_WILLOW_FOLLOW_REDIRECT, 0 }, |
| 98 | + { "keep-alive", H_IGNORE, 0 }, |
| 99 | + { "te", H_IGNORE, 0 }, |
| 100 | + { "trailers", H_IGNORE, 0 }, |
| 101 | + { "upgrade", H_IGNORE, 0 }, |
| 102 | + { "proxy-authenticate", H_IGNORE, 0 }, |
| 103 | + { "proxy-connection", H_IGNORE, 0 }, |
| 104 | + { 0, 0, 0 } |
105 | 105 | }; |
106 | 106 | void |
107 | 107 | whttp_header_init(void) |
Index: trunk/willow/src/willow/wbackend.cc |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | |
195 | 195 | backend_pool::~backend_pool(void) |
196 | 196 | { |
197 | | - for (int i = 0; i < backends.size(); ++i) |
| 197 | + for (size_t i = 0; i < backends.size(); ++i) |
198 | 198 | delete backends[i]; |
199 | 199 | } |
200 | 200 | |
— | — | @@ -277,7 +277,7 @@ |
278 | 278 | |
279 | 279 | if (!_keptalive) |
280 | 280 | _keptalive = new vector<pair<wsocket *, backend *> >; |
281 | | - else while (config.keepalive_max && (_keptalive->size() >= config.keepalive_max)) { |
| 281 | + else while (config.keepalive_max && (_keptalive->size() >= (size_t)config.keepalive_max)) { |
282 | 282 | delete _keptalive->begin()->first; |
283 | 283 | _keptalive->erase(_keptalive->begin()); |
284 | 284 | } |