mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-08 19:18:53 +08:00
Return NGHTTP2_ERR_BUFFER_ERROR from nghttp2_hd_{deflate,inflate}_hd
It is generally useful to know what is the cause of the error. Since we expose HPACK API, it is friendly to tell application the insufficient buffer size is a culprit.
This commit is contained in:
@@ -366,6 +366,10 @@ int nghttp2_frame_pack_headers(nghttp2_bufs *bufs,
|
||||
/* This call will adjust buf->last to the correct position */
|
||||
rv = nghttp2_hd_deflate_hd(deflater, bufs, frame->nva, frame->nvlen);
|
||||
|
||||
if(rv == NGHTTP2_ERR_BUFFER_ERROR) {
|
||||
rv = NGHTTP2_ERR_HEADER_COMP;
|
||||
}
|
||||
|
||||
buf->pos -= nv_offset;
|
||||
|
||||
if(rv != 0) {
|
||||
@@ -593,6 +597,10 @@ int nghttp2_frame_pack_push_promise(nghttp2_bufs *bufs,
|
||||
/* This call will adjust buf->last to the correct position */
|
||||
rv = nghttp2_hd_deflate_hd(deflater, bufs, frame->nva, frame->nvlen);
|
||||
|
||||
if(rv == NGHTTP2_ERR_BUFFER_ERROR) {
|
||||
rv = NGHTTP2_ERR_HEADER_COMP;
|
||||
}
|
||||
|
||||
buf->pos -= nv_offset;
|
||||
|
||||
if(rv != 0) {
|
||||
|
||||
Reference in New Issue
Block a user