Fix issue with chunked keep-alive responses when the initial chunk content
starts with a NULL byte.
* flood_socket_keepalive.c
(keepalive_read_chunk): Don't inspect resp->chunk with respect to
validity; re-order comparisons to make a bit more sense.
(keepalive_recv_resp): Be sure that chunk_length is always initialized.
git-svn-id: https://svn.apache.org/repos/asf/httpd/flood/trunk@699195 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES b/CHANGES
index 3673d8e..48e1e62 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
Changes since 1.0:
+* Fix issue with chunked keep-alive responses when the initial chunk content
+ starts with a NULL byte. [Justin Erenkrantz]
+
* Fix HTTP keepalives over SSL.
[Justin Erenkrantz]
diff --git a/flood_socket_keepalive.c b/flood_socket_keepalive.c
index d2229ea..46ea073 100644
--- a/flood_socket_keepalive.c
+++ b/flood_socket_keepalive.c
@@ -163,17 +163,13 @@
apr_status_t status = APR_SUCCESS;
int old_length = 0;
- if (!chunk_length) {
- return status;
- }
-
- if (!resp->chunk || !*resp->chunk) {
+ if (!resp->chunk) {
chunk_length = 0;
- }
-
- if (chunk_length < 0) {
+ } else if (chunk_length < 0) {
old_length = chunk_length;
chunk_length = 0;
+ } else if (chunk_length == 0) {
+ return status;
}
do {
@@ -412,6 +408,8 @@
{
new_resp->chunked = 1;
new_resp->chunk = NULL;
+ chunk_length = 0;
+
/* Find where headers ended */
cl = current_line;