/*
- * "$Id: getputfile.c 5138 2006-02-21 10:49:06Z mike $"
+ * "$Id: getputfile.c 5147 2006-02-22 16:37:44Z mike $"
*
* Get/put file functions for the Common UNIX Printing System (CUPS).
*
httpClearFields(http);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetField(http, HTTP_FIELD_TRANSFER_ENCODING, "chunked");
+ httpSetExpect(http, HTTP_CONTINUE);
if (httpPut(http, resource))
{
}
/*
- * Copy the file...
+ * Wait up to 1 second for a 100-continue response...
*/
- lseek(fd, 0, SEEK_SET);
+ if (httpWait(http, 1000))
+ status = httpUpdate(http);
+ else
+ status = HTTP_CONTINUE;
- status = HTTP_CONTINUE;
+ if (status == HTTP_CONTINUE)
+ {
+ /*
+ * Copy the file...
+ */
- while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
- if (httpCheck(http))
- {
- if ((status = httpUpdate(http)) != HTTP_CONTINUE)
- break;
- }
- else
- httpWrite2(http, buffer, bytes);
+ lseek(fd, 0, SEEK_SET);
+
+ while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
+ if (httpCheck(http))
+ {
+ if ((status = httpUpdate(http)) != HTTP_CONTINUE)
+ break;
+ }
+ else
+ httpWrite2(http, buffer, bytes);
+ }
if (status == HTTP_CONTINUE)
{
/*
- * End of "$Id: getputfile.c 5138 2006-02-21 10:49:06Z mike $".
+ * End of "$Id: getputfile.c 5147 2006-02-22 16:37:44Z mike $".
*/