]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http.c
Merge changes from CUPS 1.6svn-r10510.
[thirdparty/cups.git] / cups / http.c
index 945404cdd1d08bf481ee9e7f7b58205307671fdd..9957a16aeaec8cc54694ac336eef2eafa93d5d71 100644 (file)
@@ -2170,14 +2170,10 @@ httpRead2(http_t *http,                 /* I - Connection to server */
   {
     if (http->data_encoding == HTTP_ENCODE_CHUNKED)
       httpGets(len, sizeof(len), http);
-
-    if (http->data_encoding != HTTP_ENCODE_CHUNKED)
-    {
-      if (http->state == HTTP_POST_RECV)
-       http->state ++;
-      else
-       http->state = HTTP_WAITING;
-    }
+    else if (http->state == HTTP_POST_RECV)
+      http->state ++;
+    else
+      http->state = HTTP_WAITING;
   }
 
   return (bytes);
@@ -2356,6 +2352,23 @@ httpReconnect2(http_t *http,             /* I - Connection to server */
     http->fd = -1;
   }
 
+ /*
+  * Reset all state (except fields, which may be reused)...
+  */
+
+  http->state           = HTTP_WAITING;
+  http->status          = HTTP_CONTINUE;
+  http->version         = HTTP_1_1;
+  http->keep_alive      = HTTP_KEEPALIVE_OFF;
+  memset(&http->_hostaddr, 0, sizeof(http->_hostaddr));
+  http->data_encoding   = HTTP_ENCODE_LENGTH;
+  http->_data_remaining = 0;
+  http->used            = 0;
+  http->expect          = 0;
+  http->data_remaining  = 0;
+  http->hostaddr        = NULL;
+  http->wused           = 0;
+
  /*
   * Connect to the server...
   */
@@ -2394,8 +2407,6 @@ httpReconnect2(http_t *http,              /* I - Connection to server */
 
   http->hostaddr = &(addr->addr);
   http->error    = 0;
-  http->status   = HTTP_CONTINUE;
-  http->state    = HTTP_WAITING;
 
 #ifdef HAVE_SSL
   if (http->encryption == HTTP_ENCRYPT_ALWAYS)
@@ -3968,7 +3979,9 @@ http_setup_ssl(http_t *http)              /* I - Connection to server */
   http->tls = SSL_new(context);
   SSL_set_bio(http->tls, bio, bio);
 
+#   ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
   SSL_set_tlsext_host_name(http->tls, hostname);
+#   endif /* HAVE_SSL_SET_TLSEXT_HOST_NAME */
 
   if (SSL_connect(http->tls) != 1)
   {