]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/getputfile.c
Merge changes from CUPS 1.4svn-r7282.
[thirdparty/cups.git] / cups / getputfile.c
index b39a8339ba2968157c013a372f8633c0f05b9024..e144bd8e6335a7db1c1ca3f6f66171a87a2d7a87 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Get/put file functions for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
 /*
  * 'cupsGetFd()' - Get a file from the server.
  *
- * This function returns HTTP_OK when the file is successfully retrieved.
+ * This function returns @code HTTP_OK@ when the file is successfully retrieved.
  *
  * @since CUPS 1.1.20@
  */
 
 http_status_t                          /* O - HTTP status */
-cupsGetFd(http_t     *http,            /* I - HTTP connection to server */
+cupsGetFd(http_t     *http,            /* I - HTTP connection to server or @code CUPS_HTTP_DEFAULT@ */
          const char *resource,         /* I - Resource name */
          int        fd)                /* I - File descriptor */
 {
@@ -69,7 +69,7 @@ cupsGetFd(http_t     *http,           /* I - HTTP connection to server */
   DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)\n", http,
                 resource, fd));
 
-  if (!http || !resource || fd < 0)
+  if (!resource || fd < 0)
   {
     if (http)
       http->error = EINVAL;
@@ -77,6 +77,9 @@ cupsGetFd(http_t     *http,           /* I - HTTP connection to server */
     return (HTTP_ERROR);
   }
 
+  if (!http)
+    http = _cupsConnect();
+
  /*
   * Then send GET requests to the HTTP server...
   */
@@ -182,13 +185,13 @@ cupsGetFd(http_t     *http,               /* I - HTTP connection to server */
 /*
  * 'cupsGetFile()' - Get a file from the server.
  *
- * This function returns HTTP_OK when the file is successfully retrieved.
+ * This function returns @code HTTP_OK@ when the file is successfully retrieved.
  *
  * @since CUPS 1.1.20@
  */
 
 http_status_t                          /* O - HTTP status */
-cupsGetFile(http_t     *http,          /* I - HTTP connection to server */
+cupsGetFile(http_t     *http,          /* I - HTTP connection to server or @code CUPS_HTTP_DEFAULT@ */
            const char *resource,       /* I - Resource name */
            const char *filename)       /* I - Filename */
 {
@@ -249,13 +252,14 @@ cupsGetFile(http_t     *http,             /* I - HTTP connection to server */
 /*
  * 'cupsPutFd()' - Put a file on the server.
  *
- * This function returns HTTP_CREATED when the file is stored successfully.
+ * This function returns @code HTTP_CREATED@ when the file is stored
+ * successfully.
  *
  * @since CUPS 1.1.20@
  */
 
 http_status_t                          /* O - HTTP status */
-cupsPutFd(http_t     *http,            /* I - HTTP connection to server */
+cupsPutFd(http_t     *http,            /* I - HTTP connection to server or @code CUPS_HTTP_DEFAULT@ */
           const char *resource,                /* I - Resource name */
          int        fd)                /* I - File descriptor */
 {
@@ -272,7 +276,7 @@ cupsPutFd(http_t     *http,         /* I - HTTP connection to server */
   DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)\n", http,
                 resource, fd));
 
-  if (!http || !resource || fd < 0)
+  if (!resource || fd < 0)
   {
     if (http)
       http->error = EINVAL;
@@ -280,6 +284,9 @@ cupsPutFd(http_t     *http,         /* I - HTTP connection to server */
     return (HTTP_ERROR);
   }
 
+  if (!http)
+    http = _cupsConnect();
+
  /*
   * Then send PUT requests to the HTTP server...
   */
@@ -430,13 +437,14 @@ cupsPutFd(http_t     *http,               /* I - HTTP connection to server */
 /*
  * 'cupsPutFile()' - Put a file on the server.
  *
- * This function returns HTTP_CREATED when the file is stored successfully.
+ * This function returns @code HTTP_CREATED@ when the file is stored
+ * successfully.
  *
  * @since CUPS 1.1.20@
  */
 
 http_status_t                          /* O - HTTP status */
-cupsPutFile(http_t     *http,          /* I - HTTP connection to server */
+cupsPutFile(http_t     *http,          /* I - HTTP connection to server or @code CUPS_HTTP_DEFAULT@ */
             const char *resource,      /* I - Resource name */
            const char *filename)       /* I - Filename */
 {