/*
- * "$Id: request.c 6712 2007-07-24 00:13:05Z mike $"
+ * "$Id: request.c 7460 2008-04-16 02:19:54Z mike $"
*
* IPP utilities for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
*
* Contents:
*
- * cupsDoFileRequest() - Do an IPP request with a file.
- * cupsDoRequest() - Do an IPP request.
- * _cupsSetError() - Set the last IPP status code and status-message.
- * _cupsSetHTTPError() - Set the last error using the HTTP status.
+ * cupsDoFileRequest() - Do an IPP request with a file.
+ * cupsDoIORequest() - Do an IPP request with file descriptors.
+ * cupsDoRequest() - Do an IPP request.
+ * cupsGetResponse() - Get a response to an IPP request.
+ * cupsReadResponseData() - Read additional data after the IPP response.
+ * cupsSendRequest() - Send an IPP request.
+ * cupsWriteRequestData() - Write additional data after an IPP request.
+ * _cupsSetError() - Set the last IPP status code and status-message.
+ * _cupsSetHTTPError() - Set the last error using the HTTP status.
*/
/*
* 'cupsDoFileRequest()' - Do an IPP request with a file.
*
* This function sends the IPP request to the specified server, retrying
- * and authenticating as necessary. The request is freed with ippDelete()
+ * and authenticating as necessary. The request is freed with @link ippDelete@
* after receiving a valid IPP response.
*/
ipp_t * /* O - Response data */
-cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
+cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
ipp_t *request, /* I - IPP request */
const char *resource, /* I - HTTP resource for POST */
- const char *filename) /* I - File to send or NULL for none */
+ const char *filename) /* I - File to send or @code NULL@ for none */
{
ipp_t *response; /* IPP response data */
int infile; /* Input file */
+ DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", "
+ "filename=\"%s\")\n", http, request,
+ request ? ippOpString(request->request.op.operation_id) : "?",
+ resource ? resource : "(null)",
+ filename ? filename : "(null)"));
+
if (filename)
{
if ((infile = open(filename, O_RDONLY | O_BINARY)) < 0)
*/
ipp_t * /* O - Response data */
-cupsDoIORequest(http_t *http, /* I - HTTP connection to server */
+cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
ipp_t *request, /* I - IPP request */
const char *resource, /* I - HTTP resource for POST */
int infile, /* I - File to read from or -1 for none */
int outfile) /* I - File to write to or -1 for none */
{
- ipp_t *response; /* IPP response data */
- size_t length; /* Content-Length value */
+ ipp_t *response = NULL; /* IPP response data */
+ size_t length = 0; /* Content-Length value */
http_status_t status; /* Status of HTTP request */
- int got_status; /* Did we get the status? */
- ipp_state_t state; /* State of IPP processing */
struct stat fileinfo; /* File information */
int bytes; /* Number of bytes read/written */
char buffer[32768]; /* Output buffer */
- http_status_t expect; /* Expect: header to use */
- DEBUG_printf(("cupsDoFileRequest(%p, %p, \'%s\', \'%s\')\n",
- http, request, resource ? resource : "(null)",
- filename ? filename : "(null)"));
+ DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", "
+ "infile=%d, outfile=%d)\n", http, request,
+ request ? ippOpString(request->request.op.operation_id) : "?",
+ resource ? resource : "(null)", infile, outfile));
+
+ /*
+ * Range check input...
+ */
- if (http == NULL || request == NULL || resource == NULL)
+ if (!request || !resource)
{
- if (request != NULL)
- ippDelete(request);
+ ippDelete(request);
- _cupsSetError(IPP_INTERNAL_ERROR, NULL);
+ _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL));
return (NULL);
}
+ /*
+ * Get the default connection as needed...
+ */
+
+ if (!http)
+ if ((http = _cupsConnect()) == NULL)
+ return (NULL);
+
/*
* See if we have a file to send...
*/
* Can't get file information!
*/
- _cupsSetError(errno == ENOENT ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
+ _cupsSetError(errno == EBADF ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
strerror(errno));
ippDelete(request);
return (NULL);
}
+
+#ifndef WIN32
+ if (!S_ISREG(fileinfo.st_mode))
+ length = 0; /* Chunk when piping */
+ else
+#endif /* !WIN32 */
+ length = ippLength(request) + fileinfo.st_size;
+ }
+ else
+ length = ippLength(request);
+
+ /*
+ * Loop until we can send the request without authorization problems.
+ */
+
+ while (response == NULL)
+ {
+ DEBUG_puts("cupsDoFileRequest: setup...");
+
+ /*
+ * Send the request...
+ */
+
+ status = cupsSendRequest(http, request, resource, length);
+
+ DEBUG_printf(("cupsDoFileRequest: status=%d\n", status));
+
+ if (status == HTTP_CONTINUE && request->state == IPP_DATA && infile >= 0)
+ {
+ DEBUG_puts("cupsDoFileRequest: file write...");
+
+ /*
+ * Send the file with the request...
+ */
+
+#ifndef WIN32
+ if (S_ISREG(fileinfo.st_mode))
+#endif /* WIN32 */
+ lseek(infile, 0, SEEK_SET);
+
+ while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
+ {
+ if (httpCheck(http))
+ {
+ if ((status = httpUpdate(http)) != HTTP_CONTINUE)
+ break;
+ }
+
+ if (httpWrite2(http, buffer, bytes) < bytes)
+ break;
+ }
+ }
+
+ /*
+ * Get the server's response...
+ */
+
+ if (status == HTTP_CONTINUE || status == HTTP_OK)
+ {
+ response = cupsGetResponse(http, resource);
+ status = http->status;
+ }
+
+ if (status == HTTP_FORBIDDEN)
+ break;
+
+ if (response)
+ {
+ if (outfile >= 0)
+ {
+ /*
+ * Write trailing data to file...
+ */
+
+ while ((bytes = (int)httpRead2(http, buffer, sizeof(buffer))) > 0)
+ if (write(outfile, buffer, bytes) < bytes)
+ break;
+ }
+ else
+ {
+ /*
+ * Flush any remaining data...
+ */
+
+ httpFlush(http);
+ }
+ }
+ }
+
+ /*
+ * Delete the original request and return the response...
+ */
+
+ ippDelete(request);
+
+ return (response);
+}
+
+
+/*
+ * 'cupsDoRequest()' - Do an IPP request.
+ *
+ * This function sends the IPP request to the specified server, retrying
+ * and authenticating as necessary. The request is freed with ippDelete()
+ * after receiving a valid IPP response.
+ */
+
+ipp_t * /* O - Response data */
+cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ ipp_t *request, /* I - IPP request */
+ const char *resource) /* I - HTTP resource for POST */
+{
+ DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")\n",
+ http, request,
+ request ? ippOpString(request->request.op.operation_id) : "?",
+ resource ? resource : "(null)"));
+
+ return (cupsDoFileRequest(http, request, resource, NULL));
+}
+
+
+/*
+ * 'cupsGetResponse()' - Get a response to an IPP request.
+ *
+ * Use this function to get the response for an IPP request sent using
+ * cupsSendDocument() or cupsSendRequest(). For requests that return
+ * additional data, use httpRead() after getting a successful response.
+ *
+ * @since CUPS 1.4@
+ */
+
+ipp_t * /* O - Response or @code NULL@ on HTTP error */
+cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ const char *resource) /* I - HTTP resource for POST */
+{
+ http_status_t status; /* HTTP status */
+ ipp_state_t state; /* IPP read state */
+ ipp_t *response = NULL; /* IPP response */
+
+
+ DEBUG_printf(("cupsGetReponse(http=%p, resource=\"%s\")\n", http,
+ resource ? resource : "(null)"));
+
+ /*
+ * Connect to the default server as needed...
+ */
+
+ if (!http)
+ http = _cupsConnect();
+
+ if (!http || (http->state != HTTP_POST_RECV && http->state != HTTP_POST_SEND))
+ return (NULL);
+
+ /*
+ * Check for an unfinished chunked request...
+ */
+
+ if (http->data_encoding == HTTP_ENCODE_CHUNKED)
+ {
+ /*
+ * Send a 0-length chunk to finish off the request...
+ */
+
+ DEBUG_puts("cupsGetResponse: Finishing chunked POST...");
+
+ if (httpWrite2(http, "", 0) < 0)
+ return (NULL);
+ }
+
+ /*
+ * Wait for a response from the server...
+ */
+
+ DEBUG_puts("cupsGetResponse: Update loop...");
+
+ while ((status = httpUpdate(http)) == HTTP_CONTINUE)
+ /* Do nothing but update */;
+
+ DEBUG_printf(("cupsGetResponse: status=%d\n", status));
+
+ if (status == HTTP_OK)
+ {
+ /*
+ * Get the IPP response...
+ */
+
+ response = ippNew();
+
+ while ((state = ippRead(http, response)) != IPP_DATA)
+ if (state == IPP_ERROR)
+ break;
+
+ if (state == IPP_ERROR)
+ {
+ /*
+ * Delete the response...
+ */
+
+ DEBUG_puts("cupsGetResponse: IPP read error!");
+
+ ippDelete(response);
+ response = NULL;
+
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno));
+ }
+ }
+ else if (status != HTTP_ERROR)
+ {
+ /*
+ * Flush any error message...
+ */
+
+ httpFlush(http);
+
+ /*
+ * Then handle encryption and authentication...
+ */
+
+ if (status == HTTP_UNAUTHORIZED)
+ {
+ /*
+ * See if we can do authentication...
+ */
+
+ int auth_result;
+
+ DEBUG_puts("cupsGetResponse: Need authorization...");
+
+ if ((auth_result = cupsDoAuthentication(http, "POST", resource)) == 0)
+ httpReconnect(http);
+ else if (auth_result < 0)
+ http->status = status = HTTP_FORBIDDEN;
+ }
+
+#ifdef HAVE_SSL
+ else if (status == HTTP_UPGRADE_REQUIRED)
+ {
+ /*
+ * Force a reconnect with encryption...
+ */
+
+ DEBUG_puts("cupsGetResponse: Need encryption...");
+
+ if (!httpReconnect(http))
+ httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
+ }
+#endif /* HAVE_SSL */
+ }
+
+ if (response)
+ {
+ ipp_attribute_t *attr; /* status-message attribute */
+
+
+ attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
+
+ DEBUG_printf(("cupsGetResponse: status-code=%s, status-message=\"%s\"\n",
+ ippErrorString(response->request.status.status_code),
+ attr ? attr->values[0].string.text : ""));
+
+ _cupsSetError(response->request.status.status_code,
+ attr ? attr->values[0].string.text :
+ ippErrorString(response->request.status.status_code));
+ }
+ else if (status != HTTP_OK)
+ _cupsSetHTTPError(status);
+
+ return (response);
+}
+
+
+/*
+ * 'cupsReadResponseData()' - Read additional data after the IPP response.
+ *
+ * This function is used after cupsGetResponse() to read the PPD or document
+ * files for CUPS_GET_PPD and CUPS_GET_DOCUMENT requests, respectively.
+ *
+ * @since CUPS 1.4@
+ */
+
+ssize_t /* O - Bytes read, 0 on EOF, -1 on error */
+cupsReadResponseData(
+ http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ char *buffer, /* I - Buffer to use */
+ size_t length) /* I - Number of bytes to read */
+{
+ /*
+ * Get the default connection as needed...
+ */
+
+ DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, "
+ "length=" CUPS_LLFMT ")\n", http, buffer, CUPS_LLCAST length));
+
+ if (!http)
+ {
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Pointer to library globals */
+
+ if ((http = cg->http) == NULL)
+ {
+ _cupsSetError(IPP_INTERNAL_ERROR, "No active connection");
+ return (-1);
+ }
}
+ /*
+ * Then read from the HTTP connection...
+ */
+
+ return (httpRead2(http, buffer, length));
+}
+
+
+/*
+ * 'cupsSendRequest()' - Send an IPP request.
+ *
+ * Use httpWrite() to write any additional data (document, PPD file, etc.)
+ * for the request, cupsGetResponse() to get the IPP response, and httpRead()
+ * to read any additional data following the response. Only one request can be
+ * sent/queued at a time.
+ *
+ * Unlike cupsDoFileRequest(), cupsDoIORequest(), and cupsDoRequest(), the
+ * request is not freed.
+ *
+ * @since CUPS 1.4@
+ */
+
+http_status_t /* O - Initial HTTP status */
+cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ ipp_t *request, /* I - IPP request */
+ const char *resource, /* I - Resource path */
+ size_t length) /* I - Length of data to follow or @code CUPS_LENGTH_VARIABLE@ */
+{
+ http_status_t status; /* Status of HTTP request */
+ int got_status; /* Did we get the status? */
+ ipp_state_t state; /* State of IPP processing */
+ http_status_t expect; /* Expect: header to use */
+
+
+ DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", "
+ "length=" CUPS_LLFMT ")\n", http, request,
+ request ? ippOpString(request->request.op.operation_id) : "?",
+ resource ? resource : "(null)", CUPS_LLCAST length));
+
+ /*
+ * Range check input...
+ */
+
+ if (!request || !resource)
+ {
+ _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL));
+
+ return (HTTP_ERROR);
+ }
+
+ /*
+ * Get the default connection as needed...
+ */
+
+ if (!http)
+ if ((http = _cupsConnect()) == NULL)
+ return (HTTP_SERVICE_UNAVAILABLE);
+
#ifdef HAVE_SSL
/*
* See if we have an auth-info attribute and are communicating over
if (ippFindAttribute(request, "auth-info", IPP_TAG_TEXT) &&
!httpAddrLocalhost(http->hostaddr) && !http->tls &&
httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
- return (NULL);
+ return (HTTP_ERROR);
#endif /* HAVE_SSL */
/*
* Loop until we can send the request without authorization problems.
*/
- response = NULL;
- status = HTTP_ERROR;
- expect = HTTP_CONTINUE;
+ status = HTTP_ERROR;
+ expect = HTTP_CONTINUE;
- while (response == NULL)
+ for (;;)
{
- DEBUG_puts("cupsDoFileRequest: setup...");
+ DEBUG_puts("cupsSendRequest: Setup...");
/*
* Setup the HTTP variables needed...
*/
- length = ippLength(request);
- if (infile >= 0)
- {
-#ifndef WIN32
- if (!S_ISREG(fileinfo.st_mode))
- length = 0; /* Chunk when piping */
- else
-#endif /* !WIN32 */
- length += fileinfo.st_size;
- }
-
httpClearFields(http);
httpSetLength(http, length);
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetExpect(http, expect);
- DEBUG_printf(("cupsDoFileRequest: authstring=\"%s\"\n", http->authstring));
+ DEBUG_printf(("cupsSendRequest: authstring=\"%s\"\n", http->authstring));
/*
* Try the request...
*/
- DEBUG_puts("cupsDoFileRequest: post...");
+ DEBUG_puts("cupsSendRequest: Sending HTTP POST...");
if (httpPost(http, resource))
{
if (httpReconnect(http))
- {
- status = HTTP_ERROR;
- break;
- }
+ return (HTTP_ERROR);
else
continue;
}
* Send the IPP data...
*/
- DEBUG_puts("cupsDoFileRequest: ipp write...");
+ DEBUG_puts("cupsSendRequest: Writing IPP request...");
request->state = IPP_IDLE;
status = HTTP_CONTINUE;
break;
}
- if (!got_status)
+ /*
+ * Wait up to 1 second to get the 100-continue response as needed...
+ */
+
+ if (!got_status && expect == HTTP_CONTINUE)
{
- /*
- * Wait up to 1 second to get the 100-continue response...
- */
+ DEBUG_puts("cupsSendRequest: Waiting for 100-continue...");
if (httpWait(http, 1000))
status = httpUpdate(http);
+ else
+ status = HTTP_EXPECTATION_FAILED;
}
else if (httpCheck(http))
status = httpUpdate(http);
- if (status == HTTP_CONTINUE && state == IPP_DATA && infile >= 0)
- {
- DEBUG_puts("cupsDoFileRequest: file write...");
-
- /*
- * Send the file...
- */
-
-#ifndef WIN32
- if (S_ISREG(fileinfo.st_mode))
-#endif /* WIN32 */
- lseek(infile, 0, SEEK_SET);
-
- while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
- {
- if (httpCheck(http))
- {
- if ((status = httpUpdate(http)) != HTTP_CONTINUE)
- break;
- }
-
- if (httpWrite2(http, buffer, bytes) < bytes)
- break;
- }
- }
+ DEBUG_printf(("cupsSendRequest: status=%d\n", status));
/*
- * Get the server's return status...
+ * Process the current HTTP status...
*/
- DEBUG_puts("cupsDoFileRequest: update...");
-
- while (status == HTTP_CONTINUE)
- status = httpUpdate(http);
-
- DEBUG_printf(("cupsDoFileRequest: status = %d\n", status));
-
- if (status == HTTP_UNAUTHORIZED)
+ switch (status)
{
- DEBUG_puts("cupsDoFileRequest: unauthorized...");
-
- /*
- * Flush any error message...
- */
-
- httpFlush(http);
-
- /*
- * See if we can do authentication...
- */
+ case HTTP_ERROR :
+ case HTTP_CONTINUE :
+ case HTTP_OK :
+ return (status);
- if (cupsDoAuthentication(http, "POST", resource))
- break;
+ case HTTP_UNAUTHORIZED :
+ if (!cupsDoAuthentication(http, "POST", resource))
+ if (httpReconnect(http))
+ return (HTTP_ERROR);
- if (httpReconnect(http))
- {
- status = HTTP_ERROR;
- break;
- }
-
- continue;
- }
- else if (status == HTTP_ERROR)
- {
- DEBUG_printf(("cupsDoFileRequest: http->error=%d (%s)\n", http->error,
- strerror(http->error)));
+ return (status);
-#ifdef WIN32
- if (http->error != WSAENETDOWN && http->error != WSAENETUNREACH &&
- http->error != WSAETIMEDOUT)
-#else
- if (http->error != ENETDOWN && http->error != ENETUNREACH &&
- http->error != ETIMEDOUT)
-#endif /* WIN32 */
- continue;
- else
- break;
- }
#ifdef HAVE_SSL
- else if (status == HTTP_UPGRADE_REQUIRED)
- {
- /* Flush any error message... */
- httpFlush(http);
+ case HTTP_UPGRADE_REQUIRED :
+ /*
+ * Flush any error message, reconnect, and then upgrade with
+ * encryption...
+ */
- /* Reconnect... */
- if (httpReconnect(http))
- {
- status = HTTP_ERROR;
- break;
- }
+ if (httpReconnect(http))
+ return (HTTP_ERROR);
- /* Upgrade with encryption... */
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
+ httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
- /* Try again, this time with encryption enabled... */
- continue;
- }
+ return (status);
#endif /* HAVE_SSL */
- else if (status == HTTP_EXPECTATION_FAILED)
- {
- /*
- * Don't try using the Expect: header the next time around...
- */
-
- expect = (http_status_t)0;
- }
- else if (status != HTTP_OK)
- {
- DEBUG_printf(("cupsDoFileRequest: error %d...\n", status));
- /*
- * Flush any error message...
- */
+ case HTTP_EXPECTATION_FAILED :
+ /*
+ * Don't try using the Expect: header the next time around...
+ */
- httpFlush(http);
- break;
- }
- else
- {
- /*
- * Read the response...
- */
-
- DEBUG_puts("cupsDoFileRequest: response...");
-
- response = ippNew();
-
- while ((state = ippRead(http, response)) != IPP_DATA)
- if (state == IPP_ERROR)
+ expect = (http_status_t)0;
break;
- if (state == IPP_ERROR)
- {
- /*
- * Delete the response...
- */
-
- DEBUG_puts("IPP read error!");
- ippDelete(response);
- response = NULL;
-
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno));
+ default :
+ /*
+ * Some other error...
+ */
- break;
- }
- else if (outfile >= 0)
- {
- /*
- * Write trailing data to file...
- */
-
- while ((bytes = (int)httpRead2(http, buffer, sizeof(buffer))) > 0)
- if (write(outfile, buffer, bytes) < bytes)
- break;
- }
- else
- {
- /*
- * Flush any remaining data...
- */
-
- httpFlush(http);
- }
+ return (status);
}
}
+}
+
+
+/*
+ * 'cupsWriteRequestData()' - Write additional data after an IPP request.
+ *
+ * This function is used after @link cupsSendRequest@ to provide a PPD and
+ * after @link cupsStartDocument@ to provide a document file.
+ *
+ * @since CUPS 1.4@
+ */
+http_status_t /* O - @code HTTP_CONTINUE@ if OK or HTTP status on error */
+cupsWriteRequestData(
+ http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
+ const char *buffer, /* I - Bytes to write */
+ size_t length) /* I - Number of bytes to write */
+{
/*
- * Delete the original request and return the response...
+ * Get the default connection as needed...
*/
-
- ippDelete(request);
-
- if (response)
- {
- ipp_attribute_t *attr; /* status-message attribute */
+ DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, "
+ "length=" CUPS_LLFMT ")\n", http, buffer, CUPS_LLCAST length));
- attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
+ if (!http)
+ {
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Pointer to library globals */
- _cupsSetError(response->request.status.status_code,
- attr ? attr->values[0].string.text :
- ippErrorString(response->request.status.status_code));
+ if ((http = cg->http) == NULL)
+ {
+ _cupsSetError(IPP_INTERNAL_ERROR, "No active connection");
+ return (HTTP_ERROR);
+ }
}
- else if (status != HTTP_OK)
- _cupsSetHTTPError(status);
- return (response);
-}
+ /*
+ * Then write to the HTTP connection...
+ */
+ if (httpWrite2(http, buffer, length) < 0)
+ return (HTTP_ERROR);
-/*
- * 'cupsDoRequest()' - Do an IPP request.
- *
- * This function sends the IPP request to the specified server, retrying
- * and authenticating as necessary. The request is freed with ippDelete()
- * after receiving a valid IPP response.
- */
+ /*
+ * Finally, check if we have any pending data from the server...
+ */
-ipp_t * /* O - Response data */
-cupsDoRequest(http_t *http, /* I - HTTP connection to server */
- ipp_t *request, /* I - IPP request */
- const char *resource) /* I - HTTP resource for POST */
-{
- return (cupsDoFileRequest(http, request, resource, NULL));
+ if (httpCheck(http))
+ return (httpUpdate(http));
+ else
+ return (HTTP_CONTINUE);
}
if (message)
cg->last_status_message = strdup(message);
+
+ DEBUG_printf(("_cupsSetError: last_error=%s, last_status_message=\"%s\"\n",
+ ippErrorString(cg->last_error), message ? message : ""));
}
/*
- * End of "$Id: request.c 6712 2007-07-24 00:13:05Z mike $".
+ * End of "$Id: request.c 7460 2008-04-16 02:19:54Z mike $".
*/