Re: [libmicrohttpd] Clang static analyzer reports...

2020-03-03 Thread Christian Grothoff
On 2/20/20 7:35 PM, Tim Rühsen wrote: > Did anyone already play with gcc-10's -fanalyzer ? > > https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html I just tried it, found 2 NPEs (in rare error paths) in GNU Taler and one in GNUnet, but nothing in GNU libmicrohttpd ;-) signature.asc

Re: [libmicrohttpd] Double regarding suspended connection and pthread_exit

2020-03-16 Thread Christian Grothoff
This seems kind-of OK (I personally think pthread_detach is always messy and in 99.9% of cases a bad idea). What you do need to (somehow) ensure is that you do MHD_resume_connection() (and let it finish) *before* calling MHD_stop_daemon(). On 3/16/20 8:00 PM, silvioprog wrote: > Hi. > > I have a

Re: [libmicrohttpd] Double regarding suspended connection and pthread_exit

2020-03-16 Thread Christian Grothoff
On 3/16/20 9:16 PM, silvioprog wrote: > On Mon, Mar 16, 2020 at 4:29 PM Christian Grothoff <mailto:groth...@gnunet.org>> wrote: > > This seems kind-of OK (I personally think pthread_detach is always messy > and in 99.9% of cases a bad idea). > >

Re: [libmicrohttpd] Double regarding suspended connection and pthread_exit

