int result;
int rq_retry;
int rlen, pad;
- int auth = 0;
+ int i, auth = 0;
int max_redirects = 10;
if (request_body_type && buf_error(request_body))
if (vpninfo->dump_http_traffic)
dump_buf(vpninfo, '>', buf->data);
- result = vpninfo->ssl_write(vpninfo, buf->data, buf->pos);
- if (rq_retry && result < 0) {
- openconnect_close_https(vpninfo, 0);
- goto retry;
+ for (i = 0; i < buf->pos; i += 16384) {
+ result = vpninfo->ssl_write(vpninfo, buf->data + i, MIN(buf->pos - i, 16384) );
+ if (result < 0) {
+ if (rq_retry) {
+ /* Retry if we failed to send the request on
+ an already-open connection */
+ openconnect_close_https(vpninfo, 0);
+ goto retry;
+ }
+ /* We'll already have complained about whatever offended us */
+ goto out;
+ }
}
- if (result < 0)
- goto out;
result = process_http_response(vpninfo, 0, http_auth_hdrs, buf);
if (result < 0) {
- /* We'll already have complained about whatever offended us */
goto out;
}
if (vpninfo->dump_http_traffic && buf->pos)
#ifndef MAX
#define MAX(x,y) ((x)>(y))?(x):(y)
#endif
+#ifndef MIN
+#define MIN(x,y) ((x)<(y))?(x):(y)
+#endif
/****************************************************************************/
struct pkt {