static void proceed_pull(struct st_h2o_http1_conn_t *conn, size_t nfilled) { h2o_iovec_t buf = {conn->_ostr_final.pull.buf, nfilled}; int is_final; if (buf.len < MAX_PULL_BUF_SZ) { h2o_iovec_t cbuf = {buf.base + buf.len, MAX_PULL_BUF_SZ - buf.len}; is_final = h2o_pull(&conn->req, conn->_ostr_final.pull.cb, &cbuf); buf.len += cbuf.len; } else { is_final = 0; } /* write */ h2o_socket_write(conn->sock, &buf, 1, is_final ? on_send_complete : on_send_next_pull); }
static void proceed_pull(struct st_h2o_http1_conn_t *conn, size_t nfilled) { h2o_iovec_t buf = {conn->_ostr_final.pull.buf, nfilled}; h2o_send_state_t send_state; if (buf.len < MAX_PULL_BUF_SZ) { h2o_iovec_t cbuf = {buf.base + buf.len, MAX_PULL_BUF_SZ - buf.len}; send_state = h2o_pull(&conn->req, conn->_ostr_final.pull.cb, &cbuf); if (send_state == H2O_SEND_STATE_ERROR) { conn->req.http1_is_persistent = 0; } buf.len += cbuf.len; } else { send_state = H2O_SEND_STATE_IN_PROGRESS; } /* write */ h2o_socket_write(conn->sock, &buf, 1, h2o_send_state_is_in_progress(send_state) ? on_send_next_pull : on_send_complete); }
static h2o_send_state_t send_data_pull(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream) { size_t max_payload_size; h2o_iovec_t cbuf; h2o_send_state_t send_state = H2O_SEND_STATE_IN_PROGRESS; if ((max_payload_size = calc_max_payload_size(conn, stream)) == 0) goto Exit; /* reserve buffer */ h2o_buffer_reserve(&conn->_write.buf, H2O_HTTP2_FRAME_HEADER_SIZE + max_payload_size); /* obtain content */ cbuf.base = conn->_write.buf->bytes + conn->_write.buf->size + H2O_HTTP2_FRAME_HEADER_SIZE; cbuf.len = max_payload_size; send_state = h2o_pull(&stream->req, stream->_pull_cb, &cbuf); /* write the header */ commit_data_header(conn, stream, &conn->_write.buf, cbuf.len, send_state); Exit: return send_state; }
static int send_data_pull(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream) { size_t max_payload_size; h2o_iovec_t cbuf; int is_final = 0; do { if ((max_payload_size = calc_max_payload_size(conn, stream)) == 0) break; /* reserve buffer */ h2o_buffer_reserve(&conn->_write.buf, H2O_HTTP2_FRAME_HEADER_SIZE + max_payload_size); /* obtain content */ cbuf.base = conn->_write.buf->bytes + conn->_write.buf->size + H2O_HTTP2_FRAME_HEADER_SIZE; cbuf.len = max_payload_size; is_final = h2o_pull(&stream->req, stream->_pull_cb, &cbuf); /* write the header */ encode_data_header_and_consume_window(conn, stream, (void*)(conn->_write.buf->bytes + conn->_write.buf->size), cbuf.len, is_final); /* adjust the write buf size */ conn->_write.buf->size += H2O_HTTP2_FRAME_HEADER_SIZE + cbuf.len; } while (! is_final); return is_final; }