libmicrohttpd
[Top][All Lists]
Advanced

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

[libmicrohttpd] Block size in MHD_create_response_from_callback


From: Andre Colomb
Subject: [libmicrohttpd] Block size in MHD_create_response_from_callback
Date: Wed, 29 Jul 2009 14:06:05 +0200
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

Howdy all!

Just ran into some trouble when trying to build responses from a callback function. It seems that the "max" parameter to the callback is always 2048 bytes until the last block is reached, no matter what I specify as block_size.

However, when setting it to a value lower than 2048 (tried with 1024), I get segfaults, presumably because the buffer allocated is too small. Larger values don't cause the segfaults but the "max" parameter is still only 2048. Here is the output from my application's MHD_ContentReaderCallback function. The first number is its return value, second is the "max" argument and third is the "pos" argument.

[2009-07-29 13:25:54.759] DEBUG_COMM: <VxmlServer> Read 2048 of 2048 bytes from file at position 0 [2009-07-29 13:25:54.759] DEBUG_COMM: <VxmlServer> Read 2048 of 2048 bytes from file at position 0 [2009-07-29 13:25:54.759] DEBUG_COMM: <VxmlServer> Read 2048 of 2048 bytes from file at position 2048 [2009-07-29 13:25:54.759] DEBUG_COMM: <VxmlServer> Read 2048 of 2048 bytes from file at position 4096 [2009-07-29 13:25:54.759] DEBUG_COMM: <VxmlServer> Read 2048 of 2048 bytes from file at position 6144 [2009-07-29 13:25:54.759] DEBUG_COMM: <VxmlServer> Read 1941 of 1941 bytes from file at position 8192

Please also note that this does not match the documented behavior, quote: "MHD guarantees that pos will be the sum of all non-negative return values obtained from the content reader so far."

This is not true for the second call where pos should be 2048 instead of 0. I am not re-using the response object and the total response length I specified was 10133.

My libmicrohttpd version is 0.4.1 with PlibC 0.1.3, unfortunately I couldn't manage to use 0.4.2 so far.

Regards, Andre




reply via email to

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