]> granicus.if.org Git - apache/commitdiff
PR:
authorDoug MacEachern <dougm@apache.org>
Thu, 14 Mar 2002 07:04:10 +0000 (07:04 +0000)
committerDoug MacEachern <dougm@apache.org>
Thu, 14 Mar 2002 07:04:10 +0000 (07:04 +0000)
Obtained from:
Submitted by:
Reviewed by:
fix bug in ssl_io_input_getline():
in most cases we get all the headers on the first SSL_read.
however, in certain cases SSL_read will only get a partial
chunk of the headers, so we now try to read until LF is seen.

bug seen with netscape client (running both on linux and win32) and
server running on win32.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93931 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_io.c

index 8d200d2c215aa2c95304e051d40b220701ee95d9..138cb4e5c417c3eac19d51ba47e769d7bdedcc14 100644 (file)
@@ -674,16 +674,36 @@ static apr_status_t ssl_io_input_getline(ssl_io_input_ctx_t *ctx,
                                          char *buf,
                                          apr_size_t *len)
 {
-    const char *pos;
+    const char *pos = NULL;
     apr_status_t status;
+    apr_size_t tmplen = *len, buflen = *len, offset = 0;
 
-    status = ssl_io_input_read(ctx, buf, len);
+    *len = 0;
 
-    if (status != APR_SUCCESS) {
-        return status;
+    /*
+     * in most cases we get all the headers on the first SSL_read.
+     * however, in certain cases SSL_read will only get a partial
+     * chunk of the headers, so we try to read until LF is seen.
+     * /
+
+    while (tmplen > 0) {
+        status = ssl_io_input_read(ctx, buf + offset, &tmplen);
+        
+        if (status != APR_SUCCESS) {
+            return status;
+        }
+
+        *len += tmplen;
+
+        if ((pos = memchr(buf, APR_ASCII_LF, *len))) {
+            break;
+        }
+
+        offset += tmplen;
+        tmplen = buflen - offset;
     }
 
-    if ((pos = memchr(buf, APR_ASCII_LF, *len))) {
+    if (pos) {
         char *value;
         int length;
         apr_size_t bytes = pos - buf;