2020-03-16 Thread Christian Grothoff
You should resume once the data is available, which _likely_ means position 2 (I don't know enough about your code to be sure). You also need a way to stop the 'long time processing of data' if you get the SIGTERM, and then join the thread before calling MHD_stop_daemon(). On 3/17/20 1:39 AM, sil

Re: [libmicrohttpd] HTTP range requests handling

2020-03-21 Thread Christian Grothoff
Hi! No, we don't. Note that you might not even want to support the full range spec: https://tools.ietf.org/html/rfc7233#page-19 https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/updated-mitigation-of-apache-range-header-dos-attack/ Happy hacking! Christian On 3/21/20 10:45 AM, E

Re: [libmicrohttpd] HTTP range requests handling

2020-03-21 Thread Christian Grothoff
you be interested to integrate it to libmicrohttpd > as a kind of helper solution? > > Kind regards > Emmanuel > > On 21.03.20 10:56, Christian Grothoff wrote: >> Hi! >> >> No, we don't. Note that you might not even want to support the full >> range

Re: [libmicrohttpd] Starting 2 server on same port but different ip address

2020-03-25 Thread Christian Grothoff
Hi Shikha, What you can/should do is call socket(), bind() and listen() yourself first, and then call MHD_start_daemon() using MHD_OPTION_LISTEN_SOCKET to pass the already bound listen socket. That way, you can precisely bind to whatever IPs/ports you want to use. happy hacking! Christian On 3

Re: [libmicrohttpd] microhttpd 0.9.70 test failures on OS X 10.9

2020-04-03 Thread Christian Grothoff
We made some OS X-specific fixes in Git master. Could you please try with the latest version in Git? Thanks! Christian On 4/3/20 9:01 AM, Jeffrey Walton wrote: > Hi Everyone, > > I'm testing the microhttpd 0.9.70 release tarball on OS X 10.9. There > are some test failures: > > PASS: test_sha2

Re: [libmicrohttpd] projects using libmicrohttpd

2020-04-05 Thread Christian Grothoff
Done, thanks for the information! -Christian On 4/4/20 1:53 PM, Jonas Smedegaard wrote: > Hi, > > I notice that libmicrohttpd homepage includes a list of other projects > using it - that's really helpful, thanks for that! > > You might consider adding these additional projects to your nice list

Re: [libmicrohttpd] Strange char 0x7f added after last POST notification

2020-04-13 Thread Christian Grothoff
On 4/13/20 2:11 AM, Imóveis Nacionais wrote: > Then when in the "*upload_data_size = 0" situation, using a printf > sometimes I can see that the thread context data has the 0x7f char appended > and of course the strlen now is one char extra. This happens between the > last post call with *upload_da

Re: [libmicrohttpd] Strange char 0x7f added after last POST notification

2020-04-13 Thread Christian Grothoff
have (%s) (%d) > \n",pstThreadData->strData, strlen(pstThreadData->strData)); >             HandleClientPost(pstThreadData->strData)) >     //In the end of post we have ({"key98"}) (10) > ... > > Please, is there anything wrong with the (testing) code? > >

Re: [libmicrohttpd] Parsing multipart/formdata

2020-04-21 Thread Christian Grothoff
Hi Markus, Let me get this straight: The scenario you are concerned with is to distinguish the case that there are possibly two variables with *identical* key / content-type *values* and the first one has an 'empty' value, and the second case is that there is just one value and you got called with

Re: [libmicrohttpd] problems with callack replies

2020-04-29 Thread Christian Grothoff
Dear Viktor, Your code snippet looks fine. So I just tried and failed to reproduce your problem. I basically simply used Wireshark and the existing code from here: https://git.gnunet.org/libmicrohttpd.git/tree/src/examples/http_chunked_compression.c (Note: I fixed a relevant typo in the example

Re: [libmicrohttpd] issue with multi-part data in libmicrohttpd

2020-05-13 Thread Christian Grothoff
Hi Conor, This is NOT a known issue, and very strange on top of that. If you could create a patch against "test_postprocessor" that reproduces the specific problem, that would definitively be appreciated and would speed up my investigation... Happy hacking! Christian On 5/13/20 3:50 PM, Conor L

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

2020-05-30 Thread Christian Grothoff
Hi Nicolas, 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(). Happy hacking! Christian On 5/30/20 1:47 AM, Nicolas Mora wrote: > Hello all, > > In order to fully implement OAuth

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

2020-05-30 Thread Christian Grothoff
Hi Nicolas, I suggest you ask about this on the GnuTLS mailinglist. MHD exposes to you the GnuTLS handle, so it _should_ be possible to do what you want with that. Happy hacking! Christian On 5/30/20 2:42 PM, Nicolas Mora wrote: > Hello Christian, > > Le 20-05-30 à 05 h 33, Christian

Re: [libmicrohttpd] Failed to Remove Listen FD from epoll set

2020-06-10 Thread Christian Grothoff
Hi Damon, MHD _internally_ removes the listen socket from the epoll set if it is at the connection limit. So if you have say near 1024 connections (or whatever your limit is) open at the time of quiesce, the listen socket might not be in the epoll-set. However, it _seems_ that the code is handling

Re: [libmicrohttpd] www-form-urlencoded: dealing with keys with no value

2020-06-10 Thread Christian Grothoff
t-data. > A testcase is attached: The value of should be . > > Best wishes > Markus > > > Weitergeleitete Nachricht > *Von*: Christian Grothoff <mailto:christian%20grothoff%20%3cgroth...@gnunet.org%3e>> > *Antwort an*:

Re: [libmicrohttpd] MHD_lookup_connection_value for trailing keys

2020-06-10 Thread Christian Grothoff
Hi! Thanks for the report. The manual is wrong (/very outdated). I've fixed it in Git d7709c55..2abe788d. The old method was bad, because you could not properly handle cases like http://example.com/?trailer1&trailer2 with it. You should use MHD_get_connection_values() instead, that will allow y

Re: [libmicrohttpd] Bug report - chunked transfer encoding not working with SSL (libgnutls).

2020-06-16 Thread Christian Grothoff
Dear Philip, Thanks for your report. I've done some manual inspection of the code, and -- without having reproduced the issue -- my best guess is that our ignoring of the result from gnutls_record_uncork() likely is "unsavory". I have addressed this in Git commit 11ed3de3..0d771f77 and would very

Re: [libmicrohttpd] Setting thread attributes

2020-06-27 Thread Christian Grothoff
You can theoretically call pthread_self() once MHD calls the application callback inside of a thread. There is currently no way to change attributes for threads during thread creation. Happy hacking! Christian On 6/27/20 9:12 PM, Anaswara Nair wrote: > Hi, > > I am using libmicrohttpd for the f

Re: [libmicrohttpd] Setting thread attributes

2020-06-28 Thread Christian Grothoff
1: If you use MHD's threaded modes, MHD 'insists' on creating the threads itself. If you use the 'external' event loop (indeed with MHD_NO_FLAG), then MHD runs (only) in the thread you call it from, and only when you call MHD_run(). 2: indeed. -Christian On 6/28/20 2:11 PM, Anaswara Nair wrote:

[libmicrohttpd] libmicrohttpd 0.9.71 released

2020-06-28 Thread Christian Grothoff
Dear all, I'm happy to announce the release of GNU libmicrohttpd 0.9.71. This release fixes a potential buffer overflow and is thus considered a security release. Please upgrade as soon as possible. Thanks to Nicolas Mora for finding and reporting the issue. Additionally, the release fixes the

Re: [libmicrohttpd] Using MHD with external thread

2020-07-02 Thread Christian Grothoff
Well, "MHD_get_fdset()" is by design suitable for select(). You _can_ convert the result to an input for poll(), but that is painful. If epoll() is supported on your system, you may want to use the MHD_DAEMON_INFO_EPOLL_FD to get an epoll-FD from MHD and throw that into poll() _or_ epoll(). On 7/1

Re: [libmicrohttpd] Introduction fo 'enum MHD_result' with 0.9.71

2020-07-06 Thread Christian Grothoff
On 7/6/20 5:26 PM, Weber, Peter (Wilken Entire GmbH) wrote: > Hello! > > Actually it is not causing warnings but errors within my projects and I > got a little bit scared. Hmm. Strange. Which C compiler are you using? Maybe your C compiler doesn't quite believe that "enum == int"? Regardless, not

Re: [libmicrohttpd] Borken API in version 0.97.1?

2020-07-08 Thread Christian Grothoff
On 7/8/20 9:39 AM, Emmanuel Engelhart wrote: > Hi > > It seems the last release 0.97.1 has broken the API: > * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964495 > * https://github.com/kiwix/kiwix-lib/issues/373 > > Is that normal? Are we understanding something wrong? See the release anno

Re: [libmicrohttpd] Borken API in version 0.97.1?

2020-07-08 Thread Christian Grothoff
On 7/8/20 10:41 AM, Emmanuel Engelhart wrote: > Your announcement talks about "warnings" and here it breaks at > compilation time. This is the only thing I wonder about. In particular > considering that this is a minor release upgrade. Honestly, I simply had not thought about C++ when I wrote 'war

Re: [libmicrohttpd] libmicrohttpd api change?

2020-07-08 Thread Christian Grothoff
Please see the 0.9.71 release announcement: https://lists.gnu.org/archive/html/libmicrohttpd/2020-06/msg00013.html Furthermore, the release introduces an 'enum MHD_Result' instead of #defines for MHD_YES/MHD_NO. This is intended to make it easier to check for certain API misuse bugs by providing

Re: [libmicrohttpd] libmicrohttpd 0.9.71 released

2020-07-10 Thread Christian Grothoff
not "text%2C text". > > Best wishes > > > Weitergeleitete Nachricht > *Von*: Christian Grothoff <mailto:christian%20grothoff%20%3cgroth...@gnunet.org%3e>> > *Antwort an*: libmicrohttpd development and user mailinglist > <mailto:libmic

Re: [libmicrohttpd] Question about threads pool and TLS

2020-07-14 Thread Christian Grothoff
Hi Iron Bug, You may want to look at https://git.taler.net/exchange.git/src/exchangedb/plugin_exchangedb_postgres.c for inspiration. There, we use a /** * Thread-local database connection. * Contains a pointer to `struct GNUNET_PQ_Context` or NULL. */ pthread_key_t db_conn_threadloca

Re: [libmicrohttpd] MHD_Result casting error.

2020-08-06 Thread Christian Grothoff
Hi Jason, In C++, the return type must match precisely, while in C an 'int' vs. an 'enum' only causes a warning. MHD recently changed the C API from 'int' to enum, so to fix the C++ build you must change the return type of Httpd::handler to 'enum MHD_Result'. That should be all. Happy hacking! C

Re: [libmicrohttpd] Issue on receiving very long URI

2020-08-19 Thread Christian Grothoff
Dear Shikha, I'm not sure how this can happen, as the function specifically first computes the available space in the pool before making the allocation request. Could you please check if the if (pool->pos == ROUND_TO_ALIGN (old_offset + old_size)) condition in memorypool.c::MHD_pool_reallocate(

Re: [libmicrohttpd] libmicrohttpd 0.9.71 released

2020-09-11 Thread Christian Grothoff
gt; > Best wishes > Markus > > > > Weitergeleitete Nachricht > *Von*: Christian Grothoff <mailto:christian%20grothoff%20%3cgroth...@gnunet.org%3e>> > *Antwort an*: libmicrohttpd development and user mailinglist > <mailto:libmicrohttpd

Re: [libmicrohttpd] Getting "raw URL" directly

2020-09-17 Thread Christian Grothoff
You can get the full unparsed URL using the MHD_OPTION_URI_LOG_CALLBACK To do so, register this callback and it'll be the first thing you ever see of any request. Happy hacking! Christian On 9/17/20 12:32 PM, FERMIN GALAN MARQUEZ wrote: > Hi, > >   > > I have a libmicrohttpd based server tha

Re: [libmicrohttpd] MHD_add_connection Problems

2020-09-26 Thread Christian Grothoff
Hi Damon, You're right, the combination of MHD_NO_LISTEN_SOCKET and MHD internal threads did not work properly. However, the 'race' you are trying to fix doesn't really apply. Also, I think it is a bit safer to test for the existence of the IPC socket before creating the threads in the no-listen-s

Re: [libmicrohttpd] Problem send large trunk of data over upgraded connection with epoll and https enabled

2020-09-27 Thread Christian Grothoff
; On 7/30/19 11:00 PM, Việt Nguyễn Xuân wrote: >> Dear Christian, >> >> Thanks for your reply. >> I'm very happy to hear your information. I will continue to work with your >> latest source in the future. >> >> Best regards, >> Viet >&

Re: [libmicrohttpd] Improving response header build performance

2020-10-07 Thread Christian Grothoff
Hi Ariel, That's an interesting proposal, but I think it goes a bit into the wrong direction: - given that applications using MHD are likely to use printf() elsewhere, it'll almost certainly increase code size. I generally think for MHD code size is more important than speed. - given that the main

Re: [libmicrohttpd] How MHD_VERSION works and how to get the "x.y.z-r" string from it?

2020-10-27 Thread Christian Grothoff
Hi Fermin, There isn't a sane way to convert the MHD_VERSION string to the x.y.z-string, and it's largely by accident in that we failed to properly count in HEX. We are likely to fix that once we go for 1.0. OTOH, the idea of the MHD_VERSION string was to do stuff like #if MHD_VERSION > 0x44 bug-

Re: [libmicrohttpd] Upgrade to digest authentication

2020-11-08 Thread Christian Grothoff
appy hacking! Christian > I must be doing something wrong as I'm sure this has been tested many > times over. > > Best regards > > David > > > On 2020-10-31 5:36 pm, Christian Grothoff wrote: > > Hi David, > > I don't see anything _obviou

Re: [libmicrohttpd] Upgrade to digest authentication

2020-11-11 Thread Christian Grothoff
On 11/11/20 3:02 PM, DJM-Avalesta wrote: > Hi, > > I spoke too soon, I still have issues authenticating with certain clients. > > The attached wireshark shows, at the very end, it fails to authenticate > an HTTP GET of an image file (/mjpg/image.cgi) when the username, nonce > and realm all seem

Re: [libmicrohttpd] Upgrade to digest authentication

2020-11-11 Thread Christian Grothoff
>   > Other clients eg Firefox or ONVIF Conformance tool, hash the complete > url so it is not a problem. >   > I can fix it for ODM by removing the params, but I really need the > params so that the snapshot can select different images. >   > Best regards > David > >

Re: [libmicrohttpd] upgrading and life cycle of sockets

2020-11-24 Thread Christian Grothoff
Hi Jose, Well, technically you can dup() around this and call action close early. HOWEVER, this breaks BADLY if you ever use TLS connections: here, MHD will right now ensure that you write plaintext into your socket and turn it into ciphertext for the network. That's why MHD needs to keep some sta

Re: [libmicrohttpd] upgrading and life cycle of sockets

2020-11-24 Thread Christian Grothoff
On 11/24/20 3:48 PM, José Bollo wrote: > On Tue, 24 Nov 2020 15:34:03 +0100 > Christian Grothoff wrote: > >> Hi Jose, >> >> Well, technically you can dup() around this and call action close >> early. HOWEVER, this breaks BADLY if you ever use TLS connections: &

Re: [libmicrohttpd] upgrading and life cycle of sockets

2020-11-24 Thread Christian Grothoff
On 11/24/20 4:50 PM, José Bollo wrote: > What about if in some future an option to MHD_upgrade_action would > enable to "extract" the socket? Something like: > > MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_OWN_SOCKET); > > with a clear semantic on the implications that it has on half-closin

Re: [libmicrohttpd] upgrading and life cycle of sockets

2020-11-26 Thread Christian Grothoff
On 11/26/20 8:31 AM, José Bollo wrote: > On Tue, 24 Nov 2020 23:12:43 +0100 > Christian Grothoff wrote: > >> On 11/24/20 4:50 PM, José Bollo wrote: >>> What about if in some future an option to MHD_upgrade_action would >>> enable to &qu

Re: [libmicrohttpd] upgrading and life cycle of sockets

2020-11-26 Thread Christian Grothoff
On 11/26/20 1:14 PM, José Bollo wrote: >> For child processes, not really: you can even do the dup()ing only >> after fork() if you manually clear the close-on-exec flag. So you >> don't need any extra FDs if you do it 'just right'. > Yeah but fork+exec is a requirement I don't get it. If you don'

Re: [libmicrohttpd] Assertion failure with raw "GET /" request

2020-12-01 Thread Christian Grothoff
Hi Niels, I can confirm the issue, alas it was already fixed in Git master (by Evgeny) in October. We should indeed make a new release... (Note: the assertion was basically wrong, so when compiling without assertions means that there is no harm from the issue.) Happy hacking! Christian On 12/1

Re: [libmicrohttpd] Assertion failure with raw "GET /" request

2020-12-01 Thread Christian Grothoff
sted a version that was cloned from the repository some time after > 0.9.71, but obviously it was a while ago (times flies) and I should probably > have pulled before the test... > > Regards, > > Niels > > Le mardi 1 décembre 2020 à 23:29, Christian Grothoff a > éc

Re: [libmicrohttpd] MHD_start_daemon with MHD_USE_SSL returns NULL

2020-12-04 Thread Christian Grothoff
Maybe configure failed to find a sufficiently recent version of gnutls, and so MHD was built without support for TLS? That'd be the simplest explanation I can think of... Happy hacking! -Christian On 12/4/20 4:48 PM, DJM-Avalesta wrote: > Hi > > I recently upgraded from libmicrohttpd 0.9.24 to

Re: [libmicrohttpd] MHD_start_daemon with MHD_USE_SSL returns NULL

2020-12-04 Thread Christian Grothoff
> but how do I then link it in with my build of MHD? > My configure command is currently this > ./configure --host=arm CC=arm-none-linux-gnueabi-gcc > I'm guessing I need to modify this for gnutls support? >   > Best regards > David > > > On 2020-12-04 3:54 pm, Ch

Re: [libmicrohttpd] MHD requires GnuTLS and other libraries

2020-12-05 Thread Christian Grothoff
Hi David, How to cross-compile GnuTLS is a question better suited for the GnuTLS mailinglist ;-). Good luck! Happy hacking! Christian On 12/5/20 9:24 PM, DJM-Avalesta wrote: > Hi, > > To get MHD working with HTTPS on my embedded system, I need to link > libmicrohttpd with GnuTLS, so I need to

