Skip to content

HTTP2 streaming post data problem #982

@shihancheng

Description

@shihancheng

I did this

I migrate my http program to http2. The original post function did not work anymore. I found the post content has not been send out at all.

I am using CURLOPT_READFUNCTION,
curl_easy_setopt(hnd, CURLOPT_READFUNCTION, readFunc);
curl_easy_setopt(hnd, CURLOPT_READDATA, readBlock);

But readFunc been only call once even readFunc return positive non-zero value. (the same function work correctly in HTTP1.1 version)
So I dig into the source and found in http2.c, function http2_send():

    nghttp2_session_resume_data(h2, stream->stream_id);
    rv = h2_session_send(conn->data, h2);
    if(nghttp2_is_fatal(rv)) {
      *err = CURLE_SEND_ERROR;
      return -1;
    }
    len -= stream->upload_len;

I think the line:
len -= stream->upload_len;
should be
len = stream->upload_len;

But not sure what the original expected to handle the case if stream->upload_len smaller then len.

I expected the following

send my full post message with content

curl/libcurl version

libcurl 7.50.1

[curl -V output perhaps?]
curl 7.50.1 (x86_64-pc-linux-gnu) libcurl/7.50.1 mbedTLS/2.2.0 zlib/1.2.8 nghttp2/1.13.0

operating system

Linux Ubuntu 14.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions