]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/testhttp.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / testhttp.c
index 3fcffc65910d82f7e0e4183821379e6ecd00bbbb..37f850c9b3fa56bc475e5577d7c4554b62e84349 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: testhttp.c 5235 2006-03-06 13:02:23Z mike $"
+ * "$Id: testhttp.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   HTTP test program for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 1997-2005 by Easy Software Products.
+ *   Copyright 2007 by Apple Inc.
+ *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -84,6 +75,8 @@ static uri_test_t     uri_tests[] =   /* URI test data */
                            "http", "username:password", "server", "/", 8080, 8080 },
                          { HTTP_URI_OK, "http://username:passwor%64@server:8080/directory/filename",
                            "http", "username:password", "server", "/directory/filename", 8080, 8080 },
+                         { HTTP_URI_OK, "http://[2000::10:100]:631/ipp",
+                           "http", "", "2000::10:100", "/ipp", 631, 631 },
                          { HTTP_URI_OK, "https://username:passwor%64@server/directory/filename",
                            "https", "username:password", "server", "/directory/filename", 443, 0 },
                          { HTTP_URI_OK, "ipp://username:passwor%64@[::1]/ipp",
@@ -94,6 +87,8 @@ static uri_test_t     uri_tests[] =   /* URI test data */
                            "mailto", "", "", "user@domain.com", 0, 0 },
                          { HTTP_URI_OK, "socket://server/",
                            "socket", "", "server", "/", 9100, 0 },
+                         { HTTP_URI_OK, "socket://192.168.1.1:9101/",
+                           "socket", "", "192.168.1.1", "/", 9101, 9101 },
                          { HTTP_URI_OK, "ipp://username:password@[v1.fe80::200:1234:5678:9abc+eth0]:999/ipp",
                            "ipp", "username:password", "fe80::200:1234:5678:9abc%eth0", "/ipp", 999, 999 },
                          { HTTP_URI_OK, "http://server/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400",
@@ -112,6 +107,8 @@ static uri_test_t   uri_tests[] =   /* URI test data */
                          /* Missing resource */
                          { HTTP_URI_MISSING_RESOURCE, "socket://[::192.168.2.1]",
                            "socket", "", "::192.168.2.1", "/", 9100, 0 },
+                         { HTTP_URI_MISSING_RESOURCE, "socket://192.168.1.1:9101",
+                           "socket", "", "192.168.1.1", "/", 9101 },
 
                          /* Bad URI */
                          { HTTP_URI_BAD_URI, "",
@@ -307,9 +304,21 @@ main(int  argc,                            /* I - Number of command-line arguments */
     addrlist = httpAddrGetList(hostname, AF_UNSPEC, NULL);
     if (addrlist)
     {
-      for (i = 0, addr = addrlist; addr; i ++, addr = addr->next);
+      for (i = 0, addr = addrlist; addr; i ++, addr = addr->next)
+      {
+        char   numeric[1024];          /* Numeric IP address */
+
+
+       httpAddrString(&(addr->addr), numeric, sizeof(numeric));
+       if (!strcmp(numeric, "UNKNOWN"))
+         break;
+      }
+
+      if (addr)
+        printf("FAIL (bad address for %s)\n", hostname);
+      else
+        printf("PASS (%d address(es) for %s)\n", i, hostname);
 
-      printf("PASS (%d address(es) for %s)\n", i, hostname);
       httpAddrFreeList(addrlist);
     }
     else
@@ -497,8 +506,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
         current = time(NULL);
         if (current == start) current ++;
         printf("\r" CUPS_LLFMT "/" CUPS_LLFMT " bytes ("
-              CUPS_LLFMT " bytes/sec)      ", total, length,
-               total / (current - start));
+              CUPS_LLFMT " bytes/sec)      ", CUPS_LLCAST total,
+              CUPS_LLCAST length, CUPS_LLCAST (total / (current - start)));
         fflush(stdout);
       }
     }
@@ -515,5 +524,5 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: testhttp.c 5235 2006-03-06 13:02:23Z mike $".
+ * End of "$Id: testhttp.c 6649 2007-07-11 21:46:42Z mike $".
  */