[libmicrohttpd] libmicrohttpd+http2

2018-09-05 Thread Santos Das
Hi,

Is there any stable opensource version which has added HTTP2.0 support to
libmicrohttpd ?

I came across this, but it is pre-beta stage I suppose.

https://github.com/maru/libmicrohttpd-http2


Any help would be appreciated.


thanks: santos


Re: [libmicrohttpd] Aync handling & message response

2018-09-05 Thread Christian Grothoff
Dear Kunal,

Yes, you can do all this, including raw epoll, no threads and storing
connection details in '*cls'.  I just don't have an example that does
all this at once ;-)

Happy hacking!

Christian

On 08/27/2018 11:15 AM, Kunal Ekawde wrote:
> Hi,
> 
> With ref to:
> https://lists.gnu.org/archive/html/libmicrohttpd/2018-08/msg00015.html ,
> I gone through twister, but looks like this is sync operation. The curl
> operation is performed sync in same thread. I wanted to know if there is
> a way to make it async, so basically on receiving the data callback
> (entire data), we should be able to store the connection details (cls ?)
> so that server can do some other task, like may be fetch from DB. When
> server is ready with response, it should be able to call
> MHD_queue_response with the stored connection details. When it breaks to
> fetch from DB, it could also handle other incoming requests. 
> Let me know If I'm missing something here or if there is any pointers
> w.r.t use of MHD in this way preferably using raw epoll instead of GNUnet.
> 
> Threading model interested is : Application is single threaded with its
> own epoll, MHD not to create any threads.
> 
> Thanks,
> ~Kunal



signature.asc
Description: OpenPGP digital signature


Re: [libmicrohttpd] Question on Async support

2018-09-05 Thread Christian Grothoff
Hi!

There is no official support for HTTP2 at this time, and there is no
timeline for adding support either.  The easiest way to get HTTP2
support would be to run your MHD behind a reverse proxy (Apache/nginx)
that supports HTTP2.

Happy hacking!

Christian

On 08/24/2018 09:24 PM, Santos Das wrote:
> Hi,
> 
> What is the plan of supporting http2 for MHD? 
> 
> I saw this project and the comments. Can you please comment ?. The
> libcurl supports http2 with 3rd party nghttp2. So, wondering what is the
> similar support for MHD ? Is there any recommended project for the same ?
> 
> https://github.com/maru/libmicrohttpd-http2
> 
> https://lists.gnu.org/archive/html/libmicrohttpd/2016-08/msg00032.html
> 
> 
> On Fri, Aug 24, 2018 at 11:59 PM Christian Grothoff  > wrote:
> 
> On 08/24/2018 08:05 PM, Santos Das wrote:
> > Thank you once again for the prompt reply.
> >
> > I have few more questions. Are you aware of any project which has
> > integrated libmicrohttpd along with libcurl without losing any
> > functionality of MHD ? I really want to run in the single threaded
> model
> > as I mentioned above.
> 
> GNUnet and GNU Taler (in Twister) do this for implementing an http
> proxy, basically HTTP server via MHD, then libcurl for the HTTP client:
> 
> https://git.taler.net/twister.git/
> 
> I don't see why you think integrating with libcurl would result in a
> loss of functionality.
> 



signature.asc
Description: OpenPGP digital signature


Re: [libmicrohttpd] [possible feature request?] Loading key/cert from file [gnutls_certificate_set_x509_key_file2()]

2018-09-05 Thread Christian Grothoff
Hi Silvio,

I don't like the proposed feature very much, it's something an
application developer can reasonably easily write themselves, it would
introduce a dependency on file system operations to MHD, and it would
include a lot of different possible error types (file not found, access
permissions wrong, etc.) that would have to be passed back to the
application.

That said, adding a good _example_ (reference code) for how to do this
in the documentation would be totally fine.

My 2 cents!

Happy hacking!

Christian
p.s.: sorry for the delay, life's been very busy...

On 07/29/2018 05:39 AM, silvioprog wrote:
> Hello dudes.
> 
> I tried to pass the key/cert files to the MHD library, however, it
> allows only passing via memory (using
> gnutls_certificate_set_x509_key_mem2()):
> 
>   MHD_OPTION_HTTPS_MEM_KEY, "private key content",
>   MHD_OPTION_HTTPS_MEM_CERT, "certificate content"
> 
> but it would be nice to use the GnuTLS's builtin functions to load the
> key/cert files: gnutls_certificate_set_x509_key_file2(). Advantage: the
> programmer just pass the path of the key/cert instead of writing own
> unsafe functions for file loading. So, what do you thing about
> to add those new options?:
> 
>   MHD_OPTION_HTTPS_FILE_KEY, "key.pem",
>   MHD_OPTION_HTTPS_FILE_CERT, "cert.pem",
>   MHD_OPTION_HTTPS_FILE_TRUST, "ca.pem"
> 
> Thank you!
> 
> -- 
> Silvio Clécio



