]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Save work; public accessors for more stuff, continue transition away from private
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 4 Oct 2013 03:11:42 +0000 (03:11 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 4 Oct 2013 03:11:42 +0000 (03:11 +0000)
APIs.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11324 a1ca3aef-8c08-0410-bb20-df032aa958be

33 files changed:
backend/snmp.c
config-scripts/cups-common.m4
config-scripts/cups-compiler.m4
config-scripts/cups-defaults.m4
config-scripts/cups-directories.m4
config-scripts/cups-dnssd.m4
config-scripts/cups-gssapi.m4
config-scripts/cups-largefile.m4
config-scripts/cups-launchd.m4
config-scripts/cups-libtool.m4
config-scripts/cups-manpages.m4
config-scripts/cups-network.m4
config-scripts/cups-opsys.m4
config-scripts/cups-pam.m4
config-scripts/cups-scripting.m4
config-scripts/cups-sharedlibs.m4
config-scripts/cups-ssl.m4
config-scripts/cups-threads.m4
cups/http-addr.c
cups/http-addrlist.c
cups/http-private.h
cups/http-support.c
cups/http.c
cups/http.h
doc/help/man-cups-files.conf.html
doc/help/man-cupsaddsmb.html
scheduler/auth.c
scheduler/auth.h
scheduler/client.c
scheduler/client.h
scheduler/conf.c
scheduler/ipp.c
scheduler/tls-darwin.c

index fc40800c6190204538797d66fda2e10adba338e1..62fc54327e827af578b78d65b8a6f6fd51859019 100644 (file)
@@ -1233,7 +1233,7 @@ scan_devices(int ipv4,                    /* I - SNMP IPv4 socket */
       for (addr = addrs; addr; addr = addr->next)
       {
 #ifdef AF_INET6
-        if (_httpAddrFamily(&(addr->addr)) == AF_INET6)
+        if (httpAddrFamily(&(addr->addr)) == AF_INET6)
          fd = ipv6;
        else
 #endif /* AF_INET6 */
@@ -1335,7 +1335,7 @@ try_connect(http_addr_t *addr,            /* I - Socket address */
   debug_printf("DEBUG: %.3f Trying %s://%s:%d...\n", run_time(),
                port == 515 ? "lpd" : "socket", addrname, port);
 
-  if ((fd = socket(_httpAddrFamily(addr), SOCK_STREAM, 0)) < 0)
+  if ((fd = socket(httpAddrFamily(addr), SOCK_STREAM, 0)) < 0)
   {
     fprintf(stderr, "ERROR: Unable to create socket: %s\n",
             strerror(errno));
index 27be08f0da63db0a5e50a0fb620131129b50525c..a67f5aba4ea7923c7152055f0b4aeed2a5c496f8 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-common.m4 8781 2009-08-28 17:34:54Z mike $"
+dnl "$Id$"
 dnl
 dnl   Common configuration stuff for CUPS.
 dnl
@@ -462,5 +462,5 @@ esac
 AC_SUBST(BUILDDIRS)
 
 dnl
-dnl End of "$Id: cups-common.m4 8781 2009-08-28 17:34:54Z mike $".
+dnl End of "$Id$".
 dnl
index 252f2aa25408398f01f9fa6b1d075616af33f61c..3c85abc14d180029540eab046c05d740d0d5caff 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-compiler.m4 7871 2008-08-27 21:12:43Z mike $"
+dnl "$Id$"
 dnl
 dnl   Compiler stuff for CUPS.
 dnl
@@ -296,5 +296,5 @@ case $uname in
 esac
 
 dnl
-dnl End of "$Id: cups-compiler.m4 7871 2008-08-27 21:12:43Z mike $".
+dnl End of "$Id$".
 dnl
index 173cfeac87f475ad49b2ca59ab56ed0fde4fb401..02f9870a05b3db69dfddbdba3a20261d20e346c3 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-defaults.m4 7959 2008-09-17 19:30:58Z mike $"
+dnl "$Id$"
 dnl
 dnl   Default cupsd configuration settings for CUPS.
 dnl
@@ -400,5 +400,5 @@ AC_SUBST(CUPS_WEBIF)
 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF)
 
 dnl
-dnl End of "$Id: cups-defaults.m4 7959 2008-09-17 19:30:58Z mike $".
+dnl End of "$Id$".
 dnl
index eec3dec02085e598c8d690bd0d524166b7a15db1..45665a13f391f453b8d5bf2448db3e86e7d0fafd 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-directories.m4 7799 2008-07-25 20:06:08Z mike $"
+dnl "$Id$"
 dnl
 dnl   Directory stuff for CUPS.
 dnl
@@ -427,5 +427,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
 AC_SUBST(CUPS_STATEDIR)
 
 dnl
-dnl End of "$Id: cups-directories.m4 7799 2008-07-25 20:06:08Z mike $".
+dnl End of "$Id$".
 dnl
index 02974ef8aea4bd2422a5a0b615bc0337038e2b47..9207d616f9535e0188973cb527483b7c626171c3 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $"
+dnl "$Id$"
 dnl
 dnl   DNS Service Discovery (aka Bonjour) stuff for CUPS.
 dnl
@@ -82,5 +82,5 @@ AC_SUBST(IPPFIND_BIN)
 AC_SUBST(IPPFIND_MAN)
 
 dnl
-dnl End of "$Id: cups-dnssd.m4 7890 2008-08-29 22:19:39Z mike $".
+dnl End of "$Id$".
 dnl
index d378bbfabb6d9a48d7400d23bffcbf89e8186819..690d36c7cfd1505afe89c69d14759f383b56930a 100644 (file)
@@ -3,7 +3,7 @@ dnl   "$Id$"
 dnl
 dnl   GSSAPI/Kerberos library detection for CUPS.
 dnl
-dnl   Copyright 2007-2012 by Apple Inc.
+dnl   Copyright 2007-2013 by Apple Inc.
 dnl   Copyright 2006-2007 by Easy Software Products.
 dnl
 dnl   This file contains Kerberos support code, copyright 2006 by
@@ -71,38 +71,9 @@ if test x$enable_gssapi != xno; then
        if test "x$LIBGSSAPI" != x; then
                AC_CHECK_HEADER(krb5.h, AC_DEFINE(HAVE_KRB5_H))
                if test -d /System/Library/Frameworks/GSS.framework; then
-                       gssdir="/System/Library/Frameworks/GSS.framework"
-                       AC_MSG_CHECKING(for GSS/gssapi.h presence)
-                       if test -f $gssdir/Headers/gssapi.h; then
-                               AC_DEFINE(HAVE_GSS_GSSAPI_H)
-                               AC_MSG_RESULT(yes)
-                       else
-                               AC_MSG_RESULT(no)
-                       fi
-                       AC_MSG_CHECKING(for GSS/gssapi_generic.h presence)
-                       if test -f $gssdir/Headers/gssapi_generic.h; then
-                               AC_DEFINE(HAVE_GSSAPI_GENERIC_H)
-                               AC_MSG_RESULT(yes)
-                       else
-                               AC_MSG_RESULT(no)
-                       fi
-                       AC_MSG_CHECKING(for GSS/gssapi_spi.h presence)
-                       if test -f $gssdir/PrivateHeaders/gssapi_spi.h; then
-                               AC_MSG_RESULT(yes)
-                               AC_MSG_CHECKING(for GSS/gssapi_spi.h usability)
-                               if test -s $gssdir/PrivateHeaders/gssapi_spi.h; then
-                                       AC_MSG_RESULT(yes)
-                                       AC_DEFINE(HAVE_GSS_GSSAPI_SPI_H)
-                               else
-                                       AC_MSG_RESULT(no)
-                               fi
-                       else
-                               AC_MSG_RESULT(no)
-                               if test $uversion -ge 110 -a $uversion -lt 120; then
-                                       # Broken public headers in 10.7.x...
-                                       AC_MSG_ERROR(Run 'sudo mkdir -p $gssdir/PrivateHeaders' and 'sudo touch $gssdir/PrivateHeaders/gssapi_spi.h' to build CUPS.)
-                               fi
-                       fi
+                       AC_CHECK_HEADER(GSS/gssapi.h, AC_DEFINE(HAVE_GSS_GSSAPI_H))
+                       AC_CHECK_HEADER(GSS/gssapi_generic.h, AC_DEFINE(HAVE_GSS_GSSAPI_GENERIC_H))
+                       AC_CHECK_HEADER(GSS/gssapi_spi.h, AC_DEFINE(HAVE_GSS_GSSAPI_SPI_H))
                else
                        AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H))
                        AC_CHECK_HEADER(gssapi/gssapi.h, AC_DEFINE(HAVE_GSSAPI_GSSAPI_H))
index 8243de7878a0666835fe2c502dd7090cc53e4967..6ef4b81e18e42d077933fd81396654d239e828b0 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-largefile.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
 dnl   Large file support stuff for CUPS.
 dnl
@@ -48,5 +48,5 @@ fi
 AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
 
 dnl
-dnl End of "$Id: cups-largefile.m4 6649 2007-07-11 21:46:42Z mike $".
+dnl End of "$Id$".
 dnl
index 23a2295160289d9084a73d889c18e51e3eb7c4c9..8db35d43d18f59aaf6c9c956ac3ffa905ac9c9ee 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
 dnl   launchd stuff for CUPS.
 dnl
@@ -39,5 +39,5 @@ AC_SUBST(DEFAULT_LAUNCHD_CONF)
 AC_SUBST(LAUNCHDLIBS)
 
 dnl
-dnl End of "$Id: cups-launchd.m4 6649 2007-07-11 21:46:42Z mike $".
+dnl End of "$Id$".
 dnl
index d6026b24b051166b38e241f86716e7816895d3cf..5fc0d6e3c55e83758dcbae4e09a53938e3562164 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
 dnl   Libtool stuff for CUPS.
 dnl
@@ -35,5 +35,5 @@ if test x$LIBTOOL != x; then
 fi
 
 dnl
-dnl End of "$Id: cups-libtool.m4 6649 2007-07-11 21:46:42Z mike $".
+dnl End of "$Id$".
 dnl
index 16246838c09c6ee34e30f5af21e9f0468ddce4db..fd1d8c791de19b8ed7a836e83e5e458624c5b092 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
 dnl   Manpage stuff for CUPS.
 dnl
@@ -78,5 +78,5 @@ AC_SUBST(MAN8EXT)
 AC_SUBST(MAN8DIR)
 
 dnl
-dnl End of "$Id: cups-manpages.m4 6649 2007-07-11 21:46:42Z mike $".
+dnl End of "$Id$".
 dnl
index b97fb4a496e1209e6f68ef2bb9733bd6438100df..697cfb5b3becfe863357c5f1f226b041f1d7f82e 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-network.m4 7918 2008-09-08 22:03:01Z mike $"
+dnl "$Id$"
 dnl
 dnl   Networking stuff for CUPS.
 dnl
@@ -70,5 +70,5 @@ AC_CHECK_HEADERS(AppleTalk/at_proto.h,AC_DEFINE(HAVE_APPLETALK_AT_PROTO_H),,
        [#include <netat/appletalk.h>])
 
 dnl
-dnl End of "$Id: cups-network.m4 7918 2008-09-08 22:03:01Z mike $".
+dnl End of "$Id$".
 dnl
index acf5b51a34834b6d0ed886c72a809801625854e7..700a284d08aac00d635f9bf8e95168488f8e1014 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-opsys.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
 dnl   Operating system stuff for CUPS.
 dnl
@@ -35,5 +35,5 @@ case "$uname" in
 esac
 
 dnl
-dnl "$Id: cups-opsys.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
index 72bf32fc3549870b9aec689a9b879366fa1658a0..aa554d1b71c91eb06a206d13a65279dccd325b2b 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z mike $"
+dnl "$Id$"
 dnl
 dnl   PAM stuff for CUPS.
 dnl
@@ -98,5 +98,5 @@ AC_SUBST(PAMMOD)
 AC_SUBST(PAMMODAUTH)
 
 dnl
-dnl End of "$Id: cups-pam.m4 7960 2008-09-17 19:42:02Z mike $".
+dnl End of "$Id$".
 dnl
index d4ed98850e0619dda0990e13e38352eb91a7e607..af97a94dc41398fe9b399d81abd5e6c2e7e08a61 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-scripting.m4 7915 2008-09-07 22:18:29Z mike $"
+dnl "$Id$"
 dnl
 dnl   Scripting configuration stuff for CUPS.
 dnl
@@ -85,5 +85,5 @@ if test "x$CUPS_PYTHON" != x; then
 fi
 
 dnl
-dnl End of "$Id: cups-scripting.m4 7915 2008-09-07 22:18:29Z mike $".
+dnl End of "$Id$".
 dnl
index ef2c714240aa27ea5545ba8703d392861e090150..2313a2ae4a4bd83364f43cd3bce0d475eeb71b40 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $"
+dnl "$Id$"
 dnl
 dnl   Shared library support for CUPS.
 dnl
@@ -234,5 +234,5 @@ AC_SUBST(IMGLIBS)
 AC_SUBST(EXPORT_LDFLAGS)
 
 dnl
-dnl End of "$Id: cups-sharedlibs.m4 7630 2008-06-09 22:31:44Z mike $".
+dnl End of "$Id$".
 dnl
index f3dc0595f9be270a89626f2dafa8971fccbdbd51..faa9cc68e997b06e299d168c0c3c729be55a4a02 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $"
+dnl "$Id$"
 dnl
 dnl   OpenSSL/GNUTLS stuff for CUPS.
 dnl
@@ -157,5 +157,5 @@ EXPORT_SSLLIBS="$SSLLIBS"
 AC_SUBST(EXPORT_SSLLIBS)
 
 dnl
-dnl End of "$Id: cups-ssl.m4 7241 2008-01-22 22:34:52Z mike $".
+dnl End of "$Id$".
 dnl
index b95c79fa42d9a9f7ae4263d088a3771e4706ebac..bd5c69867e1cc9ae8090a701494276a552d1e720 100644 (file)
@@ -1,5 +1,5 @@
 dnl
-dnl "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $"
+dnl "$Id$"
 dnl
 dnl   Threading stuff for CUPS.
 dnl
@@ -50,5 +50,5 @@ fi
 AC_SUBST(PTHREAD_FLAGS)
 
 dnl
-dnl End of "$Id: cups-threads.m4 6649 2007-07-11 21:46:42Z mike $".
+dnl End of "$Id$".
 dnl
index 4955ba4d7383e3ad72a861789c7f53035f952873..d9ab970991e0dd23f61b8daf8e5c7a181d16f8e9 100644 (file)
@@ -345,6 +345,20 @@ httpAddrLookup(
 }
 
 
+/*
+ * 'httpAddrFamily()' - Get the address family of an address.
+ */
+
+int                                    /* O - Address family */
+httpAddrFamily(http_addr_t *addr)      /* I - Address */
+{
+  if (addr)
+    return (addr->addr.sa_family);
+  else
+    return (0);
+}
+
+
 /*
  * 'httpAddrPort()' - Get the port number associated with an address.
  *
@@ -355,7 +369,7 @@ int                                 /* O - Port number */
 httpAddrPort(http_addr_t *addr)                /* I - Address */
 {
   if (!addr)
-    return (ippPort());
+    return (-1);
 #ifdef AF_INET6
   else if (addr->addr.sa_family == AF_INET6)
     return (ntohs(addr->ipv6.sin6_port));
@@ -363,7 +377,7 @@ httpAddrPort(http_addr_t *addr)             /* I - Address */
   else if (addr->addr.sa_family == AF_INET)
     return (ntohs(addr->ipv4.sin_port));
   else
-    return (ippPort());
+    return (0);
 }
 
 /* For OS X 10.8 and earlier */
@@ -694,12 +708,16 @@ httpGetHostname(http_t *http,             /* I - HTTP connection or NULL */
                 char   *s,             /* I - String buffer for name */
                 int    slen)           /* I - Size of buffer */
 {
-  if (!s || slen <= 1)
-    return (NULL);
-
   if (http)
   {
-    if (http->hostname[0] == '/')
+    if (!s || slen <= 1)
+    {
+      if (http->hostname[0] == '/')
+       return ("localhost");
+      else
+       return (http->hostname);
+    }
+    else if (http->hostname[0] == '/')
       strlcpy(s, "localhost", slen);
     else
       strlcpy(s, http->hostname, slen);
@@ -710,6 +728,9 @@ httpGetHostname(http_t *http,               /* I - HTTP connection or NULL */
     * Get the hostname...
     */
 
+    if (!s || slen <= 1)
+      return (NULL);
+    
     if (gethostname(s, slen) < 0)
       strlcpy(s, "localhost", slen);
 
index a718ba347a6bf0584cc585b22720bf2589e041d1..0b7e24359fbad5df8f59743d598e32c4539ab343 100644 (file)
@@ -122,7 +122,7 @@ httpAddrConnect2(
                  httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
                  httpAddrPort(&(addrlist->addr))));
 
-    if ((*sock = (int)socket(_httpAddrFamily(&(addrlist->addr)), SOCK_STREAM,
+    if ((*sock = (int)socket(httpAddrFamily(&(addrlist->addr)), SOCK_STREAM,
                              0)) < 0)
     {
      /*
index 016dfe2ba756de6b74895eb8716aca2053e78bb4..43285b3c573a1d071f93f2f9a12a07aa85c1bb81 100644 (file)
@@ -243,6 +243,7 @@ typedef enum _http_mode_e           /**** HTTP mode enumeration ****/
   _HTTP_MODE_SERVER                    /* Server connected (accepted) from client */
 } _http_mode_t;
 
+#  ifndef _HTTP_NO_PRIVATE
 struct _http_s                         /**** HTTP connection structure ****/
 {
   int                  fd;             /* File descriptor for this socket */
@@ -264,7 +265,7 @@ struct _http_s                              /**** HTTP connection structure ****/
   int                  used;           /* Number of bytes used in buffer */
   char                 buffer[HTTP_MAX_BUFFER];
                                        /* Buffer for incoming data */
-  int                  auth_type;      /* Authentication in use */
+  int                  _auth_type;     /* Authentication in use (deprecated) */
   _cups_md5_state_t    md5_state;      /* MD5 state */
   char                 nonce[HTTP_MAX_VALUE];
                                        /* Nonce value */
@@ -333,6 +334,7 @@ struct _http_s                              /**** HTTP connection structure ****/
   Bytef                        *dbuffer;       /* Decompression buffer */
 #  endif /* HAVE_LIBZ */
 };
+#  endif /* !_HTTP_NO_PRIVATE */
 
 
 /*
@@ -396,7 +398,6 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs);
  * Prototypes...
  */
 
-#define                        _httpAddrFamily(addrp) (addrp)->addr.sa_family
 extern int             _httpAddrPort(http_addr_t *addr)
                                      _CUPS_INTERNAL_MSG("Use httpAddrPort instead.");
 extern void            _httpAddrSetPort(http_addr_t *addr, int port);
index 8f5c67d8082c5bf90e383a590295d0c5aaf13905..70838feffe86e3a0cf3f5dae702e58375fd466d9 100644 (file)
@@ -1,55 +1,18 @@
 /*
  * "$Id$"
  *
- *   HTTP support routines for CUPS.
+ * HTTP support routines for CUPS.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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/".
+ * These coded instructions, statements, and computer programs are the
+ * 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.
- *
- * Contents:
- *
- *   httpAssembleURI()   - Assemble a uniform resource identifier from its
- *                         components.
- *   httpAssembleURIf()   - Assemble a uniform resource identifier from its
- *                         components with a formatted resource.
- *   httpAssembleUUID()   - Assemble a name-based UUID URN conforming to RFC
- *                          4122.
- *   httpDecode64()      - Base64-decode a string.
- *   httpDecode64_2()    - Base64-decode a string.
- *   httpEncode64()      - Base64-encode a string.
- *   httpEncode64_2()    - Base64-encode a string.
- *   httpGetDateString()  - Get a formatted date/time string from a time value.
- *   httpGetDateString2() - Get a formatted date/time string from a time value.
- *   httpGetDateTime()   - Get a time value from a formatted date/time string.
- *   httpSeparate()      - Separate a Universal Resource Identifier into its
- *                         components.
- *   httpSeparate2()     - Separate a Universal Resource Identifier into its
- *                         components.
- *   httpSeparateURI()   - Separate a Universal Resource Identifier into its
- *                         components.
- *   _httpStatus()        - Return the localized string describing a HTTP
- *                          status code.
- *   httpStatus()        - Return a short string describing a HTTP status
- *                         code.
- *   _cups_hstrerror()   - hstrerror() emulation function for Solaris and
- *                         others.
- *   _httpDecodeURI()    - Percent-decode a HTTP request URI.
- *   _httpEncodeURI()    - Percent-encode a HTTP request URI.
- *   _httpResolveURI()   - Resolve a DNS-SD URI.
- *   http_client_cb()    - Client callback for resolving URI.
- *   http_copy_decode()   - Copy and decode a URI.
- *   http_copy_encode()   - Copy and encode a URI.
- *   http_poll_cb()       - Wait for input on the specified file descriptors.
- *   http_resolve_cb()   - Build a device URI for the given service name.
- *   http_resolve_cb()   - Build a device URI for the given service name.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
@@ -94,7 +57,7 @@ typedef struct _http_uribuf_s         /* URI buffer */
  * Local globals...
  */
 
-static const char * const http_days[7] =
+static const char * const http_days[7] =/* Days of the week */
                        {
                          "Sun",
                          "Mon",
@@ -105,7 +68,7 @@ static const char * const http_days[7] =
                          "Sat"
                        };
 static const char * const http_months[12] =
-                       {
+                       {               /* Months of the year */
                          "Jan",
                          "Feb",
                          "Mar",
@@ -119,6 +82,26 @@ static const char * const http_months[12] =
                          "Nov",
                          "Dec"
                        };
+static const char * const http_states[] =
+                       {               /* HTTP state strings */
+                         "HTTP_STATE_ERROR",
+                         "HTTP_STATE_WAITING",
+                         "HTTP_STATE_OPTIONS",
+                         "HTTP_STATE_GET",
+                         "HTTP_STATE_GET_SEND",
+                         "HTTP_STATE_HEAD",
+                         "HTTP_STATE_POST",
+                         "HTTP_STATE_POST_RECV",
+                         "HTTP_STATE_POST_SEND",
+                         "HTTP_STATE_PUT",
+                         "HTTP_STATE_PUT_RECV",
+                         "HTTP_STATE_DELETE",
+                         "HTTP_STATE_TRACE",
+                         "HTTP_STATE_CONNECT",
+                         "HTTP_STATE_STATUS",
+                         "HTTP_STATE_UNKNOWN_METHOD",
+                         "HTTP_STATE_UNKNOWN_VERSION"
+                       };
 
 
 /*
@@ -1324,6 +1307,22 @@ httpSeparateURI(
 }
 
 
+/*
+ * 'httpStateString()' - Return the string describing a HTTP state value.
+ *
+ * @since CUPS 2.0@
+ */
+
+const char *                           /* O - State string */
+httpStateString(http_state_t state)    /* I - HTTP state value */
+{
+  if (state < HTTP_STATE_ERROR || state > HTTP_STATE_UNKNOWN_VERSION)
+    return ("HTTP_STATE_???");
+  else
+    return (http_states[state - HTTP_STATE_ERROR]);
+}
+
+
 /*
  * '_httpStatus()' - Return the localized string describing a HTTP status code.
  *
index 8315cd22736e88c4b41375112038037096be6e9a..fc67ba890e75325223dff387c90c21d49edd3e6c 100644 (file)
@@ -202,8 +202,12 @@ httpAcceptConnection(int fd,               /* I - Listen socket file descriptor */
     return (NULL);
   }
 
-  httpAddrString(&(http->addrlist->addr), http->hostname,
-                sizeof(http->hostname));
+  http->hostaddr = &(http->addrlist->addr);
+
+  if (httpAddrLocalhost(http->hostaddr))
+    strlcpy(http->hostname, "localhost", sizeof(http->hostname));
+  else
+    httpAddrString(http->hostaddr, http->hostname, sizeof(http->hostname));
 
 #ifdef SO_NOSIGPIPE
  /*
@@ -1059,6 +1063,23 @@ httpGetCookie(http_t *http)              /* I - HTTP connecion */
 }
 
 
+/*
+ * 'httpGetEncryption()' - Get the current encryption mode of a connection.
+ *
+ * This function returns the encryption mode for the connection. Use the
+ * @link httpIsEncrypted@ function to determine whether a TLS session has
+ * been established.
+ *
+ * @since CUPS 2.0@
+ */
+
+http_encryption_t                      /* O - Current encryption mode */
+httpGetEncryption(http_t *http)                /* I - HTTP connection */
+{
+  return (http ? http->encryption : HTTP_ENCRYPTION_IF_REQUESTED);
+}
+
+
 /*
  * 'httpGetExpect()' - Get the value of the Expect header, if any.
  *
@@ -1274,6 +1295,23 @@ httpGetReady(http_t *http)               /* I - HTTP connection */
 }
 
 
+/*
+ * 'httpGetRemaining()' - Get the number of remaining bytes in the message
+ *                        body or current chunk.
+ *
+ * The @link httpIsChunked@ function can be used to determine whether the
+ * message body is chunked or fixed-length.
+ *
+ * @since CUPS 2.0@
+ */
+
+size_t                                 /* O - Remaining bytes */
+httpGetRemaining(http_t *http)         /* I - HTTP connection */
+{
+  return (http ? http->data_remaining : 0);
+}
+
+
 /*
  * 'httpGets()' - Get a line of text from a HTTP connection.
  */
@@ -1726,6 +1764,37 @@ httpInitialize(void)
 }
 
 
+/*
+ * 'httpIsChunked()' - Report whether a message body is chunked.
+ *
+ * This function returns non-zero if the message body is composed of
+ * variable-length chunks.
+ *
+ * @since CUPS 2.0@
+ */
+
+int                                    /* O - 1 if chunked, 0 if not */
+httpIsChunked(http_t *http)            /* I - HTTP connection */
+{
+  return (http ? http->data_encoding == HTTP_ENCODING_CHUNKED : 0);
+}
+
+
+/*
+ * 'httpIsEncrypted()' - Report whether a connection is encrypted.
+ *
+ * This function returns non-zero if the connection is currently encrypted.
+ *
+ * @since CUPS 2.0@
+ */
+
+int                                    /* O - 1 if encrypted, 0 if not */
+httpIsEncrypted(http_t *http)          /* I - HTTP connection */
+{
+  return (http ? http->tls != NULL : 0);
+}
+
+
 /*
  * 'httpOptions()' - Send an OPTIONS request to the server.
  */
@@ -3083,6 +3152,25 @@ httpSetTimeout(
 }
 
 
+/*
+ * 'httpShutdown()' - Shutdown one side of an HTTP connection.
+ *
+ * @since CUPS 2.0@
+ */
+
+void
+httpShutdown(http_t *http)             /* I - HTTP connection */
+{
+  if (!http || http->fd < 0)
+    return;
+
+  if (http->tls)
+    http_shutdown_ssl(http);
+
+  shutdown(http->fd, SHUT_RD);
+}
+
+
 /*
  * 'httpTrace()' - Send an TRACE request to the server.
  */
@@ -3812,7 +3900,7 @@ httpWriteResponse(http_t        *http,    /* I - HTTP connection */
 
   if (status >= HTTP_STATUS_BAD_REQUEST && http->keep_alive)
   {
-    http->keep_alive = 0;
+    http->keep_alive = HTTP_KEEPALIVE_OFF;
     httpSetField(http, HTTP_FIELD_KEEP_ALIVE, "");
   }
 
index 11f5b4af5ae818b95baf8f9bf02950986e4049ed..ce2c2515201898865b7bd3b0204baeac569a2505 100644 (file)
@@ -614,11 +614,19 @@ extern http_state_t       httpWriteResponse(http_t *http,
 
 
 /**** New in CUPS 2.0 ****/
+extern int             httpAddrFamily(http_addr_t *addr) _CUPS_API_2_0;
 extern time_t          httpGetActivity(http_t *http) _CUPS_API_2_0;
 extern http_addr_t     *httpGetAddress(http_t *http) _CUPS_API_2_0;
+extern http_encryption_t httpGetEncryption(http_t *http) _CUPS_API_2_0;
 extern http_keepalive_t        httpGetKeepAlive(http_t *http) _CUPS_API_2_0;
 extern size_t          httpGetReady(http_t *http) _CUPS_API_2_0;
+extern size_t          httpGetRemaining(http_t *http) _CUPS_API_2_0;
+extern int             httpIsChunked(http_t *http) _CUPS_API_2_0;
+extern int             httpIsEncrypted(http_t *http) _CUPS_API_2_0;
 extern void            httpSetKeepAlive(http_t *http, http_keepalive_t keep_alive) _CUPS_API_2_0;
+extern void            httpShutdown(http_t *http) _CUPS_API_2_0;
+extern const char      *httpStateString(http_state_t state);
+
 
 /*
  * C++ magic...
index 8c3a610fd4449f14da44aa49a4aeb4bf8571d828..3e30a9d98d5a47b35105bae38aeeebf3db1e48e8 100644 (file)
@@ -140,6 +140,14 @@ be found.
 <dd></dd>
 <dd>Specifies the directory where the server configuration files can be found.
 </dd>
+<dt>SyncOnClose Yes
+</dt>
+<dd></dd>
+<dt>SyncOnClose No
+</dt>
+<dd>Specifies whether the scheduler calls <i>fsync(2)</i> after writing configuration
+or state files. The default is No.
+</dd>
 <dt>SystemGroup group-name [group-name ...]
 </dt>
 <dd></dd>
index 0bb0ddcd9a8ae2f1a56e0dc61e2fabe621d27b9e..cc4e46e6c945360c4eb301504fe0de460eb7a3cf 100644 (file)
@@ -162,8 +162,6 @@ Getting the full set of Windows driver files should be easier.
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
 <i>smbd(8)</i>, <i>smb.conf(5)</i>,
 <a href='http://localhost:631/help'>http://localhost:631/help</a>
-<br>
-<a href='http://www.cups.org/windows/'>http://www.cups.org/windows/</a>
 
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
 Copyright 2007-2013 by Apple Inc.
index 635d2c648dc065bb0bfd18dd61a8cd8c94fbbdf0..514f683bcee307bc95770a468362fb96a66b9b7e 100644 (file)
@@ -1,51 +1,19 @@
 /*
  * "$Id$"
  *
- *   Authorization routines for the CUPS scheduler.
+ * Authorization routines for the CUPS scheduler.
  *
- *   Copyright 2007-2012 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   This file contains Kerberos support code, copyright 2006 by
- *   Jelmer Vernooij.
+ * This file contains Kerberos support code, copyright 2006 by
+ * Jelmer Vernooij.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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/".
- *
- * Contents:
- *
- *   cupsdAddIPMask()          - Add an IP address authorization mask.
- *   cupsdAddLocation()        - Add a location for authorization.
- *   cupsdAddName()            - Add a name to a location...
- *   cupsdAddNameMask()        - Add a host or interface name authorization
- *                               mask.
- *   cupsdAuthorize()          - Validate any authorization credentials.
- *   cupsdCheckAccess()        - Check whether the given address is allowed to
- *                               access a location.
- *   cupsdCheckAuth()          - Check authorization masks.
- *   cupsdCheckGroup()         - Check for a user's group membership.
- *   cupsdCopyLocation()       - Make a copy of a location...
- *   cupsdDeleteAllLocations() - Free all memory used for location
- *                               authorization.
- *   cupsdFindBest()           - Find the location entry that best matches the
- *                               resource.
- *   cupsdFindLocation()       - Find the named location.
- *   cupsdFreeLocation()       - Free all memory used by a location.
- *   cupsdIsAuthorized()       - Check to see if the user is authorized...
- *   cupsdNewLocation()        - Create a new location for authorization.
- *   check_authref()           - Check if an authorization services reference
- *                               has the supplied right.
- *   compare_locations()       - Compare two locations.
- *   copy_authmask()           - Copy function for auth masks.
- *   cups_crypt()              - Encrypt the password using the DES or MD5
- *                               algorithms, as needed.
- *   free_authmask()           - Free function for auth masks.
- *   get_md5_password()        - Get an MD5 password.
- *   pam_func()                - PAM conversation function.
- *   to64()                    - Base64-encode an integer value...
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
  */
 
 /*
@@ -408,7 +376,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
   }
 #ifdef HAVE_AUTHORIZATION_H
   else if (!strncmp(authorization, "AuthRef ", 8) &&
-           !_cups_strcasecmp(con->http->hostname, "localhost"))
+           httpAddrLocalhost(httpGetAddress(con->http)))
   {
     OSStatus           status;         /* Status */
     int                        authlen;        /* Auth string length */
@@ -601,7 +569,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
   }
 #endif /* SO_PEERCRED && AF_LOCAL */
   else if (!strncmp(authorization, "Local", 5) &&
-           !_cups_strcasecmp(con->http->hostname, "localhost"))
+          httpAddrLocalhost(httpGetAddress(con->http)))
   {
    /*
     * Get Local certificate authentication data...
@@ -1148,7 +1116,7 @@ cupsdAuthorize(cupsd_client_t *con)       /* I - Client connection */
     * to run as the correct user to get Kerberos credentials of its own.
     */
 
-    if (_httpAddrFamily(con->http->hostaddr) == AF_LOCAL)
+    if (httpAddrFamily(con->http->hostaddr) == AF_LOCAL)
     {
       cupsd_ucred_t    peercred;       /* Peer credentials */
       socklen_t                peersize;       /* Size of peer credentials */
@@ -1210,7 +1178,7 @@ cupsdAuthorize(cupsd_client_t *con)       /* I - Client connection */
 int                                    /* O - 1 if allowed, 0 otherwise */
 cupsdCheckAccess(
     unsigned         ip[4],            /* I - Client address */
-    char             *name,            /* I - Client hostname */
+    const char       *name,            /* I - Client hostname */
     int              namelen,          /* I - Length of hostname */
     cupsd_location_t *loc)             /* I - Location to check */
 {
@@ -1269,7 +1237,7 @@ cupsdCheckAccess(
 
 int                                    /* O - 1 if mask matches, 0 otherwise */
 cupsdCheckAuth(unsigned     ip[4],     /* I - Client address */
-              char         *name,      /* I - Client hostname */
+              const char   *name,      /* I - Client hostname */
               int          name_len,   /* I - Length of hostname */
               cups_array_t *masks)     /* I - Masks */
 {
@@ -1817,6 +1785,10 @@ cupsdIsAuthorized(cupsd_client_t *con,   /* I - Connection */
   int                  i,              /* Looping vars */
                        auth,           /* Authorization status */
                        type;           /* Type of authentication */
+  http_addr_t          *hostaddr = httpGetAddress(con->http);
+                                       /* Client address */
+  const char           *hostname = httpGetHostname(con->http, NULL, 0);
+                                       /* Client hostname */
   unsigned             address[4];     /* Authorization address */
   cupsd_location_t     *best;          /* Best match for location so far */
   int                  hostlen;        /* Length of hostname */
@@ -1857,8 +1829,9 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
 
   if (!con->best)
   {
-    if (!strcmp(con->http->hostname, "localhost") ||
-        !strcmp(con->http->hostname, ServerName))
+    if (httpAddrLocalhost(httpGetAddress(con->http)) ||
+        !strcmp(hostname, ServerName) ||
+       cupsArrayFind(ServerAlias, (void *)hostname))
       return (HTTP_OK);
     else
       return (HTTP_FORBIDDEN);
@@ -1884,16 +1857,16 @@ cupsdIsAuthorized(cupsd_client_t *con,  /* I - Connection */
   */
 
 #ifdef AF_INET6
-  if (con->http->hostaddr->addr.sa_family == AF_INET6)
+  if (httpAddrFamily(hostaddr) == AF_INET6)
   {
    /*
     * Copy IPv6 address...
     */
 
-    address[0] = ntohl(con->http->hostaddr->ipv6.sin6_addr.s6_addr32[0]);
-    address[1] = ntohl(con->http->hostaddr->ipv6.sin6_addr.s6_addr32[1]);
-    address[2] = ntohl(con->http->hostaddr->ipv6.sin6_addr.s6_addr32[2]);
-    address[3] = ntohl(con->http->hostaddr->ipv6.sin6_addr.s6_addr32[3]);
+    address[0] = ntohl(hostaddr->ipv6.sin6_addr.s6_addr32[0]);
+    address[1] = ntohl(hostaddr->ipv6.sin6_addr.s6_addr32[1]);
+    address[2] = ntohl(hostaddr->ipv6.sin6_addr.s6_addr32[2]);
+    address[3] = ntohl(hostaddr->ipv6.sin6_addr.s6_addr32[3]);
   }
   else
 #endif /* AF_INET6 */
@@ -1906,14 +1879,14 @@ cupsdIsAuthorized(cupsd_client_t *con,  /* I - Connection */
     address[0] = 0;
     address[1] = 0;
     address[2] = 0;
-    address[3] = ntohl(con->http->hostaddr->ipv4.sin_addr.s_addr);
+    address[3] = ntohl(hostaddr->ipv4.sin_addr.s_addr);
   }
   else
     memset(address, 0, sizeof(address));
 
-  hostlen = strlen(con->http->hostname);
+  hostlen = strlen(hostname);
 
-  auth = cupsdCheckAccess(address, con->http->hostname, hostlen, best)
+  auth = cupsdCheckAccess(address, hostname, hostlen, best)
              ? CUPSD_AUTH_ALLOW : CUPSD_AUTH_DENY;
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: auth=CUPSD_AUTH_%s...",
@@ -1928,7 +1901,8 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
   */
 
   if ((best->encryption >= HTTP_ENCRYPT_REQUIRED && !con->http->tls &&
-      _cups_strcasecmp(con->http->hostname, "localhost") &&
+      _cups_strcasecmp(hostname, "localhost") &&
+      !httpAddrLocalhost(hostaddr) &&
       best->satisfy == CUPSD_AUTH_SATISFY_ALL) &&
       !(type == CUPSD_AUTH_NEGOTIATE ||
         (type == CUPSD_AUTH_NONE &&
index feb2fcd523103109ccbe67b13c46fed725ddee23..ef5bd401e78a1689f0891fc3c3e06cd3147006ac 100644 (file)
@@ -1,16 +1,16 @@
 /*
  * "$Id$"
  *
- *   Authorization definitions for the CUPS scheduler.
+ * Authorization definitions for the CUPS scheduler.
  *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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/".
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
  */
 
 /*
@@ -130,9 +130,9 @@ extern void         cupsdAddLocation(cupsd_location_t *loc);
 extern void            cupsdAddName(cupsd_location_t *loc, char *name);
 extern int             cupsdAddNameMask(cups_array_t **masks, char *name);
 extern void            cupsdAuthorize(cupsd_client_t *con);
-extern int             cupsdCheckAccess(unsigned ip[4], char *name,
+extern int             cupsdCheckAccess(unsigned ip[4], const char *name,
                                         int namelen, cupsd_location_t *loc);
-extern int             cupsdCheckAuth(unsigned ip[4], char *name, int namelen,
+extern int             cupsdCheckAuth(unsigned ip[4], const char *name, int namelen,
                                       cups_array_t *masks);
 extern int             cupsdCheckGroup(const char *username,
                                        struct passwd *user,
index 676826413ac2d1019aa00951e68964c35c13ca43..0fda74791eb06541d71687f72e266bcb45e06860 100644 (file)
@@ -1,52 +1,27 @@
 /*
  * "$Id$"
  *
- *   Client routines for the CUPS scheduler.
+ * Client routines for the CUPS scheduler.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   This file contains Kerberos support code, copyright 2006 by
- *   Jelmer Vernooij.
+ * This file contains Kerberos support code, copyright 2006 by
+ * Jelmer Vernooij.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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/".
- *
- * Contents:
- *
- *   cupsdAcceptClient()    - Accept a new client.
- *   cupsdCloseAllClients() - Close all remote clients immediately.
- *   cupsdCloseClient()     - Close a remote client.
- *   cupsdFlushHeader()     - Flush the header fields to the client.
- *   cupsdReadClient()     - Read data from a client.
- *   cupsdSendCommand()     - Send output from a command via HTTP.
- *   cupsdSendError()      - Send an error message via HTTP.
- *   cupsdSendHeader()     - Send an HTTP request.
- *   cupsdUpdateCGI()      - Read status messages from CGI scripts and
- *                           programs.
- *   cupsdWriteClient()     - Write data to a client as needed.
- *   check_if_modified()    - Decode an "If-Modified-Since" line.
- *   compare_clients()     - Compare two client connections.
- *   data_ready()          - Check whether data is available from a client.
- *   get_file()            - Get a filename and state info.
- *   install_cupsd_conf()    - Install a configuration file.
- *   is_cgi()              - Is the resource a CGI script/program?
- *   is_path_absolute()     - Is a path absolute and free of relative elements
- *                           (i.e. "..").
- *   pipe_command()        - Pipe the output of a command to the remote
- *                           client.
- *   valid_host()          - Is the Host: field valid?
- *   write_file()          - Send a file via HTTP.
- *   write_pipe()          - Flag that data is available on the CGI pipe.
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
  */
 
 /*
  * Include necessary headers...
  */
 
+#define _CUPS_NO_DEPRECATED
+//#define _HTTP_NO_PRIVATE
 #include "cupsd.h"
 
 #ifdef __APPLE__
  * Local globals...
  */
 
-static const char      * const http_states[] =
-                       {               /* HTTP state strings */
-                         "HTTP_STATE_ERROR",
-                         "HTTP_STATE_WAITING",
-                         "HTTP_STATE_OPTIONS",
-                         "HTTP_STATE_GET",
-                         "HTTP_STATE_GET_SEND",
-                         "HTTP_STATE_HEAD",
-                         "HTTP_STATE_POST",
-                         "HTTP_STATE_POST_RECV",
-                         "HTTP_STATE_POST_SEND",
-                         "HTTP_STATE_PUT",
-                         "HTTP_STATE_PUT_RECV",
-                         "HTTP_STATE_DELETE",
-                         "HTTP_STATE_TRACE",
-                         "HTTP_STATE_CONNECT",
-                         "HTTP_STATE_STATUS",
-                         "HTTP_STATE_UNKNOWN_METHOD",
-                         "HTTP_STATE_UNKNOWN_VERSION"
-                       };
 static const char      * const ipp_states[] =
                        {               /* IPP state strings */
                          "IPP_IDLE",
                          "IPP_HEADER",
                          "IPP_ATTRIBUTE",
-                         "IPP_DATA"
+                         "IPP_STATE_DATA"
                        };
 
 
@@ -98,7 +53,6 @@ static int            check_if_modified(cupsd_client_t *con,
                                          struct stat *filestats);
 static int             compare_clients(cupsd_client_t *a, cupsd_client_t *b,
                                        void *data);
-static int             data_ready(cupsd_client_t *con);
 static char            *get_file(cupsd_client_t *con, struct stat *filestats,
                                  char *filename, int len);
 static http_status_t   install_cupsd_conf(cupsd_client_t *con);
@@ -188,7 +142,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   con->number = ++ LastClientNumber;
   con->file   = -1;
 //  con->http->activity   = time(NULL);
-//  con->http->hostaddr   = &(con->clientaddr);
+//  httpGetAddress(con->http)   = &(con->clientaddr);
 //  con->http->wait_value = 10000;
 //  con->http->mode       = _HTTP_MODE_SERVER;
 
@@ -220,10 +174,10 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   */
 
   if (lis->address.addr.sa_family == AF_INET6 &&
-      con->http->hostaddr->ipv6.sin6_addr.s6_addr32[0] == 0 &&
-      con->http->hostaddr->ipv6.sin6_addr.s6_addr32[1] == 0 &&
-      ntohl(con->http->hostaddr->ipv6.sin6_addr.s6_addr32[2]) == 0xffff)
-    con->http->hostaddr->ipv6.sin6_addr.s6_addr32[2] = 0;
+      httpGetAddress(con->http)->ipv6.sin6_addr.s6_addr32[0] == 0 &&
+      httpGetAddress(con->http)->ipv6.sin6_addr.s6_addr32[1] == 0 &&
+      ntohl(httpGetAddress(con->http)->ipv6.sin6_addr.s6_addr32[2]) == 0xffff)
+    httpGetAddress(con->http)->ipv6.sin6_addr.s6_addr32[2] = 0;
 #endif /* AF_INET6 */
 
  /*
@@ -262,14 +216,14 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   * Get the hostname or format the IP address as needed...
   */
 
-  if (httpAddrLocalhost(con->http->hostaddr))
+  if (httpAddrLocalhost(httpGetAddress(con->http)))
   {
    /*
     * Map accesses from the loopback interface to "localhost"...
     */
 
-    strlcpy(con->http->hostname, "localhost", sizeof(con->http->hostname));
-    hostname = con->http->hostname;
+    strlcpy(httpGetHostname(con->http, NULL, 0), "localhost", sizeof(httpGetHostname(con->http, NULL, 0)));
+    hostname = httpGetHostname(con->http, NULL, 0);
   }
   else
   {
@@ -278,13 +232,13 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
     */
 
     if (HostNameLookups)
-      hostname = httpAddrLookup(con->http->hostaddr, con->http->hostname,
-                                sizeof(con->http->hostname));
+      hostname = httpAddrLookup(httpGetAddress(con->http), httpGetHostname(con->http, NULL, 0),
+                                sizeof(httpGetHostname(con->http, NULL, 0)));
     else
     {
       hostname = NULL;
-      httpAddrString(con->http->hostaddr, con->http->hostname,
-                     sizeof(con->http->hostname));
+      httpAddrString(httpGetAddress(con->http), httpGetHostname(con->http, NULL, 0),
+                     sizeof(httpGetHostname(con->http, NULL, 0)));
     }
   }
 
@@ -298,7 +252,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
 
     cupsdLogClient(con, CUPSD_LOG_WARN,
                     "Name lookup failed - connection from %s closed!",
-                    con->http->hostname);
+                    httpGetHostname(con->http, NULL, 0));
 
     free(con);
     return;
@@ -310,7 +264,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
     * Do double lookups as needed...
     */
 
-    if ((addrlist = httpAddrGetList(con->http->hostname, AF_UNSPEC, NULL))
+    if ((addrlist = httpAddrGetList(httpGetHostname(con->http, NULL, 0), AF_UNSPEC, NULL))
             != NULL)
     {
      /*
@@ -318,7 +272,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
       */
 
       for (addr = addrlist; addr; addr = addr->next)
-        if (httpAddrEqual(con->http->hostaddr, &(addr->addr)))
+        if (httpAddrEqual(httpGetAddress(con->http), &(addr->addr)))
           break;
     }
     else
@@ -337,7 +291,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
 
       cupsdLogClient(con, CUPSD_LOG_WARN,
                       "IP lookup failed - connection from %s closed!",
-                      con->http->hostname);
+                      httpGetHostname(con->http, NULL, 0));
       free(con);
       return;
     }
@@ -359,14 +313,14 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
 
     cupsdLogClient(con, CUPSD_LOG_WARN,
                     "Connection from %s refused by /etc/hosts.allow and "
-                   "/etc/hosts.deny rules.", con->http->hostname);
+                   "/etc/hosts.deny rules.", httpGetHostname(con->http, NULL, 0));
     free(con);
     return;
   }
 #endif /* HAVE_TCPD_H */
 
 #ifdef AF_LOCAL
-  if (httpGetAddress(con->http)->addr.sa_family == AF_LOCAL)
+  if (httpAddrFamily(httpGetAddress(con->http)) == AF_LOCAL)
   {
 #  ifdef __APPLE__
     socklen_t  peersize;               /* Size of peer credentials */
@@ -380,23 +334,24 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
       if (!proc_name(peerpid, peername, sizeof(peername)))
        cupsdLogClient(con, CUPSD_LOG_DEBUG,
                       "Accepted from %s (Domain ???[%d])",
-                       con->http->hostname, (int)peerpid);
+                       httpGetHostname(con->http, NULL, 0), (int)peerpid);
       else
        cupsdLogClient(con, CUPSD_LOG_DEBUG,
                        "Accepted from %s (Domain %s[%d])",
-                       con->http->hostname, name, (int)peerpid);
+                       httpGetHostname(con->http, NULL, 0), name, (int)peerpid);
     }
     else
 #  endif /* __APPLE__ */
 
     cupsdLogClient(con, CUPSD_LOG_DEBUG, "Accepted from %s (Domain)",
-                   con->http->hostname);
+                   httpGetHostname(con->http, NULL, 0));
   }
   else
 #endif /* AF_LOCAL */
   cupsdLogClient(con, CUPSD_LOG_DEBUG, "Accepted from %s:%d (IPv%d)",
-                 con->http->hostname, httpAddrPort(con->http->hostaddr),
-                _httpAddrFamily(con->http->hostaddr) == AF_INET ? 4 : 6);
+                 httpGetHostname(con->http, NULL, 0),
+                httpAddrPort(httpGetAddress(con->http)),
+                httpAddrFamily(httpGetAddress(con->http)) == AF_INET ? 4 : 6);
 
  /*
   * Get the local address the client connected to...
@@ -412,7 +367,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
     con->serverport = LocalPort;
   }
 #ifdef AF_LOCAL
-  else if (_httpAddrFamily(&temp) == AF_LOCAL)
+  else if (httpAddrFamily(&temp) == AF_LOCAL)
   {
     strlcpy(con->servername, "localhost", sizeof(con->servername));
     con->serverport = LocalPort;
@@ -457,14 +412,12 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   * See if we are connecting on a secure port...
   */
 
-  if (lis->encryption == HTTP_ENCRYPT_ALWAYS)
+  if (lis->encryption == HTTP_ENCRYPTION_ALWAYS)
   {
    /*
     * https connection; go secure...
     */
 
-    con->http->encryption = HTTP_ENCRYPT_ALWAYS;
-
     if (!cupsdStartTLS(con))
       cupsdCloseClient(con);
   }
@@ -519,19 +472,6 @@ cupsdCloseClient(cupsd_client_t *con)      /* I - Client to close */
 
   partial = 0;
 
-#ifdef HAVE_SSL
- /*
-  * Shutdown encryption as needed...
-  */
-
-  if (con->http->tls)
-  {
-    partial = 1;
-
-    cupsdEndTLS(con);
-  }
-#endif /* HAVE_SSL */
-
   if (con->pipe_pid != 0)
   {
    /*
@@ -559,13 +499,22 @@ cupsdCloseClient(cupsd_client_t *con)     /* I - Client to close */
     cupsArrayRemove(ActiveClients, con);
     cupsdSetBusyState();
 
+#ifdef HAVE_SSL
+   /*
+    * Shutdown encryption as needed...
+    */
+
+    if (httpIsEncrypted(con->http))
+      partial = 1;
+#endif /* HAVE_SSL */
+
     if (partial)
     {
      /*
       * Only do a partial close so that the encrypted client gets everything.
       */
 
-      shutdown(httpGetFd(con->http), 0);
+      httpShutdown(con->http);
       cupsdAddSelect(httpGetFd(con->http), (cupsd_selfunc_t)cupsdReadClient,
                      NULL, con);
 
@@ -589,6 +538,8 @@ cupsdCloseClient(cupsd_client_t *con)       /* I - Client to close */
     * Free memory...
     */
 
+    cupsdRemoveSelect(httpGetFd(con->http));
+
     httpClose(con->http);
 
     cupsdClearString(&con->filename);
@@ -683,7 +634,7 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
   static unsigned      request_id = 0; /* Request ID for temp files */
 
 
-  status = HTTP_CONTINUE;
+  status = HTTP_STATUS_CONTINUE;
 
   cupsdLogClient(con, CUPSD_LOG_DEBUG2,
                 "cupsdReadClient "
@@ -694,11 +645,10 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                 "data_remaining=" CUPS_LLFMT ", "
                 "request=%p(%s), "
                 "file=%d",
-                con->http->error, con->http->used,
-                http_states[con->http->state + 1],
-                con->http->data_encoding == HTTP_ENCODING_CHUNKED ?
-                    "CHUNKED" : "LENGTH",
-                CUPS_LLCAST con->http->data_remaining,
+                httpError(con->http), (int)httpGetReady(con->http),
+                httpStateString(httpGetState(con->http)),
+                httpIsChunked(con->http) ? "CHUNKED" : "LENGTH",
+                CUPS_LLCAST httpGetRemaining(con->http),
                 con->request,
                 con->request ? ipp_states[con->request->state] : "",
                 con->file);
@@ -731,7 +681,7 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
   }
 #endif /* HAVE_SSL */
 
-  switch (con->http->state)
+  switch (httpGetState(con->http))
   {
     case HTTP_STATE_WAITING :
        /*
@@ -740,10 +690,10 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
 
         if (httpGets(line, sizeof(line) - 1, con->http) == NULL)
        {
-         if (con->http->error && con->http->error != EPIPE)
+         if (httpError(con->http) && httpError(con->http) != EPIPE)
            cupsdLogClient(con, CUPSD_LOG_DEBUG,
                           "HTTP_STATE_WAITING Closing for error %d (%s)",
-                          con->http->error, strerror(con->http->error));
+                          httpError(con->http), strerror(httpError(con->http)));
          else
            cupsdLogClient(con, CUPSD_LOG_DEBUG,
                           "HTTP_STATE_WAITING Closing on EOF.");
@@ -766,8 +716,8 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
         httpClearFields(con->http);
 
         con->http->activity        = time(NULL);
-        con->http->version         = HTTP_1_0;
-       con->http->keep_alive      = HTTP_KEEPALIVE_OFF;
+        con->http->version         = HTTP_VERSION_1_0;
+       httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
        con->http->data_encoding   = HTTP_ENCODING_LENGTH;
        con->http->data_remaining  = 0;
        con->http->_data_remaining = 0;
@@ -819,13 +769,13 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                cupsdLogClient(con, CUPSD_LOG_ERROR,
                                "Bad request line \"%s\" from %s.",
                                _httpEncodeURI(buf, line, sizeof(buf)),
-                               con->http->hostname);
-               cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
+                               httpGetHostname(con->http, NULL, 0));
+               cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
                cupsdCloseClient(con);
               }
              return;
          case 2 :
-             con->http->version = HTTP_0_9;
+             con->http->version = HTTP_VERSION_0_9;
              break;
          case 3 :
              if (sscanf(version, "HTTP/%d.%d", &major, &minor) != 2)
@@ -833,8 +783,8 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
                cupsdLogClient(con, CUPSD_LOG_ERROR,
                                "Bad request line \"%s\" from %s.",
                                _httpEncodeURI(buf, line, sizeof(buf)),
-                               con->http->hostname);
-               cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
+                               httpGetHostname(con->http, NULL, 0));
+               cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
                cupsdCloseClient(con);
                return;
              }
@@ -842,18 +792,18 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              if (major < 2)
              {
                con->http->version = (http_version_t)(major * 100 + minor);
-               if (con->http->version == HTTP_1_1 && KeepAlive)
-                 con->http->keep_alive = HTTP_KEEPALIVE_ON;
+               if (con->http->version == HTTP_VERSION_1_1 && KeepAlive)
+                 httpSetKeepAlive(con->http, HTTP_KEEPALIVE_ON);
                else
-                 con->http->keep_alive = HTTP_KEEPALIVE_OFF;
+                 httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
              }
              else
              {
                cupsdLogClient(con, CUPSD_LOG_ERROR,
                                "Unsupported request line \"%s\" from %s.",
                                _httpEncodeURI(buf, line, sizeof(buf)),
-                               con->http->hostname);
-               cupsdSendError(con, HTTP_NOT_SUPPORTED, CUPSD_AUTH_NONE);
+                               httpGetHostname(con->http, NULL, 0));
+               cupsdSendError(con, HTTP_STATUS_NOT_SUPPORTED, CUPSD_AUTH_NONE);
                cupsdCloseClient(con);
                return;
              }
@@ -899,7 +849,7 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
 
            cupsdLogClient(con, CUPSD_LOG_ERROR, "Bad URI \"%s\" in request.",
                            con->uri);
-           cupsdSendError(con, HTTP_METHOD_NOT_ALLOWED, CUPSD_AUTH_NONE);
+           cupsdSendError(con, HTTP_STATUS_METHOD_NOT_ALLOWED, CUPSD_AUTH_NONE);
            cupsdCloseClient(con);
            return;
          }
@@ -934,19 +884,19 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
        {
          cupsdLogClient(con, CUPSD_LOG_ERROR, "Bad operation \"%s\".",
                         operation);
-         cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
+         cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
          cupsdCloseClient(con);
          return;
        }
 
         gettimeofday(&(con->start), NULL);
-        con->operation = con->http->state;
+        con->operation = httpGetState(con->http);
 
         cupsdLogClient(con, CUPSD_LOG_DEBUG, "%s %s HTTP/%d.%d",
                       operation, con->uri, con->http->version / 100,
                        con->http->version % 100);
 
-       con->http->status = HTTP_OK;
+       con->http->status = HTTP_STATUS_OK;
 
         if (!cupsArrayFind(ActiveClients, con))
        {
@@ -965,28 +915,28 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
         * Parse incoming parameters until the status changes...
        */
 
-        while ((status = httpUpdate(con->http)) == HTTP_CONTINUE)
-         if (!data_ready(con))
+        while ((status = httpUpdate(con->http)) == HTTP_STATUS_CONTINUE)
+         if (!httpGetReady(con->http))
            break;
 
-       if (status != HTTP_OK && status != HTTP_CONTINUE)
+       if (status != HTTP_STATUS_OK && status != HTTP_STATUS_CONTINUE)
        {
-         if (con->http->error && con->http->error != EPIPE)
+         if (httpError(con->http) && httpError(con->http) != EPIPE)
            cupsdLogClient(con, CUPSD_LOG_DEBUG,
                            "Closing for error %d (%s) while reading headers.",
-                           con->http->error, strerror(con->http->error));
+                           httpError(con->http), strerror(httpError(con->http)));
          else
            cupsdLogClient(con, CUPSD_LOG_DEBUG,
                           "Closing on EOF while reading headers.");
 
-         cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
+         cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
          cupsdCloseClient(con);
          return;
        }
        break;
 
     default :
-        if (!data_ready(con) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1)
+        if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1)
        {
         /*
          * Connection closed...
@@ -1003,24 +953,24 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
   * Handle new transfers...
   */
 
-  if (status == HTTP_OK)
+  if (status == HTTP_STATUS_OK)
   {
-    if (con->http->fields[HTTP_FIELD_ACCEPT_LANGUAGE][0])
+    if (httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE)[0])
     {
      /*
       * Figure out the locale from the Accept-Language and Content-Type
       * fields...
       */
 
-      if ((ptr = strchr(con->http->fields[HTTP_FIELD_ACCEPT_LANGUAGE],
+      if ((ptr = strchr(httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE),
                         ',')) != NULL)
         *ptr = '\0';
 
-      if ((ptr = strchr(con->http->fields[HTTP_FIELD_ACCEPT_LANGUAGE],
+      if ((ptr = strchr(httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE),
                         ';')) != NULL)
         *ptr = '\0';
 
-      if ((ptr = strstr(con->http->fields[HTTP_FIELD_CONTENT_TYPE],
+      if ((ptr = strstr(httpGetField(con->http, HTTP_FIELD_CONTENT_TYPE),
                         "charset=")) != NULL)
       {
        /*
@@ -1029,14 +979,14 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
        */
 
         snprintf(locale, sizeof(locale), "%s.%s",
-                con->http->fields[HTTP_FIELD_ACCEPT_LANGUAGE], ptr + 8);
+                httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE), ptr + 8);
 
        if ((ptr = strchr(locale, ',')) != NULL)
          *ptr = '\0';
       }
       else
         snprintf(locale, sizeof(locale), "%s.UTF-8",
-                con->http->fields[HTTP_FIELD_ACCEPT_LANGUAGE]);
+                httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE));
 
       con->language = cupsLangGet(locale);
     }
@@ -1045,21 +995,21 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
 
     cupsdAuthorize(con);
 
-    if (!_cups_strncasecmp(con->http->fields[HTTP_FIELD_CONNECTION],
+    if (!_cups_strncasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION),
                            "Keep-Alive", 10) && KeepAlive)
-      con->http->keep_alive = HTTP_KEEPALIVE_ON;
-    else if (!_cups_strncasecmp(con->http->fields[HTTP_FIELD_CONNECTION],
+      httpSetKeepAlive(con->http, HTTP_KEEPALIVE_ON);
+    else if (!_cups_strncasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION),
                                 "close", 5))
-      con->http->keep_alive = HTTP_KEEPALIVE_OFF;
+      httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
 
-    if (!con->http->fields[HTTP_FIELD_HOST][0] &&
-        con->http->version >= HTTP_1_1)
+    if (!httpGetField(con->http, HTTP_FIELD_HOST)[0] &&
+        httpGetVersion(con->http) >= HTTP_VERSION_1_1)
     {
      /*
       * HTTP/1.1 and higher require the "Host:" field...
       */
 
-      if (!cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE))
+      if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE))
       {
         cupsdLogClient(con, CUPSD_LOG_ERROR, "Missing Host: field in request.");
        cupsdCloseClient(con);
@@ -1075,9 +1025,9 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
 
       cupsdLogClient(con, CUPSD_LOG_ERROR,
                      "Request from \"%s\" using invalid Host: field \"%s\".",
-                     con->http->hostname, con->http->fields[HTTP_FIELD_HOST]);
+                     httpGetHostname(con->http, NULL, 0), httpGetField(con->http, HTTP_FIELD_HOST));
 
-      if (!cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE))
+      if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE))
       {
        cupsdCloseClient(con);
        return;
@@ -1091,22 +1041,22 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
 
       if (con->best && con->best->type != CUPSD_AUTH_NONE)
       {
-       if (!cupsdSendHeader(con, HTTP_UNAUTHORIZED, NULL, CUPSD_AUTH_NONE))
+       if (!cupsdSendHeader(con, HTTP_STATUS_UNAUTHORIZED, NULL, CUPSD_AUTH_NONE))
        {
          cupsdCloseClient(con);
          return;
        }
       }
 
-      if (!_cups_strcasecmp(con->http->fields[HTTP_FIELD_CONNECTION], "Upgrade") &&
-         con->http->tls == NULL)
+      if (!_cups_strcasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION), "Upgrade") &&
+         !httpIsEncrypted(con->http))
       {
 #ifdef HAVE_SSL
        /*
         * Do encryption stuff...
        */
 
-       if (!cupsdSendHeader(con, HTTP_SWITCHING_PROTOCOLS, NULL, CUPSD_AUTH_NONE))
+       if (!cupsdSendHeader(con, HTTP_STATUS_SWITCHING_PROTOCOLS, NULL, CUPSD_AUTH_NONE))
        {
          cupsdCloseClient(con);
          return;
@@ -1137,7 +1087,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
 #endif /* HAVE_SSL */
       }
 
-      if (!cupsdSendHeader(con, HTTP_OK, NULL, CUPSD_AUTH_NONE))
+      if (!cupsdSendHeader(con, HTTP_STATUS_OK, NULL, CUPSD_AUTH_NONE))
       {
        cupsdCloseClient(con);
        return;
@@ -1162,7 +1112,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
       cupsdLogClient(con, CUPSD_LOG_ERROR,
                      "Request for non-absolute resource \"%s\".", con->uri);
 
-      if (!cupsdSendError(con, HTTP_FORBIDDEN, CUPSD_AUTH_NONE))
+      if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE))
       {
        cupsdCloseClient(con);
        return;
@@ -1170,7 +1120,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
     }
     else
     {
-      if (!_cups_strcasecmp(con->http->fields[HTTP_FIELD_CONNECTION],
+      if (!_cups_strcasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION),
                             "Upgrade") && con->http->tls == NULL)
       {
 #ifdef HAVE_SSL
@@ -1178,7 +1128,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
         * Do encryption stuff...
        */
 
-       if (!cupsdSendHeader(con, HTTP_SWITCHING_PROTOCOLS, NULL,
+       if (!cupsdSendHeader(con, HTTP_STATUS_SWITCHING_PROTOCOLS, NULL,
                             CUPSD_AUTH_NONE))
        {
          cupsdCloseClient(con);
@@ -1210,7 +1160,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
 #endif /* HAVE_SSL */
       }
 
-      if ((status = cupsdIsAuthorized(con, NULL)) != HTTP_OK)
+      if ((status = cupsdIsAuthorized(con, NULL)) != HTTP_STATUS_OK)
       {
        cupsdSendError(con, status, CUPSD_AUTH_NONE);
        cupsdCloseClient(con);
@@ -1220,13 +1170,13 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
       if (con->http->expect &&
           (con->operation == HTTP_STATE_POST || con->operation == HTTP_STATE_PUT))
       {
-        if (con->http->expect == HTTP_CONTINUE)
+        if (con->http->expect == HTTP_STATUS_CONTINUE)
        {
         /*
          * Send 100-continue header...
          */
 
-         if (!cupsdSendHeader(con, HTTP_CONTINUE, NULL, CUPSD_AUTH_NONE))
+         if (!cupsdSendHeader(con, HTTP_STATUS_CONTINUE, NULL, CUPSD_AUTH_NONE))
          {
            cupsdCloseClient(con);
            return;
@@ -1238,7 +1188,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
          * Send 417-expectation-failed header...
          */
 
-         if (!cupsdSendHeader(con, HTTP_EXPECTATION_FAILED, NULL,
+         if (!cupsdSendHeader(con, HTTP_STATUS_EXPECTATION_FAILED, NULL,
                               CUPSD_AUTH_NONE))
          {
            cupsdCloseClient(con);
@@ -1256,7 +1206,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
        }
       }
 
-      switch (con->http->state)
+      switch (httpGetState(con->http))
       {
        case HTTP_STATE_GET_SEND :
             if ((!strncmp(con->uri, "/ppd/", 5) ||
@@ -1310,7 +1260,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              }
              else
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1368,7 +1318,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                snprintf(con->uri, sizeof(con->uri), "/icons/%s.png", p->name);
              else
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1383,7 +1333,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              * Web interface is disabled. Show an appropriate message...
              */
 
-             if (!cupsdSendError(con, HTTP_WEBIF_DISABLED, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1454,17 +1404,17 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
 
               if (!cupsdSendCommand(con, con->command, con->options, 0))
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
                }
               }
              else
-               cupsdLogRequest(con, HTTP_OK);
+               cupsdLogRequest(con, HTTP_STATUS_OK);
 
-             if (con->http->version <= HTTP_1_0)
-               con->http->keep_alive = HTTP_KEEPALIVE_OFF;
+             if (con->http->version <= HTTP_VERSION_1_0)
+               httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
            }
             else if ((!strncmp(con->uri, "/admin/conf/", 12) &&
                      (strchr(con->uri + 12, '/') ||
@@ -1481,7 +1431,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              cupsdLogClient(con, CUPSD_LOG_ERROR,
                              "Request for subdirectory \"%s\"!", con->uri);
 
-             if (!cupsdSendError(con, HTTP_FORBIDDEN, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1498,7 +1448,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
               if ((filename = get_file(con, &filestats, buf,
                                       sizeof(buf))) == NULL)
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1518,23 +1468,23 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
 
                if (!cupsdSendCommand(con, con->command, con->options, 0))
                {
-                 if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+                 if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                  {
                    cupsdCloseClient(con);
                    return;
                  }
                }
                else
-                 cupsdLogRequest(con, HTTP_OK);
+                 cupsdLogRequest(con, HTTP_STATUS_OK);
 
-               if (con->http->version <= HTTP_1_0)
-                 con->http->keep_alive = HTTP_KEEPALIVE_OFF;
+               if (con->http->version <= HTTP_VERSION_1_0)
+                 httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
                break;
              }
 
              if (!check_if_modified(con, &filestats))
               {
-               if (!cupsdSendError(con, HTTP_NOT_MODIFIED, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_MODIFIED, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1547,7 +1497,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                else
                  snprintf(line, sizeof(line), "%s/%s", type->super, type->type);
 
-               if (!write_file(con, HTTP_OK, filename, line, &filestats))
+               if (!write_file(con, HTTP_STATUS_OK, filename, line, &filestats))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1562,7 +1512,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            * so check the length against any limits that are set...
            */
 
-            if (con->http->fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
+            if (httpGetField(con->http, HTTP_FIELD_CONTENT_LENGTH)[0] &&
                MaxRequestSize > 0 &&
                con->http->data_remaining > MaxRequestSize)
            {
@@ -1570,7 +1520,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              * Request too large...
              */
 
-              if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1579,14 +1529,14 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
              break;
             }
            else if (con->http->data_remaining < 0 ||
-                    (!con->http->fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
+                    (!httpGetField(con->http, HTTP_FIELD_CONTENT_LENGTH)[0] &&
                      con->http->data_encoding == HTTP_ENCODING_LENGTH))
            {
             /*
              * Negative content lengths are invalid!
              */
 
-              if (!cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1600,7 +1550,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            * content-type field will be "application/ipp"...
            */
 
-           if (!strcmp(con->http->fields[HTTP_FIELD_CONTENT_TYPE],
+           if (!strcmp(httpGetField(con->http, HTTP_FIELD_CONTENT_TYPE),
                        "application/ipp"))
               con->request = ippNew();
             else if (!WebInterface)
@@ -1609,7 +1559,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              * Web interface is disabled. Show an appropriate message...
              */
 
-             if (!cupsdSendError(con, HTTP_WEBIF_DISABLED, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1677,8 +1627,8 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                  cupsdSetString(&con->options, NULL);
              }
 
-             if (con->http->version <= HTTP_1_0)
-               con->http->keep_alive = HTTP_KEEPALIVE_OFF;
+             if (con->http->version <= HTTP_VERSION_1_0)
+               httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
            }
            else
            {
@@ -1689,7 +1639,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
               if ((filename = get_file(con, &filestats, buf,
                                       sizeof(buf))) == NULL)
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1706,7 +1656,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                * Only POST to CGI's...
                */
 
-               if (!cupsdSendError(con, HTTP_UNAUTHORIZED, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_UNAUTHORIZED, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1729,7 +1679,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              cupsdLogClient(con, CUPSD_LOG_ERROR,
                             "Disallowed PUT request for \"%s\".", con->uri);
 
-             if (!cupsdSendError(con, HTTP_FORBIDDEN, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1743,7 +1693,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            * so check the length against any limits that are set...
            */
 
-            if (con->http->fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
+            if (httpGetField(con->http, HTTP_FIELD_CONTENT_LENGTH)[0] &&
                MaxRequestSize > 0 &&
                con->http->data_remaining > MaxRequestSize)
            {
@@ -1751,7 +1701,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              * Request too large...
              */
 
-              if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1765,7 +1715,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              * Negative content lengths are invalid!
              */
 
-              if (!cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1788,7 +1738,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                             "Unable to create request file \"%s\": %s",
                              con->filename, strerror(errno));
 
-             if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1802,7 +1752,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
 
        case HTTP_STATE_DELETE :
        case HTTP_STATE_TRACE :
-            cupsdSendError(con, HTTP_NOT_IMPLEMENTED, CUPSD_AUTH_NONE);
+            cupsdSendError(con, HTTP_STATUS_NOT_IMPLEMENTED, CUPSD_AUTH_NONE);
            cupsdCloseClient(con);
            return;
 
@@ -1821,7 +1771,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                snprintf(con->uri, sizeof(con->uri), "/ppd/%s.ppd", p->name);
              else
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1844,7 +1794,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                snprintf(con->uri, sizeof(con->uri), "/icons/%s.png", p->name);
              else
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
@@ -1855,7 +1805,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            }
            else if (!WebInterface)
            {
-              if (!cupsdSendHeader(con, HTTP_OK, NULL, CUPSD_AUTH_NONE))
+              if (!cupsdSendHeader(con, HTTP_STATUS_OK, NULL, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1891,7 +1841,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              * CGI output...
              */
 
-              if (!cupsdSendHeader(con, HTTP_OK, "text/html", CUPSD_AUTH_NONE))
+              if (!cupsdSendHeader(con, HTTP_STATUS_OK, "text/html", CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1909,7 +1859,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                return;
              }
 
-              cupsdLogRequest(con, HTTP_OK);
+              cupsdLogRequest(con, HTTP_STATUS_OK);
            }
             else if ((!strncmp(con->uri, "/admin/conf/", 12) &&
                      (strchr(con->uri + 12, '/') ||
@@ -1926,7 +1876,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              cupsdLogClient(con, CUPSD_LOG_ERROR,
                             "Request for subdirectory \"%s\".", con->uri);
 
-             if (!cupsdSendError(con, HTTP_FORBIDDEN, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1937,24 +1887,24 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
            else if ((filename = get_file(con, &filestats, buf,
                                          sizeof(buf))) == NULL)
            {
-             if (!cupsdSendHeader(con, HTTP_NOT_FOUND, "text/html",
+             if (!cupsdSendHeader(con, HTTP_STATUS_NOT_FOUND, "text/html",
                                   CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
              }
 
-              cupsdLogRequest(con, HTTP_NOT_FOUND);
+              cupsdLogRequest(con, HTTP_STATUS_NOT_FOUND);
            }
            else if (!check_if_modified(con, &filestats))
             {
-              if (!cupsdSendError(con, HTTP_NOT_MODIFIED, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_NOT_MODIFIED, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
              }
 
-              cupsdLogRequest(con, HTTP_NOT_MODIFIED);
+              cupsdLogRequest(con, HTTP_STATUS_NOT_MODIFIED);
            }
            else
            {
@@ -1968,7 +1918,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              else
                snprintf(line, sizeof(line), "%s/%s", type->super, type->type);
 
-              if (!cupsdSendHeader(con, HTTP_OK, line, CUPSD_AUTH_NONE))
+              if (!cupsdSendHeader(con, HTTP_STATUS_OK, line, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -1988,7 +1938,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                return;
              }
 
-              cupsdLogRequest(con, HTTP_OK);
+              cupsdLogRequest(con, HTTP_STATUS_OK);
            }
 
             if (httpPrintf(con->http, "\r\n") < 0)
@@ -2018,17 +1968,17 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
   * Handle any incoming data...
   */
 
-  switch (con->http->state)
+  switch (httpGetState(con->http))
   {
     case HTTP_STATE_PUT_RECV :
         do
        {
           if ((bytes = httpRead2(con->http, line, sizeof(line))) < 0)
          {
-           if (con->http->error && con->http->error != EPIPE)
+           if (httpError(con->http) && httpError(con->http) != EPIPE)
              cupsdLogClient(con, CUPSD_LOG_DEBUG,
                              "HTTP_STATE_PUT_RECV Closing for error %d (%s)",
-                             con->http->error, strerror(con->http->error));
+                             httpError(con->http), strerror(httpError(con->http)));
            else
              cupsdLogClient(con, CUPSD_LOG_DEBUG,
                             "HTTP_STATE_PUT_RECV Closing on EOF.");
@@ -2051,7 +2001,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              unlink(con->filename);
              cupsdClearString(&con->filename);
 
-              if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -2059,9 +2009,9 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            }
          }
         }
-       while (con->http->state == HTTP_STATE_PUT_RECV && data_ready(con));
+       while (httpGetState(con->http) == HTTP_STATE_PUT_RECV && httpGetReady(con->http));
 
-        if (con->http->state == HTTP_STATE_STATUS)
+        if (httpGetState(con->http) == HTTP_STATE_STATUS)
        {
         /*
          * End of file, see how big it is...
@@ -2082,7 +2032,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            unlink(con->filename);
            cupsdClearString(&con->filename);
 
-            if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+            if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
            {
              cupsdCloseClient(con);
              return;
@@ -2116,25 +2066,25 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
            * Grab any request data from the connection...
            */
 
-           if ((ipp_state = ippRead(con->http, con->request)) == IPP_ERROR)
+           if ((ipp_state = ippRead(con->http, con->request)) == IPP_STATE_ERROR)
            {
               cupsdLogClient(con, CUPSD_LOG_ERROR, "IPP read error: %s",
                              cupsLastErrorString());
 
-             cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
+             cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
              cupsdCloseClient(con);
              return;
            }
-           else if (ipp_state != IPP_DATA)
+           else if (ipp_state != IPP_STATE_DATA)
            {
-              if (con->http->state == HTTP_STATE_POST_SEND)
+              if (httpGetState(con->http) == HTTP_STATE_POST_SEND)
              {
-               cupsdSendError(con, HTTP_BAD_REQUEST, CUPSD_AUTH_NONE);
+               cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
                cupsdCloseClient(con);
                return;
              }
 
-             if (data_ready(con))
+             if (httpGetReady(con->http))
                continue;
              break;
             }
@@ -2149,7 +2099,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            }
          }
 
-          if (con->file < 0 && con->http->state != HTTP_STATE_POST_SEND)
+          if (con->file < 0 && httpGetState(con->http) != HTTP_STATE_POST_SEND)
          {
            /*
            * Create a file as needed for the request data...
@@ -2165,7 +2115,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                             "Unable to create request file \"%s\": %s",
                              con->filename, strerror(errno));
 
-             if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+             if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -2177,16 +2127,16 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
             fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
          }
 
-         if (con->http->state != HTTP_STATE_POST_SEND)
+         if (httpGetState(con->http) != HTTP_STATE_POST_SEND)
          {
            if (!httpWait(con->http, 0))
              return;
             else if ((bytes = httpRead2(con->http, line, sizeof(line))) < 0)
            {
-             if (con->http->error && con->http->error != EPIPE)
+             if (httpError(con->http) && httpError(con->http) != EPIPE)
                cupsdLogClient(con, CUPSD_LOG_DEBUG,
                               "HTTP_STATE_POST_SEND Closing for error %d (%s)",
-                               con->http->error, strerror(con->http->error));
+                               httpError(con->http), strerror(httpError(con->http)));
              else
                cupsdLogClient(con, CUPSD_LOG_DEBUG,
                               "HTTP_STATE_POST_SEND Closing on EOF.");
@@ -2209,7 +2159,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                unlink(con->filename);
                cupsdClearString(&con->filename);
 
-               if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE,
+               if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE,
                                    CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
@@ -2217,21 +2167,21 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
                }
              }
            }
-           else if (con->http->state == HTTP_STATE_POST_RECV)
+           else if (httpGetState(con->http) == HTTP_STATE_POST_RECV)
               return;
-           else if (con->http->state != HTTP_STATE_POST_SEND)
+           else if (httpGetState(con->http) != HTTP_STATE_POST_SEND)
            {
              cupsdLogClient(con, CUPSD_LOG_DEBUG,
                             "Closing on unexpected state %s.",
-                            http_states[con->http->state + 1]);
+                            httpStateString(httpGetState(con->http)));
              cupsdCloseClient(con);
              return;
            }
          }
         }
-       while (con->http->state == HTTP_STATE_POST_RECV && data_ready(con));
+       while (httpGetState(con->http) == HTTP_STATE_POST_RECV && httpGetReady(con->http));
 
-       if (con->http->state == HTTP_STATE_POST_SEND)
+       if (httpGetState(con->http) == HTTP_STATE_POST_SEND)
        {
          if (con->file >= 0)
          {
@@ -2260,7 +2210,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                con->request = NULL;
               }
 
-              if (!cupsdSendError(con, HTTP_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
+              if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -2280,14 +2230,14 @@ cupsdReadClient(cupsd_client_t *con)    /* I - Client to read from */
            {
              if (!cupsdSendCommand(con, con->command, con->options, 0))
              {
-               if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+               if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
                {
                  cupsdCloseClient(con);
                  return;
                }
               }
              else
-               cupsdLogRequest(con, HTTP_OK);
+               cupsdLogRequest(con, HTTP_STATUS_OK);
             }
          }
 
@@ -2310,9 +2260,9 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
         break; /* Anti-compiler-warning-code */
   }
 
-  if (con->http->state == HTTP_STATE_WAITING)
+  if (httpGetState(con->http) == HTTP_STATE_WAITING)
   {
-    if (!con->http->keep_alive)
+    if (!httpGetKeepAlive(con->http))
     {
       cupsdLogClient(con, CUPSD_LOG_DEBUG,
                      "Closing because Keep-Alive is disabled.");
@@ -2403,12 +2353,12 @@ cupsdSendError(cupsd_client_t *con,     /* I - Connection */
   * server is configured...
   */
 
-  if (code == HTTP_UNAUTHORIZED &&
-      DefaultEncryption == HTTP_ENCRYPT_REQUIRED &&
-      _cups_strcasecmp(con->http->hostname, "localhost") &&
-      !con->http->tls)
+  if (code == HTTP_STATUS_UNAUTHORIZED &&
+      DefaultEncryption == HTTP_ENCRYPTION_REQUIRED &&
+      _cups_strcasecmp(httpGetHostname(con->http, NULL, 0), "localhost") &&
+      !httpIsEncrypted(con->http))
   {
-    code = HTTP_UPGRADE_REQUIRED;
+    code = HTTP_STATUS_UPGRADE_REQUIRED;
   }
 #endif /* HAVE_SSL */
 
@@ -2426,8 +2376,8 @@ cupsdSendError(cupsd_client_t *con,       /* I - Connection */
   * never disable it in that case.
   */
 
-  if (code >= HTTP_BAD_REQUEST && con->http->auth_type != CUPSD_AUTH_NEGOTIATE)
-    con->http->keep_alive = HTTP_KEEPALIVE_OFF;
+  if (code >= HTTP_STATUS_BAD_REQUEST && con->type != CUPSD_AUTH_NEGOTIATE)
+    httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF);
 
  /*
   * Send an error message back to the client.  If the error code is a
@@ -2438,7 +2388,7 @@ cupsdSendError(cupsd_client_t *con,       /* I - Connection */
     return (0);
 
 #ifdef HAVE_SSL
-  if (code == HTTP_UPGRADE_REQUIRED)
+  if (code == HTTP_STATUS_UPGRADE_REQUIRED)
     if (httpPrintf(con->http, "Connection: Upgrade\r\n") < 0)
       return (0);
 
@@ -2446,14 +2396,14 @@ cupsdSendError(cupsd_client_t *con,     /* I - Connection */
     return (0);
 #endif /* HAVE_SSL */
 
-  if (con->http->version >= HTTP_1_1 &&
-      con->http->keep_alive == HTTP_KEEPALIVE_OFF)
+  if (con->http->version >= HTTP_VERSION_1_1 &&
+      httpGetKeepAlive(con->http) == HTTP_KEEPALIVE_OFF)
   {
     if (httpPrintf(con->http, "Connection: close\r\n") < 0)
       return (0);
   }
 
-  if (code >= HTTP_BAD_REQUEST)
+  if (code >= HTTP_STATUS_BAD_REQUEST)
   {
    /*
     * Send a human-readable error message.
@@ -2467,13 +2417,13 @@ cupsdSendError(cupsd_client_t *con,     /* I - Connection */
 
     redirect[0] = '\0';
 
-    if (code == HTTP_UNAUTHORIZED)
+    if (code == HTTP_STATUS_UNAUTHORIZED)
       text = _cupsLangString(con->language,
                              _("Enter your username and password or the "
                               "root username and password to access this "
                               "page. If you are using Kerberos authentication, "
                               "make sure you have a valid Kerberos ticket."));
-    else if (code == HTTP_UPGRADE_REQUIRED)
+    else if (code == HTTP_STATUS_UPGRADE_REQUIRED)
     {
       text = urltext;
 
@@ -2490,7 +2440,7 @@ cupsdSendError(cupsd_client_t *con,       /* I - Connection */
               "CONTENT=\"3;URL=https://%s:%d%s\">\n",
               con->servername, con->serverport, con->uri);
     }
-    else if (code == HTTP_WEBIF_DISABLED)
+    else if (code == HTTP_STATUS_CUPS_WEBIF_DISABLED)
       text = _cupsLangString(con->language,
                              _("The web interface is currently disabled. Run "
                               "\"cupsctl WebInterface=yes\" to enable it."));
@@ -2559,7 +2509,7 @@ cupsdSendHeader(
   * Send the HTTP status header...
   */
 
-  if (code == HTTP_CONTINUE)
+  if (code == HTTP_STATUS_CONTINUE)
   {
    /*
     * 100-continue doesn't send any headers...
@@ -2568,14 +2518,14 @@ cupsdSendHeader(
     return (httpPrintf(con->http, "HTTP/%d.%d 100 Continue\r\n\r\n",
                       con->http->version / 100, con->http->version % 100) > 0);
   }
-  else if (code == HTTP_WEBIF_DISABLED)
+  else if (code == HTTP_STATUS_CUPS_WEBIF_DISABLED)
   {
    /*
     * Treat our special "web interface is disabled" status as "200 OK" for web
     * browsers.
     */
 
-    code = HTTP_OK;
+    code = HTTP_STATUS_OK;
   }
 
   httpFlushWrite(con->http);
@@ -2590,7 +2540,7 @@ cupsdSendHeader(
   if (ServerHeader)
     if (httpPrintf(con->http, "Server: %s\r\n", ServerHeader) < 0)
       return (0);
-  if (con->http->keep_alive && con->http->version >= HTTP_1_0)
+  if (httpGetKeepAlive(con->http) && con->http->version >= HTTP_VERSION_1_0)
   {
     if (httpPrintf(con->http, "Connection: Keep-Alive\r\n") < 0)
       return (0);
@@ -2598,11 +2548,14 @@ cupsdSendHeader(
                    KeepAliveTimeout) < 0)
       return (0);
   }
-  if (code == HTTP_METHOD_NOT_ALLOWED)
+  else if (httpPrintf(con->http, "Connection: close\r\n") < 0)
+    return (0);
+
+  if (code == HTTP_STATUS_METHOD_NOT_ALLOWED)
     if (httpPrintf(con->http, "Allow: GET, HEAD, OPTIONS, POST, PUT\r\n") < 0)
       return (0);
 
-  if (code == HTTP_UNAUTHORIZED)
+  if (code == HTTP_STATUS_UNAUTHORIZED)
   {
     if (auth_type == CUPSD_AUTH_NONE)
     {
@@ -2618,12 +2571,12 @@ cupsdSendHeader(
       strlcpy(auth_str, "Basic realm=\"CUPS\"", sizeof(auth_str));
     else if (auth_type == CUPSD_AUTH_DIGEST)
       snprintf(auth_str, sizeof(auth_str), "Digest realm=\"CUPS\", nonce=\"%s\"",
-              con->http->hostname);
+              httpGetHostname(con->http, NULL, 0));
 #ifdef HAVE_GSSAPI
     else if (auth_type == CUPSD_AUTH_NEGOTIATE)
     {
 #  ifdef AF_LOCAL
-      if (_httpAddrFamily(con->http->hostaddr) == AF_LOCAL)
+      if (httpAddrFamily(httpGetAddress(con->http)) == AF_LOCAL)
         strlcpy(auth_str, "Basic realm=\"CUPS\"", sizeof(auth_str));
       else
 #  endif /* AF_LOCAL */
@@ -2632,7 +2585,7 @@ cupsdSendHeader(
 #endif /* HAVE_GSSAPI */
 
     if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE &&
-        !_cups_strcasecmp(con->http->hostname, "localhost"))
+        !_cups_strcasecmp(httpGetHostname(con->http, NULL, 0), "localhost"))
     {
      /*
       * Add a "trc" (try root certification) parameter for local non-Kerberos
@@ -2760,6 +2713,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
   ipp_state_t  ipp_state;              /* IPP state value */
 
 
+  cupsdLogClient(con, CUPSD_LOG_DEBUG, "con->http=%p", con->http);
   cupsdLogClient(con, CUPSD_LOG_DEBUG,
                 "cupsdWriteClient "
                 "error=%d, "
@@ -2770,8 +2724,8 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
                 "response=%p(%s), "
                 "pipe_pid=%d, "
                 "file=%d",
-                con->http->error, con->http->used,
-                http_states[con->http->state + 1],
+                httpError(con->http), (int)httpGetReady(con->http),
+                httpStateString(httpGetState(con->http)),
                 con->http->data_encoding == HTTP_ENCODING_CHUNKED ?
                     "CHUNKED" : "LENGTH",
                 CUPS_LLCAST con->http->data_remaining,
@@ -2779,8 +2733,8 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
                 con->response ? ipp_states[con->response->state] : "",
                 con->pipe_pid, con->file);
 
-  if (con->http->state != HTTP_STATE_GET_SEND &&
-      con->http->state != HTTP_STATE_POST_SEND)
+  if (httpGetState(con->http) != HTTP_STATE_GET_SEND &&
+      httpGetState(con->http) != HTTP_STATE_POST_SEND)
   {
    /*
     * If we get called in the wrong state, then something went wrong with the
@@ -2788,7 +2742,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
     */
 
     cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP state %s.",
-                  http_states[con->http->state + 1]);
+                  httpStateString(httpGetState(con->http)));
     cupsdCloseClient(con);
     return;
   }
@@ -2816,7 +2770,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
     con->file_ready = 0;
   }
 
-  if (con->response && con->response->state != IPP_DATA)
+  if (con->response && con->response->state != IPP_STATE_DATA)
   {
     int wused = con->http->wused;      /* Previous write buffer use */
 
@@ -2854,7 +2808,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
 
     cupsdLogClient(con, CUPSD_LOG_DEBUG,
                    "bytes=%d, http_state=%d, data_remaining=" CUPS_LLFMT,
-                   (int)bytes, con->http->state,
+                   (int)bytes, httpGetState(con->http),
                    CUPS_LLCAST con->http->data_remaining);
   }
   else if ((bytes = read(con->file, con->header + con->header_used,
@@ -2893,7 +2847,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
 
             if (!_cups_strncasecmp(con->header, "Location:", 9))
            {
-             if (!cupsdSendHeader(con, HTTP_SEE_OTHER, NULL, CUPSD_AUTH_NONE))
+             if (!cupsdSendHeader(con, HTTP_STATUS_SEE_OTHER, NULL, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -2912,7 +2866,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
            }
            else
            {
-             if (!cupsdSendHeader(con, HTTP_OK, NULL, CUPSD_AUTH_NONE))
+             if (!cupsdSendHeader(con, HTTP_STATUS_OK, NULL, CUPSD_AUTH_NONE))
              {
                cupsdCloseClient(con);
                return;
@@ -2920,7 +2874,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
 
              con->sent_header = 1;
 
-             if (con->http->version == HTTP_1_1)
+             if (con->http->version == HTTP_VERSION_1_1)
              {
                if (httpPrintf(con->http, "Transfer-Encoding: chunked\r\n") < 0)
                  return;
@@ -2956,7 +2910,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
              return;
            }
 
-           if (con->http->version == HTTP_1_1)
+           if (con->http->version == HTTP_VERSION_1_1)
              con->http->data_encoding = HTTP_ENCODING_CHUNKED;
           }
          else
@@ -2978,7 +2932,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
       if (httpWrite2(con->http, con->header, con->header_used) < 0)
       {
        cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing for error %d (%s)",
-                      con->http->error, strerror(con->http->error));
+                      httpError(con->http), strerror(httpError(con->http)));
        cupsdCloseClient(con);
        return;
       }
@@ -2988,7 +2942,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
 
       con->bytes += con->header_used;
 
-      if (con->http->state == HTTP_STATE_WAITING)
+      if (httpGetState(con->http) == HTTP_STATE_WAITING)
        bytes = 0;
       else
         bytes = con->header_used;
@@ -2998,14 +2952,14 @@ cupsdWriteClient(cupsd_client_t *con)   /* I - Client connection */
   }
 
   if (bytes <= 0 ||
-      (con->http->state != HTTP_STATE_GET_SEND &&
-       con->http->state != HTTP_STATE_POST_SEND))
+      (httpGetState(con->http) != HTTP_STATE_GET_SEND &&
+       httpGetState(con->http) != HTTP_STATE_POST_SEND))
   {
     if (!con->sent_header && con->pipe_pid)
-      cupsdSendError(con, HTTP_SERVER_ERROR, CUPSD_AUTH_NONE);
+      cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
     else
     {
-      cupsdLogRequest(con, HTTP_OK);
+      cupsdLogRequest(con, HTTP_STATUS_OK);
 
       httpFlushWrite(con->http);
 
@@ -3015,7 +2969,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
        if (httpWrite2(con->http, "", 0) < 0)
        {
          cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing for error %d (%s)",
-                        con->http->error, strerror(con->http->error));
+                        httpError(con->http), strerror(httpError(con->http)));
          cupsdCloseClient(con);
          return;
        }
@@ -3062,7 +3016,7 @@ cupsdWriteClient(cupsd_client_t *con)     /* I - Client connection */
     cupsdClearString(&con->options);
     cupsdClearString(&con->query_string);
 
-    if (!con->http->keep_alive)
+    if (!httpGetKeepAlive(con->http))
     {
       cupsdLogClient(con, CUPSD_LOG_DEBUG,
                     "Closing because Keep-Alive is disabled.");
@@ -3089,14 +3043,14 @@ check_if_modified(
     cupsd_client_t *con,               /* I - Client connection */
     struct stat    *filestats)         /* I - File information */
 {
-  char         *ptr;                   /* Pointer into field */
+  const char   *ptr;                   /* Pointer into field */
   time_t       date;                   /* Time/date value */
   off_t                size;                   /* Size/length value */
 
 
   size = 0;
   date = 0;
-  ptr  = con->http->fields[HTTP_FIELD_IF_MODIFIED_SINCE];
+  ptr  = httpGetField(con->http, HTTP_FIELD_IF_MODIFIED_SINCE);
 
   if (*ptr == '\0')
     return (1);
@@ -3156,37 +3110,6 @@ compare_clients(cupsd_client_t *a,       /* I - First client */
 }
 
 
-/*
- * 'data_ready()' - Check whether data is available from a client.
- */
-
-static int                             /* O - 1 if data is ready, 0 otherwise */
-data_ready(cupsd_client_t *con)                /* I - Client */
-{
-  if (con->http->used > 0)
-    return (1);
-#ifdef HAVE_SSL
-  else if (con->http->tls)
-  {
-#  ifdef HAVE_LIBSSL
-    if (SSL_pending((SSL *)(con->http->tls)))
-      return (1);
-#  elif defined(HAVE_GNUTLS)
-    if (gnutls_record_check_pending(con->http->tls))
-      return (1);
-#  elif defined(HAVE_CDSASSL)
-    size_t bytes;                      /* Bytes that are available */
-
-    if (!SSLGetBufferedReadSize(con->http->tls, &bytes) && bytes > 0)
-      return (1);
-#  endif /* HAVE_LIBSSL */
-  }
-#endif /* HAVE_SSL */
-
-  return (0);
-}
-
-
 /*
  * 'get_file()' - Get a filename and state info.
  */
@@ -3403,7 +3326,7 @@ install_cupsd_conf(cupsd_client_t *con)   /* I - Connection */
   {
     cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to open request file \"%s\": %s",
                     con->filename, strerror(errno));
-    return (HTTP_SERVER_ERROR);
+    return (HTTP_STATUS_SERVER_ERROR);
   }
 
  /*
@@ -3413,7 +3336,7 @@ install_cupsd_conf(cupsd_client_t *con)   /* I - Connection */
   if ((out = cupsdCreateConfFile(ConfigurationFile, ConfigFilePerm)) == NULL)
   {
     cupsFileClose(in);
-    return (HTTP_SERVER_ERROR);
+    return (HTTP_STATUS_SERVER_ERROR);
   }
 
   cupsdLogClient(con, CUPSD_LOG_INFO, "Installing config file \"%s\"...",
@@ -3436,7 +3359,7 @@ install_cupsd_conf(cupsd_client_t *con)   /* I - Connection */
       snprintf(filename, sizeof(filename), "%s.N", ConfigurationFile);
       cupsdUnlinkOrRemoveFile(filename);
 
-      return (HTTP_SERVER_ERROR);
+      return (HTTP_STATUS_SERVER_ERROR);
     }
 
  /*
@@ -3446,7 +3369,7 @@ install_cupsd_conf(cupsd_client_t *con)   /* I - Connection */
   cupsFileClose(in);
 
   if (cupsdCloseCreatedConfFile(out, ConfigurationFile))
-    return (HTTP_SERVER_ERROR);
+    return (HTTP_STATUS_SERVER_ERROR);
 
  /*
   * Remove the request file...
@@ -3466,7 +3389,7 @@ install_cupsd_conf(cupsd_client_t *con)   /* I - Connection */
   * Return that the file was created successfully...
   */
 
-  return (HTTP_CREATED);
+  return (HTTP_STATUS_CREATED);
 }
 
 
@@ -3877,11 +3800,11 @@ pipe_command(cupsd_client_t *con,       /* I - Client connection */
     strlcpy(lang, "LANG=C", sizeof(lang));
 
   strlcpy(remote_addr, "REMOTE_ADDR=", sizeof(remote_addr));
-  httpAddrString(con->http->hostaddr, remote_addr + 12,
+  httpAddrString(httpGetAddress(con->http), remote_addr + 12,
                  sizeof(remote_addr) - 12);
 
   snprintf(remote_host, sizeof(remote_host), "REMOTE_HOST=%s",
-           con->http->hostname);
+           httpGetHostname(con->http, NULL, 0));
 
   snprintf(script_name, sizeof(script_name), "SCRIPT_NAME=%s", con->uri);
   if ((uriptr = strchr(script_name, '?')) != NULL)
@@ -3892,12 +3815,12 @@ pipe_command(cupsd_client_t *con,       /* I - Client connection */
 
   sprintf(server_port, "SERVER_PORT=%d", con->serverport);
 
-  if (con->http->fields[HTTP_FIELD_HOST][0])
+  if (httpGetField(con->http, HTTP_FIELD_HOST)[0])
   {
     char *nameptr;                     /* Pointer to ":port" */
 
     snprintf(server_name, sizeof(server_name), "SERVER_NAME=%s",
-            con->http->fields[HTTP_FIELD_HOST]);
+            httpGetField(con->http, HTTP_FIELD_HOST));
     if ((nameptr = strrchr(server_name, ':')) != NULL && !strchr(nameptr, ']'))
       *nameptr = '\0';                 /* Strip trailing ":port" */
   }
@@ -3930,9 +3853,9 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
     envp[envc ++] = remote_user;
   }
 
-  if (con->http->version == HTTP_1_1)
+  if (con->http->version == HTTP_VERSION_1_1)
     envp[envc ++] = "SERVER_PROTOCOL=HTTP/1.1";
-  else if (con->http->version == HTTP_1_0)
+  else if (con->http->version == HTTP_VERSION_1_0)
     envp[envc ++] = "SERVER_PROTOCOL=HTTP/1.0";
   else
     envp[envc ++] = "SERVER_PROTOCOL=HTTP/0.9";
@@ -3944,17 +3867,17 @@ pipe_command(cupsd_client_t *con,       /* I - Client connection */
     envp[envc ++] = http_cookie;
   }
 
-  if (con->http->fields[HTTP_FIELD_USER_AGENT][0])
+  if (httpGetField(con->http, HTTP_FIELD_USER_AGENT)[0])
   {
     snprintf(http_user_agent, sizeof(http_user_agent), "HTTP_USER_AGENT=%s",
-             con->http->fields[HTTP_FIELD_USER_AGENT]);
+             httpGetField(con->http, HTTP_FIELD_USER_AGENT));
     envp[envc ++] = http_user_agent;
   }
 
-  if (con->http->fields[HTTP_FIELD_REFERER][0])
+  if (httpGetField(con->http, HTTP_FIELD_REFERER)[0])
   {
     snprintf(http_referer, sizeof(http_referer), "HTTP_REFERER=%s",
-             con->http->fields[HTTP_FIELD_REFERER]);
+             httpGetField(con->http, HTTP_FIELD_REFERER));
     envp[envc ++] = http_referer;
   }
 
@@ -3978,7 +3901,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
     sprintf(content_length, "CONTENT_LENGTH=" CUPS_LLFMT,
             CUPS_LLCAST con->bytes);
     snprintf(content_type, sizeof(content_type), "CONTENT_TYPE=%s",
-             con->http->fields[HTTP_FIELD_CONTENT_TYPE]);
+             httpGetField(con->http, HTTP_FIELD_CONTENT_TYPE));
 
     envp[envc ++] = "REQUEST_METHOD=POST";
     envp[envc ++] = content_length;
@@ -4072,7 +3995,7 @@ valid_host(cupsd_client_t *con)           /* I - Client connection */
   * Copy the Host: header for later use...
   */
 
-  strlcpy(con->clientname, con->http->fields[HTTP_FIELD_HOST],
+  strlcpy(con->clientname, httpGetField(con->http, HTTP_FIELD_HOST),
           sizeof(con->clientname));
   if ((ptr = strrchr(con->clientname, ':')) != NULL && !strchr(ptr, ']'))
   {
@@ -4086,7 +4009,7 @@ valid_host(cupsd_client_t *con)           /* I - Client connection */
   * Then validate...
   */
 
-  if (httpAddrLocalhost(con->http->hostaddr))
+  if (httpAddrLocalhost(httpGetAddress(con->http)))
   {
    /*
     * Only allow "localhost" or the equivalent IPv4 or IPv6 numerical
index b604d47a130072c4b6af2d324bd410a10e69d6e6..ade341b92e49b7e216309064b0405db549a517f5 100644 (file)
@@ -1,16 +1,16 @@
 /*
  * "$Id$"
  *
- *   Client definitions for the CUPS scheduler.
+ * Client definitions for the CUPS scheduler.
  *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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/".
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
  */
 
 #ifdef HAVE_AUTHORIZATION_H
index fd1c0c02775103a88b720b2f23fb9066f4ea4665..a12793f7d1f4f90daa51f5d32504066b5d78fe20 100644 (file)
@@ -3035,7 +3035,7 @@ read_cupsd_conf(cups_file_t *fp)  /* I - File to read from */
 #endif /* AF_LOCAL */
        cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv%d)", temp,
                         httpAddrPort(&(lis->address)),
-                       _httpAddrFamily(&(lis->address)) == AF_INET ? 4 : 6);
+                       httpAddrFamily(&(lis->address)) == AF_INET ? 4 : 6);
 
         if (!httpAddrLocalhost(&(lis->address)))
          RemotePort = httpAddrPort(&(lis->address));
index e0340ebe16c1c1ff8961ed29249b9bd0b8b963e9..635ebb268be405e3b3519f290516ca19f4b28f2c 100644 (file)
 /*
  * "$Id$"
  *
- *   IPP routines for the CUPS scheduler.
+ * IPP routines for the CUPS scheduler.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   This file contains Kerberos support code, copyright 2006 by
- *   Jelmer Vernooij.
+ * This file contains Kerberos support code, copyright 2006 by
+ * Jelmer Vernooij.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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/".
- *
- * Contents:
- *
- *   cupsdProcessIPPRequest()    - Process an incoming IPP request.
- *   cupsdTimeoutJob()           - Timeout a job waiting on job files.
- *   accept_jobs()               - Accept print jobs to a printer.
- *   add_class()                 - Add a class to the system.
- *   add_file()                  - Add a file to a job.
- *   add_job()                   - Add a job to a print queue.
- *   add_job_subscriptions()     - Add any subscriptions for a job.
- *   add_job_uuid()              - Add job-uuid attribute to a job.
- *   add_printer()               - Add a printer to the system.
- *   add_printer_state_reasons() - Add the "printer-state-reasons" attribute
- *                                 based upon the printer state...
- *   add_queued_job_count()      - Add the "queued-job-count" attribute for the
- *                                 specified printer or class.
- *   apply_printer_defaults()    - Apply printer default options to a job.
- *   authenticate_job()          - Set job authentication info.
- *   cancel_all_jobs()           - Cancel all or selected print jobs.
- *   cancel_job()                - Cancel a print job.
- *   cancel_subscription()       - Cancel a subscription.
- *   check_rss_recipient()       - Check that we do not have a duplicate RSS
- *                                 feed URI.
- *   check_quotas()              - Check quotas for a printer and user.
- *   close_job()                 - Close a multi-file job.
- *   copy_attrs()                - Copy attributes from one request to another.
- *   copy_banner()               - Copy a banner file to the requests directory
- *                                 for the specified job.
- *   copy_file()                 - Copy a PPD file or interface script...
- *   copy_model()                - Copy a PPD model file, substituting default
- *                                 values as needed...
- *   copy_job_attrs()            - Copy job attributes.
- *   copy_printer_attrs()        - Copy printer attributes.
- *   copy_subscription_attrs()   - Copy subscription attributes.
- *   create_job()                - Print a file to a printer or class.
- *   create_requested_array()    - Create an array for the requested-attributes.
- *   create_subscription()       - Create a notification subscription.
- *   delete_printer()            - Remove a printer or class from the system.
- *   get_default()               - Get the default destination.
- *   get_devices()               - Get the list of available devices on the
- *                                 local system.
- *   get_document()              - Get a copy of a job file.
- *   get_job_attrs()             - Get job attributes.
- *   get_jobs()                  - Get a list of jobs for the specified printer.
- *   get_notifications()         - Get events for a subscription.
- *   get_ppd()                   - Get a named PPD from the local system.
- *   get_ppds()                  - Get the list of PPD files on the local
- *                                 system.
- *   get_printer_attrs()         - Get printer attributes.
- *   get_printer_supported()     - Get printer supported values.
- *   get_printers()              - Get a list of printers or classes.
- *   get_subscription_attrs()    - Get subscription attributes.
- *   get_subscriptions()         - Get subscriptions.
- *   get_username()              - Get the username associated with a request.
- *   hold_job()                  - Hold a print job.
- *   hold_new_jobs()             - Hold pending/new jobs on a printer or class.
- *   move_job()                  - Move a job to a new destination.
- *   ppd_parse_line()            - Parse a PPD default line.
- *   print_job()                 - Print a file to a printer or class.
- *   read_job_ticket()           - Read a job ticket embedded in a print file.
- *   reject_jobs()               - Reject print jobs to a printer.
- *   release_held_new_jobs()     - Release pending/new jobs on a printer or
- *                                 class.
- *   release_job()               - Release a held print job.
- *   renew_subscription()        - Renew an existing subscription...
- *   restart_job()               - Restart an old print job.
- *   save_auth_info()            - Save authentication information for a job.
- *   send_document()             - Send a file to a printer or class.
- *   send_http_error()           - Send a HTTP error back to the IPP client.
- *   send_ipp_status()           - Send a status back to the IPP client.
- *   set_default()               - Set the default destination...
- *   set_job_attrs()             - Set job attributes.
- *   set_printer_attrs()         - Set printer attributes.
- *   set_printer_defaults()      - Set printer default options from a request.
- *   start_printer()             - Start a printer.
- *   stop_printer()              - Stop a printer.
- *   url_encode_attr()           - URL-encode a string attribute.
- *   url_encode_string()         - URL-encode a string.
- *   user_allowed()              - See if a user is allowed to print to a queue.
- *   validate_job()              - Validate printer options and destination.
- *   validate_name()             - Make sure the printer name only contains
- *                                 valid chars.
- *   validate_user()             - Validate the user for the request.
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
  */
 
 /*
@@ -787,7 +704,7 @@ cupsdProcessIPPRequest(
          con->http->_data_remaining = INT_MAX;
       }
 
-      cupsdAddSelect(con->number, (cupsd_selfunc_t)cupsdReadClient,
+      cupsdAddSelect(httpGetFd(con->http), (cupsd_selfunc_t)cupsdReadClient,
                      (cupsd_selfunc_t)cupsdWriteClient, con);
 
      /*
index c78dc30a0b49a02dc5d1c7cf498538da9297323c..9d62498f56d0be271c4fb9be6bf42c11a65fb685 100644 (file)
@@ -64,6 +64,8 @@ cupsdStartTLS(cupsd_client_t *con)    /* I - Client connection */
   cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] Encrypting connection.",
                   con->number);
 
+  con->http->encryption = HTTP_ENCRYPTION_ALWAYS;
+
   con->http->tls_credentials = copy_cdsa_certificate(con);
 
   if (!con->http->tls_credentials)