libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] MHD cannot write the entire chunked deflate data (deflat


From: silvioprog
Subject: [libmicrohttpd] MHD cannot write the entire chunked deflate data (deflate/chunked)
Date: Sat, 9 Feb 2019 01:06:03 -0300

Hello everyone,

I've tried to compress a chunked data using ZLib & MHD, but the connection is closed while the data are transferred. Using the curl tool as client, it reports "curl: (23) Failed writing data" when we try to get a large file (about 100 kB). The attached MHD example uses the files "README" and "ChangeLog", available in the MHD sources, but it fails to send the "ChangeLog" file, because it is about 100 kB.

It is easy to reproduce the problem. Just download the attached file, and:

$ gcc -o httpsrv  main.c -lmicrohttpd -lz
$ ./httpsrv

Now, open another tab on your terminal, and:

$ curl -v --compressed http://localhost:8080

You will get something like:

[snip]
...
Tue Jul 23 11:32:00 MSK 2017
Updated chunked_example.c to provide real illustration of usage of
chunked encoding. -EG

Thu Jul 13 21:41:00 MSK 2017
Restored SIGPIPE suppression in TLS mode.
* Failed writing data
* stopped the pause stream!
* Closing connection 0
curl: (23) Failed writing data
Added new value MHD_FEATURE_AUTOSUPPRESS

Lastly, comment the line 56 (file = fopen(MHD_DIR "ChangeLog", "rb");) and uncomment the 57 (/*file = fopen(MHD_DIR "README", "rb");*/), rebuild the test and use curl again, you will get the the entire content of the README file.

I've used the latest MHD from trunk (default build, by "./configure && make install-strip"), and the ZLib version is 1.2.11. I'm on Xubuntu 18.04 64-bit.

Could you confirm if it is some bug in MHD?

Thanks in advance!

P.S.: remember to change the line 7 (#define MHD_DIR "~/libmicrohttpd/") to avoid application crash, all the errors handling was omitted to make the example clear and small.

--
Silvio Clécio

Attachment: main.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]