X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=cups%2Ftesthttp.c;h=dfb767c89e7be994d3a462b45bd55df7c57286cf;hb=657748179f44c3be621f61f04d9b17801e1af59c;hp=3ad737f4731357e78d4f72b427d9b5751d16322a;hpb=3aeb120e10106fafc587d9c50e66909eaba38da1;p=thirdparty%2Fcups.git diff --git a/cups/testhttp.c b/cups/testhttp.c index 3ad737f47..dfb767c89 100644 --- a/cups/testhttp.c +++ b/cups/testhttp.c @@ -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;