# endif /* HAVE_GSSAPI */
/**** New in CUPS 1.7 ****/
+ int tls_upgrade; /* Non-zero if we are doing an upgrade */
_http_mode_t mode; /* _HTTP_MODE_CLIENT or _HTTP_MODE_SERVER */
char *accept_encoding,
/* Accept-Encoding field */
return (-1);
}
}
- else if (http->encryption == HTTP_ENCRYPTION_REQUIRED)
+ else if (http->encryption == HTTP_ENCRYPTION_REQUIRED && !http->tls_upgrade)
return (http_upgrade(http));
#endif /* HAVE_SSL */
if (http->fd < 0 || http->status == HTTP_STATUS_ERROR ||
http->status >= HTTP_STATUS_BAD_REQUEST)
+ {
+ DEBUG_printf(("5http_send: Reconnecting, fd=%d, status=%d, tls_upgrade=%d",
+ http->fd, http->status, http->tls_upgrade));
+
if (httpReconnect2(http, 30000, NULL))
return (-1);
+ }
/*
* Flush any written data that is pending...
* encryption on the link...
*/
+ http->tls_upgrade = 1;
http->field_authorization = NULL; /* Don't free the auth string */
httpClearFields(http);
http->expect = myhttp.expect;
http->field_authorization = myhttp.field_authorization;
http->digest_tries = myhttp.digest_tries;
+ http->tls_upgrade = 0;
/*
* See if we actually went secure...