Re: [libmicrohttpd] Digest authentication on POST request causes 'Application reported internal error, closing connection'

2020-12-10 Thread Christian Grothoff
On 12/10/20 9:37 AM, Dirk Brinkmeier wrote: > Hi to all. > > I'm trying to POST data to libmicrohttpd with digest authentication > enabled. > The data looks like this: > > POST /ajax/response.html HTTP/1.1 > Accept: */* > Accept-Encoding: identity > Host: .ddns.net > User-Agent: NB-IoT-Client

Re: [libmicrohttpd] libmicrohttpd Digest, Vol 140, Issue 8

2020-12-10 Thread Christian Grothoff
ct line so it is more specific >> than "Re: Contents of libmicrohttpd digest..." >> >> >> Today's Topics: >> >>     1. Digest authentication on POST request causes 'Application &g

Re: [libmicrohttpd] HTTPS issues

2020-12-14 Thread Christian Grothoff
On 12/14/20 4:19 PM, DJM-Avalesta wrote: > "The underlying connection was closed: Could not establish trust > relationship for the SSL/TLS secure channel." >   Sounds like you should get yourself a valid X.509 certificate for your server's key... signature.asc Description: OpenPGP digital signa

Re: [libmicrohttpd] upgrading and life cycle of sockets, issue when used with epoll

2021-01-03 Thread Christian Grothoff
Hi Jose, I've figured out the issue. The bug is actually in your code. The problem is that you are using an _external_ event loop, and if you do so, you are responsible for re-triggering MHD_run() if you do anything that might change the state of an MHD connection. This (mostly) applies to MHD_r

Re: [libmicrohttpd] upgrading and life cycle of sockets, issue when used with epoll

2021-01-06 Thread Christian Grothoff
done within the scope of the MHD_run() operation. The moment you actually do such operations later based on other things in your external event loop, you will need some kind of signalling. Happy hacking! Christian On 1/5/21 10:17 AM, José Bollo wrote: > On Sun, 3 Jan 2021 14:22:25 +0100 >

Re: [libmicrohttpd] 0.9.71+ Connection Idle and Reuse Issue when Suspending and Resuming Connections

2021-01-06 Thread Christian Grothoff
Hi Damon, The problem is that your logic queues a response during the *first* callback to 'access_handler', and your 'count' protection there is not working as intended by you. You need to be a bit careful with the API, the MHD_OPTION_NOTIF_CONNECTIONCATION is per socket, while what you need for

Re: [libmicrohttpd] [EXTERNAL] Re: 0.9.71+ Connection Idle and Reuse Issue when Suspending and Resuming Connections

2021-01-07 Thread Christian Grothoff
On 1/7/21 9:58 PM, Earp, Damon N. (GSFC-619.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via libmicrohttpd wrote: > Christian, > > I've tested your version and indeed I see the expected behavior. I believe > the disconnect is my lack of knowledge of the flow requirements of the access > handler. P

Re: [libmicrohttpd] New Features: Create response from an IOVEC and Thread-safe Adding Connections to an EPoll Internal Thread MHD_Daemon

2021-01-08 Thread Christian Grothoff
Dear Damon, Dear Lawrence, This is a good place for such patches. Like Evgeny, I'm in principle in favor, but have also some "major" gripes: 1) It would be great if you could update the libmicrohttpd manual (in docs/) to document the new external API function(s). Just a few sentences explaining

Re: [libmicrohttpd] [EXTERNAL] Re: New Features: Create response from an IOVEC and Thread-safe Adding Connections to an EPoll Internal Thread MHD_Daemon

2021-01-15 Thread Christian Grothoff
On 1/15/21 10:08 AM, Evgeny Grin wrote: > > Maybe Christian have some additional comments/wishes. Nothing additional beyond your remarks from me. Happy hacking! Christian signature.asc Description: OpenPGP digital signature

Re: [libmicrohttpd] [EXTERNAL] Re: New Features: Create response from an IOVEC and Thread-safe Adding Connections to an EPoll Internal Thread MHD_Daemon

2021-01-16 Thread Christian Grothoff
or testing https, included testing a 0 > length iovec. > >> Does version 0.9.72 fix epoll without listen socket? > Yes, we were able to remove all our changes regarding queuing new > connections. Thanks! > > Thanks, > Damon Earp > > ----

Re: [libmicrohttpd] issue with post processor callback function return value?

2021-02-04 Thread Christian Grothoff
Hi Conor, I've looked through the code and found one scenario where the return value of the application callback was basically incorrectly ignored (but for others it worked correctly). This is fixed in Git master: e0669386..5782daed You can test if you have a sufficiently recent version using #

Re: [libmicrohttpd] Escaped "&" in CGI parameter

2021-02-13 Thread Christian Grothoff
Hi Josef, I suspect your main mistake might be using a very old version of libmicrohttpd ;-). I tested it with the current one, and I get this: $ cd src/examples $ ./querystring_example 8080 & $ wget -q -O - 'http://localhost:8080/?q=Cagney+%26+Lacey' libmicrohttpd demoQuery string for "q" was "

Re: [libmicrohttpd] problem in client certificate authentication example?

2021-03-02 Thread Christian Grothoff
Thanks, I've fixed the documentation in Git already. -Christian On 3/2/21 3:42 PM, folkert wrote: > Hi, > > (I've sent an e-mail about this possible problem to the maintainer > as well) > > https://www.gnu.org/software/libmicrohttpd/tutorial.html#Adding-a-layer-of-security > shows an example for

Re: [libmicrohttpd] why

2021-03-04 Thread Christian Grothoff
There are various benefits: 1) forcing the use of mmap() -- and uniform sizes for all requests -- ensures that we don't suffer from memory fragmentation, which is what would happen if we allocate lots of different-sized tiny bits based on say HTTP request headers; 2) using our per-request pool ens

[libmicrohttpd] FYI: No GSOC this year for GNU

2021-03-09 Thread Christian Grothoff
On 3/9/21 9:10 AM, Jose E. Marchesi wrote: > After participating for 12 consecutive years, for the first time ever > the GNU Project got rejected as a mentoring organization in the Google > Summer of Code 2021. > > We did not get any explanation other than: "We had many more > applications than av

Re: [libmicrohttpd] Problem with HTTP/1.1 chunked packets when connection is about to close

2021-04-27 Thread Christian Grothoff
On 4/27/21 10:41 AM, Iron Bug at gmail.com wrote: > Greetings again. > > But I take it, the chunked transfer is the only way for sending large files > that cannot/should not fit in buffer in RAM. For large files you should use MHD_create_response_from_fd_at_offset64(). That will do the right th

Re: [libmicrohttpd] not getting a keep-alive session from MHD

2021-06-28 Thread Christian Grothoff
Hi tz, You're answering too early. Try (for minimalistic test, not for good style): static enum MHD_Result answer_to_connection (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_

Re: [libmicrohttpd] Busy waiting up to one second using connection timeout

2021-08-11 Thread Christian Grothoff
Thanks for the detailed report, the patch looks good as-is, applied to master as f5d387df7e7fb8de1a5dd0739ddb83a8b19fe64b Happy hacking! Christian On 8/11/21 6:02 PM, Irion, Alexander wrote: > Hello! > > I discovered a problem with closing connections, when > MHD_OPTION_CONNECTION_TIMEOUT is u

Re: [libmicrohttpd] PATCH: Avoid unitialized variable compiler warning in digestauth.c

2021-09-03 Thread Christian Grothoff
Thanks for reporting, fixed in Git master as suggested. -Christian On 9/3/21 10:22 AM, Thorsten Brehm wrote: > Hi, > > gcc10 complains with two warnings when compiling libmicrohttpd using > > #define NDEBUG 1 > #define DAUTH_SUPPORT 1 > > so, "release build" with enabled "digest authent

Re: [libmicrohttpd] FAIL: test_tls_options

2021-09-16 Thread Christian Grothoff
I have the same gnutls version, so maybe it is the curl? I have curl 7.74 and that one passes. Maybe a curl regression? -Christian On 9/16/21 5:20 PM, muradm wrote: > > Hello, > > Building libmicrohttpd-0.9.73 under guix, and getting one test failed: > > --8<---cut here

Re: [libmicrohttpd] unexpected "Server reached connection limit." failures

2021-12-04 Thread Christian Grothoff
Hi Frank, I would first try adding/setting the timeout option for the MHD server. That might help if otherwise neither your reverse proxy nor MHD close connections and thus results them in living forever. Second you might want to check your application logic to make sure that it doesn't hold/susp

Re: [libmicrohttpd] Route lookups

2021-12-15 Thread Christian Grothoff
Libmicrohttpd doesn't include "route lookup" logic, you must implement your own. -Christian On 12/15/21 5:50 PM, Gavin Henry wrote: > Hi all, > > Does anyone have an example of how you're mapping routes/urls to > functions before I crack on with my own? > > Thanks, > Gavin. >

Re: [libmicrohttpd] Digest Authentication algorithm field case sensitivity

2022-01-17 Thread Christian Grothoff
Dear Ahmet, Thanks for the report, I've fixed this in Git master now. -Christian On 17.01.22 09:50, Ahmet Kermen wrote: > Hi All, > > Since version 0.9.62 libmicrohttpd appears to be started adding optional > "algorithm" field for digest authentication header. According to > RFC2617 https://da

Re: [libmicrohttpd] [PATCH] MHD_add_response_header: Check on passed nullptr

2022-01-28 Thread Christian Grothoff
On 1/28/22 11:08 AM, Alexander Dahl wrote: > I think this tends to be a question of design philosophy. Some developers > expect libraries to never segfault. That is something you cannot guarantee in C, basically ever. Libraries always require that they are called with correct arguments. Sure, a

