Re: [libmicrohttpd] Freeing data added to MHD_create_response_from_buffer

2022-01-17 Thread Nicolas Mora
Hello Gavin, [resend to the list, sorry fot the noise Gavin] Le 2022-01-17 à 14 h 40, Gavin Henry a écrit :> Hi all, > > I'm using json_dumps from jansson in my MHD_create_response_from_buffer > > Where is the best place to free this? I've tried at the end of my responses: > > MHD_destroy_resp

Re: [libmicrohttpd] GNU libmicrohttpd 0.9.74 released

2021-12-19 Thread Nicolas Mora
Hello, Le 2021-12-19 à 11 h 13, Evgeny Grin a écrit : Dear all, I'm very glad to finally announce the new release of GNU libmicrohttpd library version 0.9.74. Thanks to the team for this release! This release brings a lot of fixes and improvements, and important new features. The most signi

Re: [libmicrohttpd] Route lookups

2021-12-15 Thread Nicolas Mora
Hello, Le 2021-12-15 à 11 h 50, Gavin Henry a écrit : Hi all, Does anyone have an example of how you're mapping routes/urls to functions before I crack on with my own? Not to brag about it but I'm developing ulfius which is a Web API Framework based on libmicrohttpd. You can, among other

[libmicrohttpd] Error in post_process_urlencoded leads to segfault

2020-06-28 Thread Nicolas Mora
Hello, While running the unit tests in Ulfius, I just realized that MHD 0.9.70 generates an error while testing post processor limits. The context is the following. Inside the callback function, MHD_create_post_processor is called first with a buffer size of 1024. I just read in MHD doc that "for

Re: [libmicrohttpd] MHD_OPTION_HTTPS_MEM_TRUST and self-signed client certificates

2020-05-30 Thread Nicolas Mora
Hello Christian, Le 20-05-30 à 05 h 33, Christian Grothoff a écrit : > You can access client certificates (if provided) via > MHD_CONNECTION_INFO_GNUTLS_SESSION to get the `gnutls_session_t` and > then call gnutls_certificate_get_peers(). > Thanks for the answer, I tried that but unfortunately w

[libmicrohttpd] MHD_OPTION_HTTPS_MEM_TRUST and self-signed client certificates

