]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add SSL/TLS support to unit test program.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 7 Sep 2011 23:03:50 +0000 (23:03 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 7 Sep 2011 23:03:50 +0000 (23:03 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@9970 7a7537e8-13f0-0310-91df-b6672ffda945

cups/testhttp.c

index 3b752f4cd3d1ea7197f3521d2b8193ba96789f30..bc80dd639b23dd1a8deb60c52b6bdb33d61143e3 100644 (file)
@@ -167,6 +167,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 {
   int          i, j, k;                /* Looping vars */
   http_t       *http;                  /* HTTP connection */
+  http_encryption_t encrypt;           /* Encryption type */
   http_status_t        status;                 /* Status of GET command */
   int          failures;               /* Number of test failures */
   char         buffer[8192];           /* Input buffer */
@@ -541,7 +542,13 @@ main(int  argc,                            /* I - Number of command-line arguments */
                     hostname, sizeof(hostname), &port,
                    resource, sizeof(resource));
 
-    http = httpConnectEncrypt(hostname, port, HTTP_ENCRYPT_IF_REQUESTED);
+    if (!strcasecmp(scheme, "https") || !strcasecmp(scheme, "ipps") ||
+        port == 443)
+      encrypt = HTTP_ENCRYPT_ALWAYS;
+    else
+      encrypt = HTTP_ENCRYPT_IF_REQUESTED;
+
+    http = httpConnectEncrypt(hostname, port, encrypt);
     if (http == NULL)
     {
       perror(hostname);
@@ -558,7 +565,6 @@ main(int  argc,                             /* I - Number of command-line arguments */
     else
       printf("GET failed with status %d...\n", status);
 
-
     start  = time(NULL);
     length = httpGetLength2(http);
     total  = 0;