Re: [libmicrohttpd] MHD_OPTION_PER_IP_CONNECTION_LIMIT behaviour behind a reverse proxy

2022-02-06 Thread Christian Grothoff
Hi Kelson, You're misreading the code, "5" is the numeric value of the option in the enum, not the actual default limit. The default limit is indeed zero as per the documentation (and a limit for zero means 'unlimited'). I think your suggestion to check against X-Forwarded-For is interesting, but

Re: [libmicrohttpd] external event loop mode without using select?

2022-02-09 Thread Christian Grothoff
If your platform supports it, you should grab the epoll FD from libmicrohttpd and only plug that single FD into your event loop, effectively cascading the two event loops. See MHD_DAEMON_INFO_EPOLL_FD for how to grab that FD. On 2/8/22 11:49 PM, Greg Stark wrote: > I have an existing event loop a

Re: [libmicrohttpd] mmap()

2022-03-10 Thread Christian Grothoff
I see two (theoretical) benefits: 1) mmap cannot result in memory fragmentation, which could be an issue with malloc(); 2) the allocations can be large-ish, which may mean that malloc() would internally fall back to mmap() anyway (of course depending on malloc() and the actual size). I'm not sure

Re: [libmicrohttpd] [PATCH] use ifdef for several HAVE header macros

2022-04-03 Thread Christian Grothoff
ipv4; > -#if HAVE_INET6 > +#ifdef HAVE_INET6 > /** > * IPv6 address. > */ > @@ -154,7 +154,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr, > return MHD_YES; >} > > -#if HAVE_INET6 > +#ifdef HAVE_INET6 >/* IPv6 addresses */ &g

Re: [libmicrohttpd] How to bind to a specific IP address "out of the box"?

2022-04-12 Thread Christian Grothoff
You can call socket/listen/bind _before_ MHD_start_daemon() and pass the ready-made fully-configured listen socket into MHD using MHD_OPTION_LISTEN_SOCKET. The 'port' argument of MHD_start_daemon() will be ignored in this case. On 4/13/22 02:28, silvioprog wrote: Hey guys. Some days ago a us

[libmicrohttpd] planned downtime

2022-05-16 Thread Christian Grothoff
Dear all, On Monday, May 23rd (2022) we will be (forced to) move git.gnunet.org and git.taler.net from Bern (CH) to Biel (CH) as the campus of BFH where we are currently hosted is closing down this summer. Even if everything works as planned, there will be some significant downtime of the Gi

[libmicrohttpd] (re-)planned downtime

2022-06-21 Thread Christian Grothoff
Dear all, After the last attempt had to be aborted because the network was not ready, we'll now be moving the Git serves on Wednesday, June 21st (2022) from Bern (CH) to Biel (CH). Even if everything works as planned, there will be some significant downtime of the Git and other co-located se

Re: [libmicrohttpd] Regarding CVE-2021-3580

2022-07-14 Thread Christian Grothoff
On 7/14/22 15:09, Mishra, Milind via libmicrohttpd wrote: Hello, The project I work on uses libmicrohttpd.so. This library in turn is dependent on libnettle6.so As per CVE-2021-3580 there was a security flaw in libnettle6 - 3.4.1-4.15.1

Re: [libmicrohttpd] websocket broadcast to all clients

2022-07-19 Thread Christian Grothoff
Dear Bill, You should use a "MHD_NotifyConnectionCallback" to be notified about when MHD is 'finished' with a connection. Then, you can insert the connection when the websocket mode is started into a data structure (usually a doubly-linked-list (DLL) is better than an array) and remove it during

Re: [libmicrohttpd] Zero copy MHD_create_response_from_callback

2022-11-17 Thread Christian Grothoff
Dear Dan, Sounds like you should be using MHD_create_response_from_iovec(). That way, you can avoid the memcpy() entirely. Happy hacking! Christian On 11/17/22 08:27, Dan Inve wrote: Hi, I'm using libmicrohttpd to respond to an HTTP request for a large amount of data (sometimes GBs) using

Re: [libmicrohttpd] Can I define variable of char array for a page in the function containing MHD_create_response_from_buffer with the flag of MHD_RESPMEM_PERSISTENT

2022-11-17 Thread Christian Grothoff
On 11/17/22 14:24, lingweicai via libmicrohttpd wrote: Hello Experts, I am developing a web tool, Can I define variable of char array for a page in the function containing MHD_create_response_from_buffer, with flag of MHD_RESPMEM_PERSISTENT? or I must use the flag of MUST_COPY ? for example:

Re: [libmicrohttpd] Zero copy MHD_create_response_from_callback

2022-11-18 Thread Christian Grothoff
On 11/17/22 20:34, Dan Inve wrote: Hi Christian, Sounds like you should be using MHD_create_response_from_iovec(). That way, you can avoid the memcpy() entirely. I took a look at MHD_create_response_from_iovec, but I'm not sure if that works for my circumstance because it doesn't use a cal

Re: [libmicrohttpd] Change reason phrase