signature.asc
Description: OpenPGP digital signature


Re: [libmicrohttpd] Web Socket disconnect behaviour

2018-09-05 Thread Christian Grothoff
On 9/3/18 6:09 PM, Paul Topley wrote:
> 
> This all works great, but there is one particular situation im not sure
> how to handle.  When there is an unexpected disconnect in the socket
> between client and server, which isnt instigated by either (lets say the
> server crashes, ethernet disconnect etc), im not sure how to
> re-establish the connection between then two.
> 
> 
> I have tried firing off another upgrade response from the server when a
> socket disconnect is detected, but the same socket int which had just
> died is passed back to my handler, which subsequently returns zero when
> I call recv to get data.
> 
> 
> Is there anything else I should be doing?
> 

You need to initiate another HTTP request from the client, again do the
upgrade and then handle resumption within your application protocol.

Happy hacking!

Christian



signature.asc
Description: OpenPGP digital signature


Re: [libmicrohttpd] Aync handling & message response

2018-09-05 Thread Robert D Kocisko
Christian / Kunal,

Doesn't the suspend_resume_epoll.c example cover this exact case?

- Bob

On Wed, Sep 5, 2018 at 5:35 AM Christian Grothoff 
wrote:

> Dear Kunal,
>
> Yes, you can do all this, including raw epoll, no threads and storing
> connection details in '*cls'.  I just don't have an example that does
> all this at once ;-)
>
> Happy hacking!
>
> Christian
>
> On 08/27/2018 11:15 AM, Kunal Ekawde wrote:
> > Hi,
> >
> > With ref to:
> > https://lists.gnu.org/archive/html/libmicrohttpd/2018-08/msg00015.html ,
> > I gone through twister, but looks like this is sync operation. The curl
> > operation is performed sync in same thread. I wanted to know if there is
> > a way to make it async, so basically on receiving the data callback
> > (entire data), we should be able to store the connection details (cls ?)
> > so that server can do some other task, like may be fetch from DB. When
> > server is ready with response, it should be able to call
> > MHD_queue_response with the stored connection details. When it breaks to
> > fetch from DB, it could also handle other incoming requests.
> > Let me know If I'm missing something here or if there is any pointers
> > w.r.t use of MHD in this way preferably using raw epoll instead of
> GNUnet.
> >
> > Threading model interested is : Application is single threaded with its
> > own epoll, MHD not to create any threads.
> >
> > Thanks,
> > ~Kunal
>
>


Re: [libmicrohttpd] Aync handling & message response

2018-09-05 Thread Kunal Ekawde
Thanks Christian, yes I got it done :)

On Wed, Sep 5, 2018 at 3:05 PM Christian Grothoff 
wrote:

> Dear Kunal,
>
> Yes, you can do all this, including raw epoll, no threads and storing
> connection details in '*cls'.  I just don't have an example that does
> all this at once ;-)
>
> Happy hacking!
>
> Christian
>
> On 08/27/2018 11:15 AM, Kunal Ekawde wrote:
> > Hi,
> >
> > With ref to:
> > https://lists.gnu.org/archive/html/libmicrohttpd/2018-08/msg00015.html ,
> > I gone through twister, but looks like this is sync operation. The curl
> > operation is performed sync in same thread. I wanted to know if there is
> > a way to make it async, so basically on receiving the data callback
> > (entire data), we should be able to store the connection details (cls ?)
> > so that server can do some other task, like may be fetch from DB. When
> > server is ready with response, it should be able to call
> > MHD_queue_response with the stored connection details. When it breaks to
> > fetch from DB, it could also handle other incoming requests.
> > Let me know If I'm missing something here or if there is any pointers
> > w.r.t use of MHD in this way preferably using raw epoll instead of
> GNUnet.
> >
> > Threading model interested is : Application is single threaded with its
> > own epoll, MHD not to create any threads.
> >
> > Thanks,
> > ~Kunal
>
>

-- 
~Kunal


Re: [libmicrohttpd] Aync handling & message response

2018-09-05 Thread Kunal Ekawde
Hi Christian,

