Skip to content

Sending data problem when MHD_OPTION_CONNECTION_MEMORY_LIMIT is set to default #72

@IronBug

Description

@IronBug

I use libmicrohttpd_http2 in my program and I found a strange problem with sending data. It was ok with http/1.1 and failed with http/2.
I traced it down and found that this piece of code blocks sending:
src/microhttpd/http2/h2_callbacks.c:722

/* Check if there is enough space to write the DATA frame */
  if ((stream->c.suspended)
      || (left < 9 + length + padlen) /* 9 = frame header */ )
    {
      return NGHTTP2_ERR_WOULDBLOCK;
    }

The length of data block nghttp2 sends is defined by default value but header takes some space and the length checking if condition is always true for data blocks exceeding the default buffer size - 9. So with http/2 data sending hangs up. It works fine for http/1.1. So I think it's the problem of the header.
The possible solution is to set MHD_OPTION_CONNECTION_MEMORY_LIMIT to 9 bytes larger than default. But it shouldn't fall with default values, anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions