-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hyper: root cause of curl test 565 failure #8896
Comments
Test 565 uses (explicit) Digest authentication. That's a multi-request mechanism and curl will then not issue the full request in the first request but just sends a zero length one to get the auth done, then send the full body in the second request. When hyper is not used, libcurl does not call the callback until it wants to read (and send) actual data. Your research here shows that with hyper enabled, the read callback wrongly gets called already in the first request and then things go wrong. |
Thanks for the explanation! I did some more digging and found this check in libcurl - Lines 2663 to 2670 in 10cd696
I guess there has to be some similar logic in Line 1132 in 10cd696
Removing that line causes failures in other tests, so I added a messy fix - --- a/lib/c-hyper.c
+++ b/lib/c-hyper.c
@@ -671,6 +671,7 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
{
size_t fillcount;
struct Curl_easy *data = (struct Curl_easy *)userdata;
+ struct connectdata *conn = (struct connectdata *)data->conn;
CURLcode result;
(void)ctx;
@@ -685,7 +686,15 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
return HYPER_POLL_PENDING;
}
- result = Curl_fillreadbuffer(data, data->set.upload_buffer_size, &fillcount);
+ if(data->req.upload_chunky && conn->bits.authneg) {
+ fillcount = 0;
+ data->req.upload_chunky = FALSE;
+ result = CURLE_OK;
+ }
+ else {
+ result = Curl_fillreadbuffer(data, data->set.upload_buffer_size,
+ &fillcount);
+ }
if(result) {
data->state.hresult = result;
return HYPER_POLL_ERROR;
@@ -1129,7 +1138,12 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if(result)
goto error;
- data->req.upload_chunky = FALSE;
+ if(data->req.upload_chunky && conn->bits.authneg) {
+ data->req.upload_chunky = TRUE;
+ }
+ else {
+ data->req.upload_chunky = FALSE;
+ }
sendtask = hyper_clientconn_send(client, req);
if(!sendtask) {
failf(data, "hyper_clientconn_send");
Is there a better way to handle this? |
I'm not sure there's a better way, but I think that if this works I think it is better to move ahead with this and enable the test rather than waiting and trying to find a nicer solution. Can you turn this into a PR? |
Yes, I'll open a PR. |
It makes test 565 run fine. Fixes curl#8896 Assisted-by: Daniel Stenberg
I did this
Ran curl test 565, analyzed the debug trace and generated logs, concluded that the first POST request seems to be missing the terminating chunk which has to be inputted during the read callback. This is possibly causing some issues in hyper.
Initial request from
server.input
-Requests after fix -
Patched the
lib510.c
file to allow the test to pass -curl/libcurl version
operating system
The text was updated successfully, but these errors were encountered: