while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
{
- if (httpCheck(http))
- {
- _httpUpdate(http, &status);
-
- if (status >= HTTP_MULTIPLE_CHOICES)
- break;
- }
-
- if (httpWrite2(http, buffer, bytes) < bytes)
- break;
+ if ((status = cupsWriteRequestData(http, buffer, bytes))
+ != HTTP_CONTINUE)
+ break;
}
}
* Get the server's response...
*/
- if (status == HTTP_CONTINUE || status == HTTP_OK)
+ if (status != HTTP_ERROR)
{
response = cupsGetResponse(http, resource);
- status = http->status;
+ status = httpGetStatus(http);
}
- else
- httpFlush(http);
DEBUG_printf(("2cupsDoIORequest: status=%d", status));
*/
if (status >= HTTP_MULTIPLE_CHOICES)
+ {
+ _cupsSetHTTPError(status);
+
+ do
+ {
+ status = httpUpdate(http);
+ }
+ while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
+
httpFlush(http);
+ }
switch (status)
{
if (status >= HTTP_MULTIPLE_CHOICES)
{
_cupsSetHTTPError(status);
+
+ do
+ {
+ status = httpUpdate(http);
+ }
+ while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
+
httpFlush(http);
}
break;
case HTTP_ERROR :
- _cupsSetError(IPP_INTERNAL_ERROR, httpStatus(status), 0);
+ _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
break;
default :