]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/testhttp.c
Update Windows DLL exports file.
[thirdparty/cups.git] / cups / testhttp.c
index 3ad737f4731357e78d4f72b427d9b5751d16322a..dfb767c89e7be994d3a462b45bd55df7c57286cf 100644 (file)
@@ -336,6 +336,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
     if (!j)
       puts("PASS");
 
+#if 0
    /*
     * _httpDigest()
     */
@@ -367,6 +368,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
     }
     else
       puts("PASS");
+#endif /* 0 */
 
    /*
     * httpGetHostname()
@@ -626,6 +628,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   for (i = 1; i < argc; i ++)
   {
+    int new_auth;
+
     if (!strcmp(argv[i], "-o"))
     {
       i ++;
@@ -709,6 +713,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
     printf("Checking file \"%s\"...\n", resource);
 
+    new_auth = 0;
+
     do
     {
       if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close"))
@@ -721,9 +727,13 @@ main(int  argc,                            /* I - Number of command-line arguments */
        }
       }
 
+      if (http->authstring && !strncmp(http->authstring, "Digest ", 7) && !new_auth)
+        _httpSetDigestAuthString(http, http->nextnonce, "HEAD", resource);
+
       httpClearFields(http);
       httpSetField(http, HTTP_FIELD_AUTHORIZATION, httpGetAuthString(http));
       httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
+
       if (httpHead(http, resource))
       {
         if (httpReconnect2(http, 30000, NULL))
@@ -740,6 +750,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
       while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
 
+      new_auth = 0;
+
       if (status == HTTP_STATUS_UNAUTHORIZED)
       {
        /*
@@ -752,7 +764,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
        * See if we can do authentication...
        */
 
-       if (cupsDoAuthentication(http, "GET", resource))
+        new_auth = 1;
+
+       if (cupsDoAuthentication(http, "HEAD", resource))
        {
          status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
          break;
@@ -800,6 +814,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
     printf("Requesting file \"%s\" (Accept-Encoding: %s)...\n", resource,
            encoding ? encoding : "identity");
 
+    new_auth = 0;
+
     do
     {
       if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close"))
@@ -812,6 +828,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
        }
       }
 
+      if (http->authstring && !strncmp(http->authstring, "Digest ", 7) && !new_auth)
+        _httpSetDigestAuthString(http, http->nextnonce, "GET", resource);
+
       httpClearFields(http);
       httpSetField(http, HTTP_FIELD_AUTHORIZATION, httpGetAuthString(http));
       httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
@@ -833,6 +852,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
       while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
 
+      new_auth = 0;
+
       if (status == HTTP_STATUS_UNAUTHORIZED)
       {
        /*
@@ -845,6 +866,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
        * See if we can do authentication...
        */
 
+        new_auth = 1;
+
        if (cupsDoAuthentication(http, "GET", resource))
        {
          status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;