| 704 | */ |
| 705 | |
| 706 | int /* O - Bytes written or -1 on error */ |
| 707 | httpFlushWrite(http_t *http) /* I - HTTP connection */ |
| 708 | { |
| 709 | ssize_t bytes; /* Bytes written */ |
| 710 | |
| 711 | |
| 712 | DEBUG_printf(("httpFlushWrite(http=%p) data_encoding=%d", (void *)http, http ? http->data_encoding : 100)); |
| 713 | |
| 714 | if (!http || !http->wused) |
| 715 | { |
| 716 | DEBUG_puts(http ? "1httpFlushWrite: Write buffer is empty." : |
| 717 | "1httpFlushWrite: No connection."); |
| 718 | return (0); |
| 719 | } |
| 720 | |
| 721 | if (http->data_encoding == HTTP_ENCODING_CHUNKED) |
| 722 | bytes = http_write_chunk(http, http->wbuffer, (size_t)http->wused); |
| 723 | else |
| 724 | bytes = http_write(http, http->wbuffer, (size_t)http->wused); |
| 725 | |
| 726 | http->wused = 0; |
| 727 | |
| 728 | DEBUG_printf(("1httpFlushWrite: Returning %d, errno=%d.", (int)bytes, errno)); |
| 729 | |
| 730 | return ((int)bytes); |
| 731 | } |
| 732 | |
| 733 | |
| 734 | /* |
no test coverage detected