[libmicrohttpd] Multipart Reading

2018-11-09 Thread Santos Das
Hi,

Can you please let me know how we do read the multupart message body using
MHD.

I am having problem in reading the multi part.

Thanks, Santos


Re: [libmicrohttpd] next release

2018-11-09 Thread silvioprog
Awesome news!

Thanks a lot for this work dudes.

Cheers

On Tue, Nov 6, 2018, 16:19 Christian Grothoff  Dear all,
>
> I've now released libmicrohttpd 0.9.60 with the usual set of minor
> bugfixes and feature enhancements:
>
> * gettext updated to 0.19.8
> * can use epoll() without listen socket now
> * in thread-per-connection mode, socket closure is now communicated
>   in a timely fashion to the application
> * added MHD_RF_HTTP_VERSION_1_0_RESPONSE option
> * preventing bogus transfer-encoding values
> * Added MHD_OPTION_GNUTLS_PSK_CRED_HANDLER
> * allow digest authentication with hashed password
> * ensure request completed callback is called from correct thread
>   and also for upgraded connections
>
> You can download GNU libmicrohttpd from
>
> * https://ftp.gnu.org/gnu/libmicrohttpd/ and all GNU FTP mirrors.
> * Our git repository at https://gnunet.org/git/libmicrohttpd.git
>
> Please report bugs to our bugtracker at https://gnunet.org/bugs/.
>
> The documentation (including a reference manual and tutorial) can be
> found at https://www.gnu.org/software/libmicrohttpd/.
>
>
> Happy hacking!
>
> Christian
>
> On 10/18/18 3:50 PM, Gauthier Haderer wrote:
> > Hi,
> >
> > The last release was made in February. Do you have any plan to release a
> > new version of MHD soon?
> >
> > Cheers,
> >
> >
> > Gauthier
>
>


Re: [libmicrohttpd] Multipart Reading

2018-11-09 Thread Santos Das
Hi,

To be specific, my client is sending me data with Content Type
multipart/related.  As per the MHD guide, I should get the complete data
stream. But, I am not getting so. Any idea what could be wrong ?

MHD understands POST data and is able to decode certain formats (at the
moment only application/x-www-form-urlencoded and multipart/form-data)
using the post processor API. The data stream of a POST is also provided
directly to the main application, so unsupported encodings could still be
processed, just not conveniently by MHD.

Thanks, Santos

On Fri, Nov 9, 2018 at 9:33 PM Santos Das  wrote:

> Hi,
>
> Can you please let me know how we do read the multupart message body using
> MHD.
>
> I am having problem in reading the multi part.
>
> Thanks, Santos
>


[libmicrohttpd] Require info on setting TCP_NODELAY for MHD

2018-11-09 Thread Badari Prasad
Hi,
  I was going through old mailist archives, found one thread on TCP_NODELAY
: https://lists.gnu.org/archive/html/libmicrohttpd/2015-11/msg00077.html
But couldn't know if the option provided is it at compile time flag or
runtime flag per connection basis.

Kindly let me know the information on TCP_NODELAY option at MHD.

Thank in advance

 Badari


Re: [libmicrohttpd] Multipart Reading

2018-11-09 Thread silvioprog
Hi Santos,

it is very easy to handle multi-part and/or form-data in MHD. Some time ago
I sent this answer for a StackOverflow user:
https://stackoverflow.com/a/32705436/3268398 .

I handle uploads and/or payload (raw content) in the library (built under
MHD) I'm maintaining. It allows to get any raw content (JSON, XML etc.)
using something like this in the server side

:

static void req_cb(__SG_UNUSED void *cls, __SG_UNUSED struct
sg_httpreq *req, __SG_UNUSED struct sg_httpres *res) {
struct sg_str *payload = sg_httpreq_payload(req);
sg_httpres_send(res, sg_str_content(payload), "text/plain", 200);
}


and this in the client side (exemplifying in cURL):

curl --header "Content-Type: application/json" --request POST --data
'{"abc":123}' -w "\n" http://localhost:


the sent raw content will be echoed back to the client. It is easy to iterates
uploaded files

too:

static void process_uploads(struct sg_httpreq *req, struct sg_httpres *res) {
struct sg_httpupld *upld;
...
upld = sg_httpreq_uploads(req); // first uploaded file
while (upld) {
name = sg_httpupld_name(upld);
if ((errnum = sg_httpupld_save(upld, true)) == 0) // save the file
sg_str_printf(body, "%s", name, name);
else {
sg_strerror(errnum, errmsg, sizeof(errmsg));
sg_str_printf(body, "%s - failed -
%s", name, errmsg); // handle saving errors
}
sg_httpuplds_next(&upld); // next uploaded file
}

...


Maybe it can be used as a starting point for you to check how to handle the
MHD's ... const char *upld_data, size_t *upld_data_size ... AHC parameters.
The related lines I've used, are:

https://github.com/risoflora/libsagui/blob/master/src/sg_httpsrv.c#L60

https://github.com/risoflora/libsagui/blob/master/src/sg_httpuplds.c#L119

Hope this helps you. ☺

On Fri, Nov 9, 2018 at 1:04 PM Santos Das  wrote:

> Hi,
>
> Can you please let me know how we do read the multupart message body using
> MHD.
>
> I am having problem in reading the multi part.
>
> Thanks, Santos
>

-- 
Silvio Clécio