2020-05-29 Thread Nicolas Mora
Hello all, In order to fully implement OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens (https://tools.ietf.org/html/rfc8705), I'd like to know if it's possible to use self-signed client certificates with MHD? I've never used such certificates, only CA signed ones in

[libmicrohttpd] Using MHD_USE_INTERNAL_POLLING_THREAD without MHD_OPTION_THREAD_POOL_SIZE

2019-08-06 Thread Nicolas Mora
When using the flag MHD_USE_THREAD_PER_CONNECTION with MHD_start_daemon, MHD recommends to explicitly enable flag MHD_USE_INTERNAL_POLLING_THREAD too. Is there a default thread pool size if we don't use the flag MHD_OPTION_THREAD_POOL_SIZE? Should we set it to an arbitrary value? Or should I

Re: [libmicrohttpd] feature request: change malloc/calloc/free functions

2019-07-22 Thread Nicolas Mora
My bad too, I didn't notice the function 'MHD_create_response_from_buffer_with_free_callback()' which is exactly what I need! The MHD reference manual doesn't mention it: https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dresponse-create I will update my code accor

Re: [libmicrohttpd] feature request: change malloc/calloc/free functions

2019-07-21 Thread Nicolas Mora
Sorry, the patch was inverted, here is a clean patch Le 19-07-21 à 22 h 30, Nicolas Mora a écrit : > Hello again, > > In fact, there already was the skeleton in MHD to provide what I mean. I > attached a patch fil for the function MHD_set_response_options that > allows to override

Re: [libmicrohttpd] feature request: change malloc/calloc/free functions

2019-07-21 Thread Nicolas Mora
use I wouldn't know where to put them. But with this change, I don't need to use MHD_RESPMEM_MUST_COPY anymore! What do you think? /Nicolas Le 19-07-21 à 16 h 10, Nicolas Mora a écrit : > Hello, > > Thanks for the feedback. I totally agree with you on the performance &g

Re: [libmicrohttpd] feature request: change malloc/calloc/free functions

2019-07-21 Thread Nicolas Mora
e functions you propose (or Hoard itself) > would be (GNU) libc. > > Happy hacking! > > Christian > > On 7/21/19 9:28 PM, Nicolas Mora wrote: >> I happened to see that MHD doesn't allow to use different >> malloc/calloc/free functions than the one provided by libc. &

[libmicrohttpd] feature request: change malloc/calloc/free functions

2019-07-21 Thread Nicolas Mora
I happened to see that MHD doesn't allow to use different malloc/calloc/free functions than the one provided by libc. This would be useful if the underlying app using MHD uses different allocating functions like Hoard: http://www.hoard.org/ More specifically, when using MHD_RESPMEM_MUST_FREE in a

Re: [libmicrohttpd] MHD_CONNECTION_OPTION_TIMEOUT seems not to work with MHD_create_response_from_callback

2019-02-02 Thread Nicolas Mora
Hello, Le 19-02-02 à 05 h 29, Christian Grothoff a écrit : > > You are right to use the timeout option here. Beyond that, there is So you confirm that MHD_CONNECTION_OPTION_TIMEOUT is not available when using MHD_create_response_from_callback? > On the server side, make sure you use EPOLL, in th

[libmicrohttpd] MHD_CONNECTION_OPTION_TIMEOUT seems not to work with MHD_create_response_from_callback

2019-01-31 Thread Nicolas Mora
Hello, Although it's not easy to reproduce, it seems that using connection option MHD_CONNECTION_OPTION_TIMEOUT when streaming data with MHD_create_response_from_callback seems not to work, although. In my application with MHD underneath where the problem occurs, I provide a webradio, which

Re: [libmicrohttpd] websocket example

2019-01-30 Thread Nicolas Mora
Hello, Le 2019-01-29 10:16, Moritz Warning a écrit : can someone point me to an example of using websockets with libmicrohttpd? As others, I made an implementation of a websocket service with MHD underneath. https://github.com/babelouest/ulfius/blob/master/src/ulfius.c#L529 Mine is so ent

[libmicrohttpd] Memory leak when using MHD in TLS mode with bad certificates

2019-01-11 Thread Nicolas Mora
Hello, While testing memory leaks in my code with valgrind, I found the following problem, but I'm not sure if it comes from MHD or GnuTLS, or even my use of libmicrohttpd. I use libmicrohttpd 0.9.62 and GnuTLS 3.6.5 on Debian. When you execute MHD_start_daemon with TLS support but use bad

Re: [libmicrohttpd] Does MHD_CONNECTION_OPTION_TIMEOUT works with MHD_create_response_from_callback ?

2018-10-07 Thread Nicolas Mora
Hello, Le 2018-10-02 à 20:44, Nicolas Mora a écrit : > Does this option work with stream responses using > MHD_create_response_from_callback? > According to my tests, setting a connection timeout on a response created with MHD_create_response_from_callback has no effect, you

[libmicrohttpd] Does MHD_CONNECTION_OPTION_TIMEOUT works with MHD_create_response_from_callback ?

2018-10-02 Thread Nicolas Mora
Hello, I'd like my webservice to disconnect lost connections by force and it looks like MHD_CONNECTION_OPTION_TIMEOUT should do the trick but in my tests it doesn't work. Does this option work with stream responses using MHD_create_response_from_callback? If not is there another way? Thanks

Re: [libmicrohttpd] About an HTTPS connection Upgraded

2017-05-07 Thread Nicolas Mora
Le 2017-05-07 à 16:51, Christian Grothoff a écrit : Hmm. Try 'strace' on IO operations (only, i.e. "strace -e trace=network,ipc,desc"). When you 'send' to the Web socket, it should be writing to a socketpair(), followed by MHD 'recv'ing from that socketpair() and then GnuTLS ultimately send'ing

Re: [libmicrohttpd] About an HTTPS connection Upgraded

2017-05-07 Thread Nicolas Mora
Le 2017-05-07 à 15:42, Christian Grothoff a écrit : Eh, what is wrong is that you use "gnutls_record_send". MHD will do this for you, you should just use "send/recv", even in HTTPS mode! In fact, your code (short of MHD_start_daemon) can be exactly the same for HTTP and HTTPS. Argh, I tried

[libmicrohttpd] About an HTTPS connection Upgraded

2017-05-07 Thread Nicolas Mora
Hello, I'm still working on a websocket implementation based on MHD, the non secure websocket works fine, but the secure websocket doesn't work yet. I'm having problems with the socket and the tls session. I get my inspiration from the test_upgrade.c file but I can't have a valid tls session

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Nicolas Mora
Do you use HTTP or HTTPS? Eventually, since it's a framework for both http and https, I will use both protocols. You must not call MHD_stop_daemon() while you still have some not closed "upgraded" connections. May be we should add more alarming message in case of such API violation. I unders

Re: [libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-04 Thread Nicolas Mora
Hi, Thanks Evgeny and Silvio for your help Le 2017-05-04 à 03:02, Evgeny Grin a écrit : MHD_quiesce_daemon() prevent MHD from accepting new connections but allow to continue processing with current connections. The returned socket is listening socket. Actually, I'm not using MHD_quiesce_daemo

[libmicrohttpd] How to close all upgraded connections when shutting down MHD_Daemon?

2017-05-03 Thread Nicolas Mora
Hello, I'm currently working on an implementation of a websocket manager with MHD and it's getting pretty good so far. The problem I have is when the daemon is shut down and there are open connections. The documentation on MHD_quiesce_daemon says that "Note that the caller is responsible for

[libmicrohttpd] Presentation of Ulfius, a HTTP REST framework

2015-12-18 Thread Nicolas Mora
Hello, I'm working with MHD for a little while now, mostly to create home automation applications that can work on small and embedded devices, like Raspberry Pi or Cubieboard. At first, I used MHD with success, thanks to all the contributors. But I wanted to facilitate the use of web service

Re: [libmicrohttpd] MHD_OPTION_URI_LOG_CALLBACK and con_cls

2015-11-11 Thread Nicolas Mora
Simple and elegant, thanks a lot! Le 2015-11-11 17:59, Christian Grothoff a écrit : On 11/11/2015 11:52 PM, Nicolas Mora wrote: Hello, While trying to use the option MHD_OPTION_URI_LOG_CALLBACK to get the full url from the client, the documentation says: "the return value will be pass

[libmicrohttpd] MHD_OPTION_URI_LOG_CALLBACK and con_cls

2015-11-11 Thread Nicolas Mora
Hello, While trying to use the option MHD_OPTION_URI_LOG_CALLBACK to get the full url from the client, the documentation says: "the return value will be passed as (*con_cls) in calls to the MHD_AccessHandlerCallback when this request is processed later; returning a value of NULL has no speci

[libmicrohttpd] Access request body for form post and json parsing

2015-10-26 Thread Nicolas Mora
Hello, I'm currently trying to develop a web framework based on MHD. While trying to access request body, I have some difficulties to handle it. There are 2 different access types: form-based HTTP POST and JSON based HTTP REST calls. For the first type, if I want to access its value, I can'

Re: [libmicrohttpd] Memory leak and global variables

2014-08-29 Thread Nicolas Mora
Hello again, Le 2014-08-28 15:51, Kenneth Mastro a écrit : Glad my comments helped. One quick thing/clarification - that bug in the latest 'released' version of MHD was related to cleaning up the list of internal connection/request structures. (This occurred during the 'stop daemon' call - man

Re: [libmicrohttpd] Memory leak and global variables

2014-08-28 Thread Nicolas Mora
Hi Kenneth, thanks a lot for your answer, you helped me moving on with my problems. I fixed a lot of small problems thanks to your answers, but the memory leaks are still here with the same conditions: about 20kb is lost each time I call the 6 main webservices simultaneously with jquery, but n

[libmicrohttpd] Memory leak and global variables

2014-08-27 Thread Nicolas Mora
Hello, I'm using libmicrohttpd10 on a Raspberry Pi using Raspbian, the server running has a http daemon for a house automation daemon written in C. I'm trying to get rid of all the memory leaks I can find, but it seems that some are related to libmicrohttpd and I still can't find them. I in