2022-12-05 Thread Christian Grothoff
Only by changing the source code and recompiling MHD. But you should not do this, this is a very bad idea. You should stick to the standard messages of the HTTP protocol. If you need to convey additional information, do it in the body or in a header; try to use HTTP status codes narrowly to wha

Re: [libmicrohttpd] Change reason phrase

2022-12-05 Thread Christian Grothoff
Well, the RFC says that the client SHOULD ignore it. Yes, the server MAY change it, but to rely on it doesn't create a robust protocol: For example, by my reading, HTTP (reverse) proxies between client and server MAY change the message... So yes, having the 'wrong' message technically doesn't

Re: [libmicrohttpd] Any suggestion on HTML Template to be an interface with microhttpd ?

2022-12-06 Thread Christian Grothoff
Hi Forrest, For GNU Taler, we are using mustach, which works well: https://mustache.github.io/ Happy hacking! Christian On 12/7/22 04:43, lingweicai via libmicrohttpd wrote: Dear All, I am developing a web tool with microhttpd for systems control. I am using Bootstrap 5 (CSS) and some javas

Re: [libmicrohttpd] How to implement gnutls session resumption in libmicrohttpd

2022-12-24 Thread Christian Grothoff
Dear Jimmy, I've not tested this, but I believe this should work: - create a key using gnutls_session_ticket_key_generate - register a MHD_NotifyConnectionCallback using MHD_OPTION_NOTIFY_CONNECTION - inside that callback, use MHD_get_connection_info with MHD_CONNECTION_INFO_GNUTLS_SESSION to g

Re: [libmicrohttpd] "Mongoose (C)" URL update on "GNU Libmicrohttpd" page

2023-01-11 Thread Christian Grothoff
Sure, link updated. -Christian On 1/11/23 18:17, Toly Lebedev via libmicrohttpd wrote: Hello. The "GNU Libmicrohttpd" page at https://www.gnu.org/software/libmicrohttpd/ contain an old URL for the "Mongoose (C) " referring to the obsolete https://code.googl

[libmicrohttpd] GNU libmicrohttpd 0.9.76 released

2023-02-27 Thread Christian Grothoff
Dear all, I've just released GNU libmicrohttpd 0.9.76 with just one small change that fixes a security problem in the MHD_PostProcessor where malformed inputs can be used to crash the server (for denial-of-service). While the bug is not believed to be exploitable in other ways and only applies

Re: [libmicrohttpd] Segfault

2023-03-03 Thread Christian Grothoff
Remove MHD_OPTION_NOTIFY_COMPLETED --- or pass two extra arguments with the function and closure you want MHD to call upon completion. Right now, you're telling MHD to jump to a bad address upon connection completion. On 3/3/23 15:02, klemens wrote: Hi all, I have an issue with a segfault I

Re: [libmicrohttpd] MHD_queue_response return error

2023-05-22 Thread Christian Grothoff
Yes, you MUST NOT queue a response while *upload_data_size is non-null when you are being called (as the upload may still continue)! MHD will call you one "final" time with a zero *upload_data_size, and *then* you should queue your response. To summarize, you MAY queue a response either: 1) on

Re: [libmicrohttpd] Broken link

2023-06-23 Thread Christian Grothoff
Hi! Thanks for reporting! I'd love to fix this (actually, did fix it locally), but somehow Debian broke CVS/RSH, so I cannot commit to the savannah CVS right now. :-(. Will fix if/when Debian unbreaks CVS... Happy hacking! Christian On 6/23/23 00:48, Aman Grewal wrote: On https://www.gnu.or

Re: [libmicrohttpd] Terminate session with response

2023-08-31 Thread Christian Grothoff
Dea Avner, I assume you are talking about a file *upload*, from the client to your HTTP server. In this case, the HTTP protocol only allows you to queue a response either before the upload has started (after receiving the header and before the server responds with 100 continue) or after the u

Re: [libmicrohttpd] Build failure with Link-Time Optimization

2023-12-27 Thread Christian Grothoff
I think it might be helpful if you could share the *exact* compiler invocation (make V=1) and error message you are getting... On 12/27/23 11:38, Sergey Sudnitsyn wrote: Thank you. I don't know what's so special about my setup - I am getting the same error with GCC 12 & 13 - compiling for both

Re: [libmicrohttpd] Build failure with Link-Time Optimization

2023-12-31 Thread Christian Grothoff
er_offset >= need_to_free)       |          ^ compilation terminated due to -Wfatal-errors. lto1: all warnings being treated as errors On Thu, 28 Dec 2023 at 06:26, Christian Grothoff <mailto:groth...@gnunet.org>> wrote: I think it might be helpful if you could share the *exact*

Re: [libmicrohttpd] [PATCH] Correct macro names when building without messages

2024-02-04 Thread Christian Grothoff
Thanks, patch applied to Git Master. -Christian On 2/4/24 01:00, Jan Palus wrote: small typo likely from copy&paste causing macro names to be different between builds with and without messages resulting in compilation failure if configured with --disable-messages Signed-off-by: Jan Palus ---

<    1   2   3   4   5   6   7   8   9   >