libmicrohttpd
[Top][All Lists]
Advanced

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

[libmicrohttpd] incoming-data boundary determination


From: eponymousalias
Subject: [libmicrohttpd] incoming-data boundary determination
Date: Thu, 11 Apr 2019 02:54:02 +0000 (UTC)

I am starting in on an effort to use libmicrohttpd.  Having read
through the complete tutorial and manual, I am still missing certain 
key information.

When, exactly, is answer_to_connection() called with respect to
the incoming content-data stream from the client? 

I'm writing a web server that will process certain types of
POST data.  Suppose the client sends in a 100 KB package of data.
Ignoring the first (setup) call to answer_to_connection(), does
libmicrohttpd wait until the entire payload has been received before
calling answer_to_connection() with a non-zero upload_data_size?
Or does it make some decision on how to cut the payload into sections
that are passed in successive calls?  On what basis is such a
decision made, and how consistent and reliable is that logic in
the face of varying payload sizes, large and small?

My question is very general.  In my particular case, the format will
be neither application/x-www-form-urlencoded nor multipart/form-data.
So whatever the library might decide in those cases does not apply
to my situation.  But even in those cases, what guarantees are there
that data of specific application-level interest does not overlap 
the boundary between sections that are passed in successive calls
to answer_to_connection()?

I need to know if the incoming POST data may be passed to my
answer_to_connection() routine in multiple sections not necessarily
related to semantic boundaries in the payload.  If that is the case,
it seems like I would need to keep accumulating the data passed in
all the calls until I get one with a zero value for upload_data_size,
and only then can I reliably process the full dataset.  Would that
not entail extra data copying into a connection-specific buffer
maintained by my application?  Is there some per-connection buffer
within the libmicrohttpd package that will contain the entire
payload as one contiguous section once it has all been received,
that my application could access instead of spending precious time
in extra data copying along the way?  Or can I provide a buffer in
response to the first (setup, *con_cls == NULL) call, that would
tell libmicrohttpd where to directly place the incoming data,
to avoid such extra copying?


reply via email to

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