]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/getputfile.c
Reconnect as needed prior to sending a GET, HEAD, or PUT request.
[thirdparty/cups.git] / cups / getputfile.c
index 4a09099eeeed4553af8db48c544f854b159217e4..b4be78ae598647bb8555ef6e649d7871411fa454 100644 (file)
@@ -84,6 +84,16 @@ cupsGetFd(http_t     *http,          /* I - Connection to server or @code CUPS_HTTP_DEFA
 
   do
   {
+    if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close"))
+    {
+      httpClearFields(http);
+      if (httpReconnect2(http, 30000, NULL))
+      {
+       status = HTTP_STATUS_ERROR;
+       break;
+      }
+    }
+
     httpClearFields(http);
     httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
     httpSetField(http, HTTP_FIELD_IF_MODIFIED_SINCE, if_modified_since);
@@ -296,6 +306,16 @@ cupsPutFd(http_t     *http,                /* I - Connection to server or @code CUPS_HTTP_DEFA
 
   do
   {
+    if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close"))
+    {
+      httpClearFields(http);
+      if (httpReconnect2(http, 30000, NULL))
+      {
+       status = HTTP_STATUS_ERROR;
+       break;
+      }
+    }
+
     DEBUG_printf(("2cupsPutFd: starting attempt, authstring=\"%s\"...",
                   http->authstring));