mirror of
https://github.com/curl/curl.git
synced 2024-12-09 06:30:06 +08:00
hyper: propagate errors back up from read callbacks
Makes test 513 work with hyper Closes #7266
This commit is contained in:
parent
52aa18411c
commit
80e1054fe5
@ -566,8 +566,10 @@ static int uploadpostfields(void *userdata, hyper_context *ctx,
|
|||||||
(size_t)data->req.p.http->postsize);
|
(size_t)data->req.p.http->postsize);
|
||||||
if(copy)
|
if(copy)
|
||||||
*chunk = copy;
|
*chunk = copy;
|
||||||
else
|
else {
|
||||||
|
data->state.hresult = CURLE_OUT_OF_MEMORY;
|
||||||
return HYPER_POLL_ERROR;
|
return HYPER_POLL_ERROR;
|
||||||
|
}
|
||||||
/* increasing the writebytecount here is a little premature but we
|
/* increasing the writebytecount here is a little premature but we
|
||||||
don't know exactly when the body is sent*/
|
don't know exactly when the body is sent*/
|
||||||
data->req.writebytecount += (size_t)data->req.p.http->postsize;
|
data->req.writebytecount += (size_t)data->req.p.http->postsize;
|
||||||
@ -585,8 +587,10 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
|
|||||||
CURLcode result =
|
CURLcode result =
|
||||||
Curl_fillreadbuffer(data, data->set.upload_buffer_size, &fillcount);
|
Curl_fillreadbuffer(data, data->set.upload_buffer_size, &fillcount);
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
if(result)
|
if(result) {
|
||||||
|
data->state.hresult = result;
|
||||||
return HYPER_POLL_ERROR;
|
return HYPER_POLL_ERROR;
|
||||||
|
}
|
||||||
if(!fillcount)
|
if(!fillcount)
|
||||||
/* done! */
|
/* done! */
|
||||||
*chunk = NULL;
|
*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);
|
hyper_buf *copy = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount);
|
||||||
if(copy)
|
if(copy)
|
||||||
*chunk = copy;
|
*chunk = copy;
|
||||||
else
|
else {
|
||||||
|
data->state.hresult = CURLE_OUT_OF_MEMORY;
|
||||||
return HYPER_POLL_ERROR;
|
return HYPER_POLL_ERROR;
|
||||||
|
}
|
||||||
/* increasing the writebytecount here is a little premature but we
|
/* increasing the writebytecount here is a little premature but we
|
||||||
don't know exactly when the body is sent*/
|
don't know exactly when the body is sent*/
|
||||||
data->req.writebytecount += fillcount;
|
data->req.writebytecount += fillcount;
|
||||||
@ -952,6 +958,8 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
|
|||||||
hyper_code code = hyper_error_code(hypererr);
|
hyper_code code = hyper_error_code(hypererr);
|
||||||
failf(data, "Hyper: [%d] %.*s", (int)code, (int)errlen, errbuf);
|
failf(data, "Hyper: [%d] %.*s", (int)code, (int)errlen, errbuf);
|
||||||
hyper_error_free(hypererr);
|
hyper_error_free(hypererr);
|
||||||
|
if(data->state.hresult)
|
||||||
|
return data->state.hresult;
|
||||||
}
|
}
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
357
|
357
|
||||||
358
|
358
|
||||||
359
|
359
|
||||||
513
|
|
||||||
547
|
547
|
||||||
551
|
551
|
||||||
552
|
552
|
||||||
|
@ -34,12 +34,14 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
|||||||
# Verify data after the test has been "shot"
|
# Verify data after the test has been "shot"
|
||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
|
%if !hyper
|
||||||
POST /%TESTNUMBER HTTP/1.1
|
POST /%TESTNUMBER HTTP/1.1
|
||||||
Host: %HOSTIP:%HTTPPORT
|
Host: %HOSTIP:%HTTPPORT
|
||||||
Accept: */*
|
Accept: */*
|
||||||
Content-Length: 1
|
Content-Length: 1
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
%endif
|
||||||
</protocol>
|
</protocol>
|
||||||
# 42 - aborted by callback
|
# 42 - aborted by callback
|
||||||
<errorcode>
|
<errorcode>
|
||||||
|
Loading…
Reference in New Issue
Block a user