maru / libmicrohttpd-http2

HTTP/2 support for libmicrohttpd
https://http2.s106.net/
Other
22 stars 6 forks source link

MHD_create_response_from_callback: reuse of response #73

Open IronBug opened 3 years ago

IronBug commented 3 years ago

Greetings. I use your library in my development and I discovered that with HTTP2 the responses created with MHD_create_response_from_callback were not reusable (session hangs on repeating requests). I debugged the code and created a patch for this case:

index 6a89189e..d536cced 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4317,6 +4317,9 @@ MHD_queue_response (struct MHD_Connection *connection,
     return MHD_NO;
   daemon = connection->daemon;

+  /* Iron Bug: fix for reusing response from callback */
+  response->data_start = 0;
+
   if (daemon->shutdown)
     return MHD_YES; /* If daemon was shut down in parallel,
                      * response will be aborted now or on later stage. */

I don't make a pull request because I generally don't use GitHub and it's a small patch.