Index: trunk/willow/src/include/flowio.h |
— | — | @@ -294,7 +294,7 @@ |
295 | 295 | |
296 | 296 | virtual sink_result bf_transform(char const *, size_t, ssize_t &discard) = 0; |
297 | 297 | virtual sink_result bf_eof(void) { |
298 | | - return sink_result_okay; |
| 298 | + return sink_result_finished; |
299 | 299 | } |
300 | 300 | |
301 | 301 | sink_result data_ready(char const *buf, size_t len, ssize_t &discard) { |
Index: trunk/willow/src/willow/flowio.cc |
— | — | @@ -348,6 +348,7 @@ |
349 | 349 | streamsize size; |
350 | 350 | if (_cached) { |
351 | 351 | if (!_cached_size) { |
| 352 | + _sp_data_empty(); |
352 | 353 | _sp_completed_callee(); |
353 | 354 | return false; |
354 | 355 | } |
— | — | @@ -359,6 +360,7 @@ |
360 | 361 | |
361 | 362 | size = _file.readsome(_fbuf, 16384); |
362 | 363 | if (size == 0) { |
| 364 | + _sp_data_empty(); |
363 | 365 | _sp_completed_callee(); |
364 | 366 | return false; |
365 | 367 | } else if (_file.fail()) { |
Index: trunk/willow/src/willow/chunking.cc |
— | — | @@ -39,6 +39,7 @@ |
40 | 40 | io::sink_result |
41 | 41 | chunking_filter::bf_eof(void) |
42 | 42 | { |
| 43 | + WDEBUG((WLOG_DEBUG, "chunking_filter: EOF")); |
43 | 44 | _buf.add("\r\n0\r\n", 5, false); |
44 | 45 | return io::sink_result_finished; |
45 | 46 | } |
Index: trunk/willow/src/willow/whttp.cc |
— | — | @@ -937,7 +937,7 @@ |
938 | 938 | _error_headers->add("Date", current_time_str); |
939 | 939 | _error_headers->add("Expires", current_time_str); |
940 | 940 | _error_headers->add("Server", my_version); |
941 | | - _error_headers->add("Connection", "close"); |
| 941 | + |
942 | 942 | _error_headers->add("Content-Type", "text/html;charset=UTF-8"); |
943 | 943 | |
944 | 944 | _error_body = io::file_spigot::from_path(error_files[errnum], true); |
— | — | @@ -950,6 +950,12 @@ |
951 | 951 | _error_headers->completed_callee(this, &httpcllr::error_send_headers_done); |
952 | 952 | _error_headers->error_callee(this, &httpcllr::error_send_done); |
953 | 953 | |
| 954 | + /* |
| 955 | + * Can we chunk the error? |
| 956 | + */ |
| 957 | + if (_header_parser->_http_vers != http11) |
| 958 | + _error_headers->add("Connection", "close"); |
| 959 | + |
954 | 960 | _error_headers->sp_connect(_client_sink); |
955 | 961 | _error_headers->sp_uncork(); |
956 | 962 | } |
— | — | @@ -962,7 +968,16 @@ |
963 | 969 | _error_body->error_callee(this, &httpcllr::error_send_done); |
964 | 970 | |
965 | 971 | _error_body->sp_connect(_error_filter); |
966 | | - _error_filter->sp_connect(_client_sink); |
| 972 | + if (_header_parser->_http_vers == http11) { |
| 973 | + _chunking_filter = new chunking_filter; |
| 974 | + _error_filter->sp_connect(_chunking_filter); |
| 975 | + _chunking_filter->sp_connect(_client_sink); |
| 976 | + } else { |
| 977 | + _header_parser->_no_keepalive = true; |
| 978 | + _header_parser->_force_keepalive = false; |
| 979 | + _error_filter->sp_connect(_client_sink); |
| 980 | + } |
| 981 | + |
967 | 982 | _error_body->sp_uncork(); |
968 | 983 | } |
969 | 984 | |