From: Stefan Eissing Date: Sat, 7 Nov 2015 11:22:09 +0000 (+0000) Subject: eliminating some compiler warnings on win32/win64, removing frame data size callback... X-Git-Tag: 2.5.0-alpha~2657 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98c605b157d2dd23f299e20cbad03528d51e4bd5;p=thirdparty%2Fapache%2Fhttpd.git eliminating some compiler warnings on win32/win64, removing frame data size callback as it seems to have confused output streaming git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1713106 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_bucket_eoc.c b/modules/http2/h2_bucket_eoc.c index eccc0678053..d46fc97ff0e 100644 --- a/modules/http2/h2_bucket_eoc.c +++ b/modules/http2/h2_bucket_eoc.c @@ -49,6 +49,8 @@ static apr_status_t bucket_cleanup(void *data) static apr_status_t bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block) { + (void)b; + (void)block; *str = NULL; *len = 0; return APR_SUCCESS; diff --git a/modules/http2/h2_bucket_eos.c b/modules/http2/h2_bucket_eos.c index 029cd1034e3..98a0b365c68 100644 --- a/modules/http2/h2_bucket_eos.c +++ b/modules/http2/h2_bucket_eos.c @@ -49,6 +49,8 @@ static apr_status_t bucket_cleanup(void *data) static apr_status_t bucket_read(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block) { + (void)b; + (void)block; *str = NULL; *len = 0; return APR_SUCCESS; diff --git a/modules/http2/h2_conn_io.c b/modules/http2/h2_conn_io.c index 0299343063c..15ddebda44e 100644 --- a/modules/http2/h2_conn_io.c +++ b/modules/http2/h2_conn_io.c @@ -323,14 +323,13 @@ apr_status_t h2_conn_io_writeb(h2_conn_io *io, apr_bucket *b) apr_status_t h2_conn_io_consider_flush(h2_conn_io *io) { apr_status_t status = APR_SUCCESS; - int flush_now = 0; /* The HTTP/1.1 network output buffer/flush behaviour does not * give optimal performance in the HTTP/2 case, as the pattern of * buckets (data/eor/eos) is different. - * As long as we do not have found out the "best" way to deal with + * As long as we have not found out the "best" way to deal with * this, force a flush at least every WRITE_BUFFER_SIZE amount - * of data which seems to work nicely. + * of data. */ if (io->unflushed) { apr_off_t len = 0; @@ -338,12 +337,11 @@ apr_status_t h2_conn_io_consider_flush(h2_conn_io *io) apr_brigade_length(io->output, 0, &len); } len += io->buflen; - flush_now = (len >= WRITE_BUFFER_SIZE); + if (len >= WRITE_BUFFER_SIZE) { + return h2_conn_io_flush(io); + } } - if (flush_now) { - return h2_conn_io_flush(io); - } return status; } @@ -370,6 +368,8 @@ apr_status_t h2_conn_io_flush(h2_conn_io *io) return status; } + ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, io->connection, + "h2_conn_io: flushed"); io->unflushed = 0; } return APR_SUCCESS; diff --git a/modules/http2/h2_conn_io.h b/modules/http2/h2_conn_io.h index c5a861605c6..a0cb3977844 100644 --- a/modules/http2/h2_conn_io.h +++ b/modules/http2/h2_conn_io.h @@ -31,7 +31,7 @@ typedef struct { apr_time_t cooldown_usecs; apr_int64_t warmup_size; - int write_size; + apr_size_t write_size; apr_time_t last_write; apr_int64_t bytes_written; diff --git a/modules/http2/h2_from_h1.c b/modules/http2/h2_from_h1.c index c763ca56ea2..ed7fff4a27d 100644 --- a/modules/http2/h2_from_h1.c +++ b/modules/http2/h2_from_h1.c @@ -417,7 +417,7 @@ static h2_response *create_response(h2_from_h1 *from_h1, request_rec *r) } if (!apr_is_empty_array(r->content_languages)) { - int i; + unsigned int i; char *token; char **languages = (char **)(r->content_languages->elts); const char *field = apr_table_get(r->headers_out, "Content-Language"); diff --git a/modules/http2/h2_from_h1.h b/modules/http2/h2_from_h1.h index 115a3142668..9a0eba0ceca 100644 --- a/modules/http2/h2_from_h1.h +++ b/modules/http2/h2_from_h1.h @@ -48,7 +48,7 @@ struct h2_from_h1 { apr_pool_t *pool; apr_bucket_brigade *bb; - apr_size_t content_length; + apr_off_t content_length; int chunked; const char *status; diff --git a/modules/http2/h2_h2.c b/modules/http2/h2_h2.c index 64ac321db19..69061167d8b 100644 --- a/modules/http2/h2_h2.c +++ b/modules/http2/h2_h2.c @@ -85,10 +85,9 @@ static const char *h2_err_descr[] = { "http/1.1 required", }; -const char *h2_h2_err_description(int h2_error) +const char *h2_h2_err_description(unsigned int h2_error) { - if (h2_error >= 0 - && h2_error < (sizeof(h2_err_descr)/sizeof(h2_err_descr[0]))) { + if (h2_error < (sizeof(h2_err_descr)/sizeof(h2_err_descr[0]))) { return h2_err_descr[h2_error]; } return "unknown http/2 errotr code"; @@ -415,7 +414,7 @@ static void cipher_init(apr_pool_t *pool) { apr_hash_t *hash = apr_hash_make(pool); const char *source; - int i; + unsigned int i; source = "rfc7540"; for (i = 0; i < RFC7540_names_LEN; ++i) { @@ -487,7 +486,7 @@ int h2_is_acceptable_connection(conn_rec *c, int require_all) /* Need Tlsv1.2 or higher, rfc 7540, ch. 9.2 */ - val = opt_ssl_var_lookup(pool, s, c, NULL, "SSL_PROTOCOL"); + val = opt_ssl_var_lookup(pool, s, c, NULL, (char*)"SSL_PROTOCOL"); if (val && *val) { if (strncmp("TLS", val, 3) || !strcmp("TLSv1", val) @@ -506,7 +505,7 @@ int h2_is_acceptable_connection(conn_rec *c, int require_all) /* Check TLS cipher blacklist */ - val = opt_ssl_var_lookup(pool, s, c, NULL, "SSL_CIPHER"); + val = opt_ssl_var_lookup(pool, s, c, NULL, (char*)"SSL_CIPHER"); if (val && *val) { const char *source; if (cipher_is_blacklisted(val, &source)) { diff --git a/modules/http2/h2_h2.h b/modules/http2/h2_h2.h index 4cf2785929d..112fce9a225 100644 --- a/modules/http2/h2_h2.h +++ b/modules/http2/h2_h2.h @@ -57,7 +57,7 @@ extern const char *H2_MAGIC_TOKEN; * @param h2_error http/2 error code, as in rfc 7540, ch. 7 * @return textual description of code or that it is unknown. */ -const char *h2_h2_err_description(int h2_error); +const char *h2_h2_err_description(unsigned int h2_error); /* * One time, post config intialization. diff --git a/modules/http2/h2_io.c b/modules/http2/h2_io.c index e952ad0f6b4..9aed64ee956 100644 --- a/modules/http2/h2_io.c +++ b/modules/http2/h2_io.c @@ -78,7 +78,7 @@ int h2_io_out_has_data(h2_io *io) return h2_util_bb_has_data_or_eos(io->bbout); } -apr_size_t h2_io_out_length(h2_io *io) +apr_off_t h2_io_out_length(h2_io *io) { if (io->bbout) { apr_off_t len = 0; @@ -154,7 +154,7 @@ apr_status_t h2_io_in_close(h2_io *io) apr_status_t h2_io_out_readx(h2_io *io, h2_io_data_cb *cb, void *ctx, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status; @@ -183,7 +183,7 @@ apr_status_t h2_io_out_readx(h2_io *io, } apr_status_t h2_io_out_read_to(h2_io *io, apr_bucket_brigade *bb, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { if (io->rst_error) { return APR_ECONNABORTED; diff --git a/modules/http2/h2_io.h b/modules/http2/h2_io.h index d8769dd1182..2cfa2980e54 100644 --- a/modules/http2/h2_io.h +++ b/modules/http2/h2_io.h @@ -21,7 +21,7 @@ struct apr_thread_cond_t; struct h2_task; -typedef apr_status_t h2_io_data_cb(void *ctx, const char *data, apr_size_t len); +typedef apr_status_t h2_io_data_cb(void *ctx, const char *data, apr_off_t len); typedef int h2_stream_pri_cmp(int stream_id1, int stream_id2, void *ctx); @@ -121,11 +121,11 @@ apr_status_t h2_io_in_close(h2_io *io); */ apr_status_t h2_io_out_readx(h2_io *io, h2_io_data_cb *cb, void *ctx, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); apr_status_t h2_io_out_read_to(h2_io *io, apr_bucket_brigade *bb, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); apr_status_t h2_io_out_write(h2_io *io, apr_bucket_brigade *bb, apr_size_t maxlen, int *pfile_buckets_allowed); @@ -140,7 +140,7 @@ apr_status_t h2_io_out_close(h2_io *io); * Gives the overall length of the data that is currently queued for * output. */ -apr_size_t h2_io_out_length(h2_io *io); +apr_off_t h2_io_out_length(h2_io *io); #endif /* defined(__mod_h2__h2_io__) */ diff --git a/modules/http2/h2_mplx.c b/modules/http2/h2_mplx.c index ad6bd30e32d..11cfd5c8082 100644 --- a/modules/http2/h2_mplx.c +++ b/modules/http2/h2_mplx.c @@ -431,7 +431,7 @@ apr_status_t h2_mplx_in_update_windows(h2_mplx *m, apr_status_t h2_mplx_out_readx(h2_mplx *m, int stream_id, h2_io_data_cb *cb, void *ctx, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status; AP_DEBUG_ASSERT(m); @@ -461,7 +461,7 @@ apr_status_t h2_mplx_out_readx(h2_mplx *m, int stream_id, apr_status_t h2_mplx_out_read_to(h2_mplx *m, int stream_id, apr_bucket_brigade *bb, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status; AP_DEBUG_ASSERT(m); diff --git a/modules/http2/h2_mplx.h b/modules/http2/h2_mplx.h index 2bb650535ef..e8ba965fa7a 100644 --- a/modules/http2/h2_mplx.h +++ b/modules/http2/h2_mplx.h @@ -208,7 +208,7 @@ int h2_mplx_in_has_eos_for(h2_mplx *m, int stream_id); * Callback invoked for every stream that had input data read since * the last invocation. */ -typedef void h2_mplx_consumed_cb(void *ctx, int stream_id, apr_size_t consumed); +typedef void h2_mplx_consumed_cb(void *ctx, int stream_id, apr_off_t consumed); /** * Invoke the callback for all streams that had bytes read since the last @@ -239,7 +239,7 @@ struct h2_stream *h2_mplx_next_submit(h2_mplx *m, */ apr_status_t h2_mplx_out_readx(h2_mplx *mplx, int stream_id, h2_io_data_cb *cb, void *ctx, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); /** * Reads output data into the given brigade. Will never block, but @@ -247,7 +247,7 @@ apr_status_t h2_mplx_out_readx(h2_mplx *mplx, int stream_id, */ apr_status_t h2_mplx_out_read_to(h2_mplx *mplx, int stream_id, apr_bucket_brigade *bb, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); /** * Opens the output for the given stream with the specified response. diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index d656499c5db..e54b9444381 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -86,6 +86,12 @@ static int stream_open(h2_session *session, int stream_id) return 0; } +static apr_status_t h2_session_flush(h2_session *session) +{ + session->flush = 0; + return h2_conn_io_flush(&session->io); +} + /** * Determine the importance of streams when scheduling tasks. * - if both stream depend on the same one, compare weights @@ -246,9 +252,7 @@ static int before_frame_send_cb(nghttp2_session *ngh2, * following frame types */ switch (frame->hd.type) { case NGHTTP2_RST_STREAM: - case NGHTTP2_WINDOW_UPDATE: case NGHTTP2_PUSH_PROMISE: - case NGHTTP2_PING: case NGHTTP2_GOAWAY: session->flush = 1; break; @@ -472,6 +476,14 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, frame->priority.pri_spec.exclusive); break; } + case NGHTTP2_WINDOW_UPDATE: { + ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c, + "h2_session: stream(%ld-%d): WINDOW_UPDATE " + "incr=%d", + session->id, (int)frame->hd.stream_id, + frame->window_update.window_size_increment); + break; + } default: if (APLOGctrace2(session->c)) { char buffer[256]; @@ -517,7 +529,7 @@ static int on_frame_recv_cb(nghttp2_session *ng2s, } static apr_status_t pass_data(void *ctx, - const char *data, apr_size_t length) + const char *data, apr_off_t length) { return h2_conn_io_write(&((h2_session*)ctx)->io, data, length); } @@ -535,7 +547,7 @@ static int on_send_data_cb(nghttp2_session *ngh2, apr_status_t status = APR_SUCCESS; h2_session *session = (h2_session *)userp; int stream_id = (int)frame->hd.stream_id; - const unsigned char padlen = frame->data.padlen; + unsigned char padlen; int eos; h2_stream *stream; @@ -545,6 +557,11 @@ static int on_send_data_cb(nghttp2_session *ngh2, return NGHTTP2_ERR_CALLBACK_FAILURE; } + if (frame->data.padlen > H2_MAX_PADLEN) { + return NGHTTP2_ERR_PROTO; + } + padlen = (unsigned char)frame->data.padlen; + stream = h2_session_get_stream(session, stream_id); if (!stream) { ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_NOTFOUND, session->c, @@ -566,9 +583,8 @@ static int on_send_data_cb(nghttp2_session *ngh2, } if (status == APR_SUCCESS) { - apr_size_t len = length; - status = h2_stream_readx(stream, pass_data, session, - &len, &eos); + apr_off_t len = length; + status = h2_stream_readx(stream, pass_data, session, &len, &eos); if (status == APR_SUCCESS && len != length) { status = APR_EINVAL; } @@ -593,7 +609,7 @@ static int on_send_data_cb(nghttp2_session *ngh2, status = h2_conn_io_writeb(&session->io, b); if (status == APR_SUCCESS) { - apr_size_t len = length; + apr_off_t len = length; status = h2_stream_read_to(stream, session->io.output, &len, &eos); session->io.unflushed = 1; if (status == APR_SUCCESS && len != length) { @@ -624,20 +640,6 @@ static int on_send_data_cb(nghttp2_session *ngh2, return h2_session_status_from_apr_status(status); } -static ssize_t on_data_source_read_length_cb(nghttp2_session *session, - uint8_t frame_type, int32_t stream_id, - int32_t session_remote_window_size, - int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, - void *user_data) -{ - /* DATA frames add 9 bytes header plus 1 byte for padlen and additional - * padlen bytes. Keep below TLS maximum record size. - * TODO: respect pad bytes when we have that feature. - */ - return (16*1024 - 10); -} - #define NGH2_SET_CALLBACK(callbacks, name, fn)\ nghttp2_session_callbacks_set_##name##_callback(callbacks, fn) @@ -662,7 +664,6 @@ static apr_status_t init_callbacks(conn_rec *c, nghttp2_session_callbacks **pcb) NGH2_SET_CALLBACK(*pcb, on_begin_headers, on_begin_headers_cb); NGH2_SET_CALLBACK(*pcb, on_header, on_header_cb); NGH2_SET_CALLBACK(*pcb, send_data, on_send_data_cb); - NGH2_SET_CALLBACK(*pcb, data_source_read_length, on_data_source_read_length_cb); return APR_SUCCESS; } @@ -823,7 +824,7 @@ static apr_status_t h2_session_abort_int(h2_session *session, int reason) strlen(err)); nghttp2_session_send(session->ngh2); } - h2_conn_io_flush(&session->io); + h2_session_flush(session); } h2_mplx_abort(session->mplx); } @@ -1002,20 +1003,15 @@ static int h2_session_resume_streams_with_data(h2_session *session) { return 0; } -static void update_window(void *ctx, int stream_id, apr_size_t bytes_read) +static void update_window(void *ctx, int stream_id, apr_off_t bytes_read) { h2_session *session = (h2_session*)ctx; nghttp2_session_consume(session->ngh2, stream_id, bytes_read); } -static apr_status_t h2_session_flush(h2_session *session) -{ - session->flush = 0; - return h2_conn_io_flush(&session->io); -} - static apr_status_t h2_session_update_windows(h2_session *session) { + /* TODO: only do this, when we have streams with open input */ return h2_mplx_in_update_windows(session->mplx, update_window, session); } @@ -1052,6 +1048,7 @@ apr_status_t h2_session_write(h2_session *session, apr_interval_time_t timeout) } /* If we have responses ready, submit them now. */ + /* TODO: only call this when we have unsubmitted streams */ while (!session->aborted && (stream = h2_mplx_next_submit(session->mplx, session->streams)) != NULL) { status = h2_session_handle_response(session, stream); @@ -1152,7 +1149,7 @@ apr_status_t h2_session_close(h2_session *session) h2_conn_io_writeb(&session->io, h2_bucket_eoc_create(session->c->bucket_alloc, session)); - return h2_conn_io_flush(&session->io); + return h2_session_flush(session); } static ssize_t stream_data_cb(nghttp2_session *ng2s, @@ -1164,7 +1161,7 @@ static ssize_t stream_data_cb(nghttp2_session *ng2s, void *puser) { h2_session *session = (h2_session *)puser; - apr_size_t nread = length; + apr_off_t nread = length; int eos = 0; apr_status_t status; h2_stream *stream; diff --git a/modules/http2/h2_stream.c b/modules/http2/h2_stream.c index 5a5af6372b7..8a55962feaa 100644 --- a/modules/http2/h2_stream.c +++ b/modules/http2/h2_stream.c @@ -116,7 +116,7 @@ apr_status_t h2_stream_set_response(h2_stream *stream, h2_response *response, "h2_stream_set_response"); } if (APLOGctrace1(stream->session->c)) { - apr_size_t len = 0; + apr_off_t len = 0; int eos = 0; h2_util_bb_avail(stream->bbout, &len, &eos); ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, stream->session->c, @@ -236,7 +236,7 @@ apr_status_t h2_stream_write_data(h2_stream *stream, } apr_status_t h2_stream_prep_read(h2_stream *stream, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status = APR_SUCCESS; const char *src; @@ -269,7 +269,7 @@ apr_status_t h2_stream_prep_read(h2_stream *stream, apr_status_t h2_stream_readx(h2_stream *stream, h2_io_data_cb *cb, void *ctx, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status = APR_SUCCESS; const char *src; @@ -279,7 +279,7 @@ apr_status_t h2_stream_readx(h2_stream *stream, } *peos = 0; if (!APR_BRIGADE_EMPTY(stream->bbout)) { - apr_size_t origlen = *plen; + apr_off_t origlen = *plen; src = "stream"; status = h2_util_bb_readx(stream->bbout, cb, ctx, plen, peos); @@ -306,7 +306,7 @@ apr_status_t h2_stream_readx(h2_stream *stream, } apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status = APR_SUCCESS; @@ -315,7 +315,7 @@ apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb, } if (APR_BRIGADE_EMPTY(stream->bbout)) { - apr_size_t tlen = *plen; + apr_off_t tlen = *plen; int eos; status = h2_mplx_out_read_to(stream->session->mplx, stream->id, stream->bbout, &tlen, &eos); @@ -343,6 +343,9 @@ void h2_stream_set_suspended(h2_stream *stream, int suspended) { AP_DEBUG_ASSERT(stream); stream->suspended = !!suspended; + ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c, + "h2_stream(%ld-%d): suspended=%d", + stream->session->id, stream->id, stream->suspended); } int h2_stream_is_suspended(h2_stream *stream) diff --git a/modules/http2/h2_stream.h b/modules/http2/h2_stream.h index d09d848a66a..d8847344ff1 100644 --- a/modules/http2/h2_stream.h +++ b/modules/http2/h2_stream.h @@ -68,7 +68,7 @@ struct h2_stream { struct h2_response *response; /* the response, once ready */ apr_bucket_brigade *bbout; /* output DATA */ - apr_size_t data_frames_sent;/* # of DATA frames sent out for this stream */ + apr_off_t data_frames_sent; /* # of DATA frames sent out for this stream */ }; @@ -103,13 +103,13 @@ apr_status_t h2_stream_set_response(h2_stream *stream, apr_bucket_brigade *bb); apr_status_t h2_stream_prep_read(h2_stream *stream, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); apr_status_t h2_stream_readx(h2_stream *stream, h2_io_data_cb *cb, - void *ctx, apr_size_t *plen, int *peos); + void *ctx, apr_off_t *plen, int *peos); apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); void h2_stream_set_suspended(h2_stream *stream, int suspended); diff --git a/modules/http2/h2_util.c b/modules/http2/h2_util.c index e83ed4ee669..7b12a3f3d75 100644 --- a/modules/http2/h2_util.c +++ b/modules/http2/h2_util.c @@ -215,7 +215,7 @@ static const int DEEP_COPY = 1; static const int FILE_MOVE = 1; static apr_status_t last_not_included(apr_bucket_brigade *bb, - apr_size_t maxlen, + apr_off_t maxlen, int same_alloc, int *pfile_buckets_allowed, apr_bucket **pend) @@ -275,7 +275,7 @@ static apr_status_t last_not_included(apr_bucket_brigade *bb, #define LOG_LEVEL APLOG_INFO apr_status_t h2_util_move(apr_bucket_brigade *to, apr_bucket_brigade *from, - apr_size_t maxlen, int *pfile_handles_allowed, + apr_off_t maxlen, int *pfile_handles_allowed, const char *msg) { apr_status_t status = APR_SUCCESS; @@ -407,7 +407,7 @@ apr_status_t h2_util_move(apr_bucket_brigade *to, apr_bucket_brigade *from, } apr_status_t h2_util_copy(apr_bucket_brigade *to, apr_bucket_brigade *from, - apr_size_t maxlen, const char *msg) + apr_off_t maxlen, const char *msg) { apr_status_t status = APR_SUCCESS; int same_alloc; @@ -483,7 +483,7 @@ int h2_util_has_flush_or_eos(apr_bucket_brigade *bb) { return 0; } -int h2_util_has_eos(apr_bucket_brigade *bb, apr_size_t len) +int h2_util_has_eos(apr_bucket_brigade *bb, apr_off_t len) { apr_bucket *b, *end; @@ -537,7 +537,7 @@ int h2_util_bb_has_data_or_eos(apr_bucket_brigade *bb) } apr_status_t h2_util_bb_avail(apr_bucket_brigade *bb, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status; apr_off_t blen = 0; @@ -574,12 +574,12 @@ apr_status_t h2_util_bb_avail(apr_bucket_brigade *bb, apr_status_t h2_util_bb_readx(apr_bucket_brigade *bb, h2_util_pass_cb *cb, void *ctx, - apr_size_t *plen, int *peos) + apr_off_t *plen, int *peos) { apr_status_t status = APR_SUCCESS; int consume = (cb != NULL); - apr_size_t written = 0; - apr_size_t avail = *plen; + apr_off_t written = 0; + apr_off_t avail = *plen; apr_bucket *next, *b; /* Pass data in our brigade through the callback until the length @@ -607,8 +607,7 @@ apr_status_t h2_util_bb_readx(apr_bucket_brigade *bb, if (b->length == ((apr_size_t)-1)) { /* read to determine length */ - status = apr_bucket_read(b, &data, &data_len, - APR_NONBLOCK_READ); + status = apr_bucket_read(b, &data, &data_len, APR_NONBLOCK_READ); } else { data_len = b->length; @@ -722,11 +721,11 @@ void h2_util_bb_log(conn_rec *c, int stream_id, int level, apr_status_t h2_transfer_brigade(apr_bucket_brigade *to, apr_bucket_brigade *from, apr_pool_t *p, - apr_size_t *plen, + apr_off_t *plen, int *peos) { apr_bucket *e; - apr_size_t len = 0, remain = *plen; + apr_off_t len = 0, remain = *plen; apr_status_t rv; *peos = 0; diff --git a/modules/http2/h2_util.h b/modules/http2/h2_util.h index 0612af6ba32..a859335f0c0 100644 --- a/modules/http2/h2_util.h +++ b/modules/http2/h2_util.h @@ -73,13 +73,13 @@ apr_size_t h2_util_base64url_decode(const char **decoded, * if needed. * @param to the brigade to move the data to * @param from the brigade to get the data from - * @param maxlen of bytes to move, 0 for all + * @param maxlen of bytes to move, <= 0 for all * @param pfile_buckets_allowed how many file buckets may be moved, * may be 0 or NULL * @param msg message for use in logging */ apr_status_t h2_util_move(apr_bucket_brigade *to, apr_bucket_brigade *from, - apr_size_t maxlen, int *pfile_buckets_allowed, + apr_off_t maxlen, int *pfile_buckets_allowed, const char *msg); /** @@ -88,11 +88,11 @@ apr_status_t h2_util_move(apr_bucket_brigade *to, apr_bucket_brigade *from, * if needed. * @param to the brigade to copy the data to * @param from the brigade to get the data from - * @param maxlen of bytes to copy, 0 for all + * @param maxlen of bytes to copy, <= 0 for all * @param msg message for use in logging */ apr_status_t h2_util_copy(apr_bucket_brigade *to, apr_bucket_brigade *from, - apr_size_t maxlen, const char *msg); + apr_off_t maxlen, const char *msg); /** * Return != 0 iff there is a FLUSH or EOS bucket in the brigade. @@ -100,7 +100,7 @@ apr_status_t h2_util_copy(apr_bucket_brigade *to, apr_bucket_brigade *from, * @return != 0 iff brigade holds FLUSH or EOS bucket (or both) */ int h2_util_has_flush_or_eos(apr_bucket_brigade *bb); -int h2_util_has_eos(apr_bucket_brigade *bb, apr_size_t len); +int h2_util_has_eos(apr_bucket_brigade *bb, apr_off_t len); int h2_util_bb_has_data(apr_bucket_brigade *bb); int h2_util_bb_has_data_or_eos(apr_bucket_brigade *bb); @@ -112,10 +112,10 @@ int h2_util_bb_has_data_or_eos(apr_bucket_brigade *bb); * @param on return, if eos has been reached */ apr_status_t h2_util_bb_avail(apr_bucket_brigade *bb, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); typedef apr_status_t h2_util_pass_cb(void *ctx, - const char *data, apr_size_t len); + const char *data, apr_off_t len); /** * Read at most *plen bytes from the brigade and pass them into the @@ -131,7 +131,7 @@ typedef apr_status_t h2_util_pass_cb(void *ctx, */ apr_status_t h2_util_bb_readx(apr_bucket_brigade *bb, h2_util_pass_cb *cb, void *ctx, - apr_size_t *plen, int *peos); + apr_off_t *plen, int *peos); /** * Logs the bucket brigade (which bucket types with what length) @@ -157,7 +157,7 @@ void h2_util_bb_log(conn_rec *c, int stream_id, int level, apr_status_t h2_transfer_brigade(apr_bucket_brigade *to, apr_bucket_brigade *from, apr_pool_t *p, - apr_size_t *plen, + apr_off_t *plen, int *peos); #endif /* defined(__mod_h2__h2_util__) */