Can you please confirm if suspend/resume wont use pipe (lfor IPC)?
As in manual it's mentioned as:
"Enables using MHD_suspend_connection and MHD_resume_connection,
as performing these calls requires some additional pipes to be created,
and code not using these calls should not pay the cost."

But couldn't see in src code.
My application is using external epoll w/o any MHD threads.

Thanks,
Kunal

On Wed, Sep 5, 2018 at 9:22 PM Kunal Ekawde  wrote:

> Thanks Christian, yes I got it done :)
>
> On Wed, Sep 5, 2018 at 3:05 PM Christian Grothoff 
> wrote:
>
>> Dear Kunal,
>>
>> Yes, you can do all this, including raw epoll, no threads and storing
>> connection details in '*cls'.  I just don't have an example that does
>> all this at once ;-)
>>
>> Happy hacking!
>>
>> Christian
>>
>> On 08/27/2018 11:15 AM, Kunal Ekawde wrote:
>> > Hi,
>> >
>> > With ref to:
>> > https://lists.gnu.org/archive/html/libmicrohttpd/2018-08/msg00015.html
>> ,
>> > I gone through twister, but looks like this is sync operation. The curl
>> > operation is performed sync in same thread. I wanted to know if there is
>> > a way to make it async, so basically on receiving the data callback
>> > (entire data), we should be able to store the connection details (cls ?)
>> > so that server can do some other task, like may be fetch from DB. When
>> > server is ready with response, it should be able to call
>> > MHD_queue_response with the stored connection details. When it breaks to
>> > fetch from DB, it could also handle other incoming requests.
>> > Let me know If I'm missing something here or if there is any pointers
>> > w.r.t use of MHD in this way preferably using raw epoll instead of
>> GNUnet.
>> >
>> > Threading model interested is : Application is single threaded with its
>> > own epoll, MHD not to create any threads.
>> >
>> > Thanks,
>> > ~Kunal
>>
>>
>
> --
> ~Kunal
>


-- 
~Kunal


Re: [libmicrohttpd] Aync handling & message response

2018-09-05 Thread Kunal Ekawde
Can you please provide some information on 'MHD_USE_TURBO' as I couldn't
find any info in manual.

Thanks,
Kunal

On Thu, Sep 6, 2018 at 11:41 AM Kunal Ekawde  wrote:

> Hi Christian,
>
> Can you please confirm if suspend/resume wont use pipe (lfor IPC)?
> As in manual it's mentioned as:
> "Enables using MHD_suspend_connection and MHD_resume_connection,
> as performing these calls requires some additional pipes to be created,
> and code not using these calls should not pay the cost."
>
> But couldn't see in src code.
> My application is using external epoll w/o any MHD threads.
>
> Thanks,
> Kunal
>
> On Wed, Sep 5, 2018 at 9:22 PM Kunal Ekawde  wrote:
>
>> Thanks Christian, yes I got it done :)
>>
>> On Wed, Sep 5, 2018 at 3:05 PM Christian Grothoff 
>> wrote:
>>
>>> Dear Kunal,
>>>
>>> Yes, you can do all this, including raw epoll, no threads and storing
>>> connection details in '*cls'.  I just don't have an example that does
>>> all this at once ;-)
>>>
>>> Happy hacking!
>>>
>>> Christian
>>>
>>> On 08/27/2018 11:15 AM, Kunal Ekawde wrote:
>>> > Hi,
>>> >
>>> > With ref to:
>>> > https://lists.gnu.org/archive/html/libmicrohttpd/2018-08/msg00015.html
>>> ,
>>> > I gone through twister, but looks like this is sync operation. The curl
>>> > operation is performed sync in same thread. I wanted to know if there
>>> is
>>> > a way to make it async, so basically on receiving the data callback
>>> > (entire data), we should be able to store the connection details (cls
>>> ?)
>>> > so that server can do some other task, like may be fetch from DB. When
>>> > server is ready with response, it should be able to call
>>> > MHD_queue_response with the stored connection details. When it breaks
>>> to
>>> > fetch from DB, it could also handle other incoming requests.
>>> > Let me know If I'm missing something here or if there is any pointers
>>> > w.r.t use of MHD in this way preferably using raw epoll instead of
>>> GNUnet.
>>> >
>>> > Threading model interested is : Application is single threaded with its
>>> > own epoll, MHD not to create any threads.
>>> >
>>> > Thanks,
>>> > ~Kunal
>>>
>>>
>>
>> --
>> ~Kunal
>>
>
>
> --
> ~Kunal
>


-- 
~Kunal