diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-06-16 10:52:21 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-06-17 08:19:31 +0200 |
commit | 80e1054fe5179c55104446a979369cdb3aceafc6 (patch) | |
tree | e72039af87d532bda9f477b39939653bc7c32403 /lib/c-hyper.c | |
parent | 52aa18411c69d393e6e594522dd38c3e528e3fcf (diff) | |
download | curl-80e1054fe5179c55104446a979369cdb3aceafc6.tar.gz |
hyper: propagate errors back up from read callbacks
Makes test 513 work with hyper
Closes #7266
Diffstat (limited to 'lib/c-hyper.c')
-rw-r--r-- | lib/c-hyper.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/c-hyper.c b/lib/c-hyper.c index e3fd26c1a..adbd3fe76 100644 --- a/lib/c-hyper.c +++ b/lib/c-hyper.c @@ -566,8 +566,10 @@ static int uploadpostfields(void *userdata, hyper_context *ctx, (size_t)data->req.p.http->postsize); if(copy) *chunk = copy; - else + else { + data->state.hresult = CURLE_OUT_OF_MEMORY; return HYPER_POLL_ERROR; + } /* increasing the writebytecount here is a little premature but we don't know exactly when the body is sent*/ data->req.writebytecount += (size_t)data->req.p.http->postsize; @@ -585,8 +587,10 @@ static int uploadstreamed(void *userdata, hyper_context *ctx, CURLcode result = Curl_fillreadbuffer(data, data->set.upload_buffer_size, &fillcount); (void)ctx; - if(result) + if(result) { + data->state.hresult = result; return HYPER_POLL_ERROR; + } if(!fillcount) /* done! */ *chunk = NULL; @@ -594,8 +598,10 @@ static int uploadstreamed(void *userdata, hyper_context *ctx, hyper_buf *copy = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount); if(copy) *chunk = copy; - else + else { + data->state.hresult = CURLE_OUT_OF_MEMORY; return HYPER_POLL_ERROR; + } /* increasing the writebytecount here is a little premature but we don't know exactly when the body is sent*/ data->req.writebytecount += fillcount; @@ -952,6 +958,8 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done) hyper_code code = hyper_error_code(hypererr); failf(data, "Hyper: [%d] %.*s", (int)code, (int)errlen, errbuf); hyper_error_free(hypererr); + if(data->state.hresult) + return data->state.hresult; } return CURLE_OUT_OF_MEMORY; } |