Commit Graph
1614 Commits
Author SHA1 Message Date
Christian Grothoff 689d2dc98d -comment on data types 2015-06-02 08:07:49 +00:00
Christian Grothoff b7ab035907 -fix warning 2015-05-30 19:32:27 +00:00
Christian Grothoff aecadc41d2 -version bump 2015-05-29 10:21:43 +00:00
Christian Grothoff f2f5b55550 fix digest authentication with escaped urls, as reported on mailinglist 2015-05-29 10:20:53 +00:00
Christian Grothoff dd80b6137d bump 2015-05-18 21:18:26 +00:00
Christian Grothoff c549988da8 fix typo (#3789) 2015-05-16 19:08:50 +00:00
Christian Grothoff a67363392b From ML:
Hey,

I'm debugging a problem with a crash in MHD_select_thread.  We had
MHD_start_daemon_va fail while creating worker threads with the following
error: "file descriptor for worker control pipe exceeds maximum value".  We
know what caused this error and are fixing it.  But the problem was that a
MHD_select_thread worker thread was left running in the background after
MHD_start_daemon_va returned failure.  I think the problem is from this
code in the thread_failed case in daemon.c:

  /* Shutdown worker threads we've already created. Pretend
     as though we had fully initialized our daemon, but
     with a smaller number of threads than had been
     requested. */
  daemon->worker_pool_size = i - 1;
  MHD_stop_daemon (daemon);
  return NULL;

From the code, it looks like "i" is actually the number of threads that
were successfully created, so the "i - 1" in this code will leave an extra
thread hanging since MHD_stop_daemon will clean up one less thread than it
should.  I'll probably try to work up a test to verify removing the "- 1"
is correct, but that could take me some time so I wanted to make sure I
wasn't missing something obvious before heading down that path.

~JareD

He is right, this patch fixes it.
2015-05-13 09:35:33 +00:00
Evgeny Grin (Karlson2k) 9452c700f2 fix: gnutls_certificate_set_x509_key_mem2 was actually added in GnuTLS 3.1.11 2015-05-07 18:20:38 +00:00
Evgeny Grin (Karlson2k) 5e7f4c65f4 update ChangeLog 2015-05-07 17:09:29 +00:00
Evgeny Grin (Karlson2k) 5758ff1992 microhttpd.h: bump MHD_VERSION 2015-05-07 17:04:52 +00:00
Evgeny Grin (Karlson2k) 16fc241e3c w32 VS project: add support for build for XP, internally optimize project files 2015-05-07 17:04:45 +00:00
Evgeny Grin (Karlson2k) 6092a01a48 tests: replace '#ifdefs' with 'MHD_is_feature_supported()' 2015-05-07 17:04:37 +00:00
Evgeny Grin (Karlson2k) 611597070c configure: add support for "--enable-poll"
Conflicts:
	configure.ac
2015-05-07 17:04:27 +00:00
Evgeny Grin (Karlson2k) b44ee80556 Define and use system-independent wrapper macro for poll() 2015-05-07 17:04:22 +00:00
Evgeny Grin (Karlson2k) cb83913d0e Check for poll() function, use HAVE_POLL macro 2015-05-07 17:04:10 +00:00
Evgeny Grin (Karlson2k) 3593a519b7 Replace variable-sized array with malloc()/free() 2015-05-07 17:04:02 +00:00
Evgeny Grin (Karlson2k) 633e5a1108 daemon.c: fix typos 2015-05-07 17:03:55 +00:00
Christian Grothoff b27bee6e17 fix #3784 2015-05-06 16:05:43 +00:00
Christian Grothoff 4d24fb764b -version bumping 2015-04-29 22:09:21 +00:00
Christian Grothoff cff0854d51 if we actually resumed a connection, the following call to select()/poll()/epoll() must always be non-blocking 2015-04-29 22:05:15 +00:00
Christian Grothoff 63eb8917e7 -doxygen, indentation, bracketing, no semantic changes 2015-04-28 22:45:47 +00:00
LRN 663d2dea11 Make libplatform_interface.la a dependency where appropriate
Trying to fix this buildslave error:
make[3]: *** No rule to make target '../../src/platform/libplatform_interface.la', needed by 'libmicrohttpd.la'.  Stop.
2015-04-21 18:13:46 +00:00
Christian Grothoff c9ad7cda51 -instant timeout on connection hitting cleanup 2015-04-17 15:56:47 +00:00
Christian Grothoff 1a11c2c680 fix #3753 2015-04-15 01:19:44 +00:00
Christian Grothoff 639bfd972d fix #3752: linker issues on solaris 2015-04-14 22:49:27 +00:00
Christian Grothoff b86f93acaf HI,
The MHD goes in a busy loop when it is configured with MHD_USE_POLL_INTERNALLY and a connection times out.
When the connection times out, the connection is closed at connection.c:2646, which sets connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP.
When the loop info is set to MHD_EVENT_LOOP_INFO_CLEANUP, the main function of the thread loop, MHD_poll_all, never calls back the connection idle callback, which would have cleaned the connection and exit the loop.
I resolved the issue in my development code by adding pos->idle_handler (pos) at daemon.c:2477 in MHD_poll_all (SVN 35533).

The busy loop could be tested using a small enough connection timeout and netcat:
nc -v -w 100 <IP ADDRESS> <IP PORT>

CPU usage will reach 100% in one of the CPU and will remain at that level even when the netcat has closed its end of the connection.

Thanks,

Louis Benoit
2015-04-14 22:34:15 +00:00
Christian Grothoff 4837ce0471 -bump 2015-04-12 19:52:44 +00:00
Christian Grothoff 10a27715a5 Adding "testcase" (demo_https) and a fix. -CG
Hi,

I am doing test with HTTPS at low bit rate for large files using:
wget -v --no-check-certificate --limit-rate=1000 https://....

When the MHD daemon is configured with MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY, I noticed that the thread takes 100% CPU, whereas
the MHD_USE_POLL_INTERNALLY configuration show a normal CPU usage.

Adding logs I see that the busy loops takes place at daemon.c, line 2605 (0.9.38):
daemon->eready_tail never gets NULL most probably due to connection.c, line 2671 to 2721

Thanks,

Louis
2015-04-12 19:52:29 +00:00
Christian Grothoff 4d6fb01f8e -fix indent 2015-04-12 19:19:11 +00:00
Christian Grothoff 9e9af3728c The issue reported below is correct, the fix is not. The "!=" comparing the RF flag should simply have been "==".
Louis wrote:

There is a change of behavior between 0.9.37 and 0.9.38.
When a client adds a "Connection: close" header in 0.9.37, MHD adds a "Connection: close" header to its response and then 
close the connection (as suggested in rfc2616, section 8.1.2.1).
The "Connection: close" header is not added in 0.9.38.
I looked into the 0.9.38 code and the code that prevents the inclusion of the "Connection: close" header is at line 773 of connection.c.
 if ( ( (NULL != client_requested_close) ||
 (MHD_YES == connection->read_closed) ) &&
 (NULL == response_has_close) &&
 (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
 must_add_close = MHD_YES;

Shouldn't it read
 if ( ( (NULL != client_requested_close) ||
 (MHD_YES == connection->read_closed) ||
 (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) &&
 (NULL == response_has_close) )
 must_add_close = MHD_YES;

Thanks,

Louis Benoit
2015-04-10 20:05:40 +00:00
Christian Grothoff 84f0be5c24 Fixed a few c/p errors and removed not related changes.
Can't test POLL mode as MHD didn't support POLL on W32. The reason - winsock implementation is somehow different from POSIX one. libcurl initially added poll support for win32 but later it was removed. I didn't check specific reason so for safety MHD didn't use POLL on W32. However I leave changes for POLL code "as is" in case that we will add support for POLL on win32.
SELECT mode now works perfectly. Shutdown processed without any delay.

May be some comments will be good addition. 
Patch is attached.

--
Evgeny


09.04.2015, 17:28, "Christian Grothoff" <christian@grothoff.org>:
> Hi Evgeny,
>
> I've tried to put together a patch for the issue, but as I'm on
> GNU/Linux, I cannot even test if the patch compiles...  Please let me
> know if it works (and please test with POLL and SELECT separately), at
> least in principle I think this is roughly what the patch should look
> like...
>
> Happy hacking!
>
> Christian
>
> On 04/09/2015 03:25 PM, Evgeny Grin wrote:
>>  If HAVE_LISTEN_SHUTDOWN is not defined (as on win32), pipe is used
>>  automatically.
>>  But pipe is monitored only in main "select()" thread. It's not
>>  monitored in "connection" thread.
>>
>>  Best Wishes,
>>  Evgeny Grin
>>
>>  On 04/09/2015 12:56 PM, Evgeny Grin wrote:
>>>  Hi Christian!
>>>
>>>  Another issue on win32, 100% reproducible.
>>>  When running Kodi unittests, MHD always takes 120 seconds to shutdown.
>>>
>>>  How to reproduce:
>>>  * Start MHD with THREAD_PER_CONNECTION | DEBUG and some static
>>  response,
>>>  * Generate one http 1.1 request with libcurl. Notice that libcurl
>>  always add keep-alive for http 1.1.
>>>  * Let MHD to process request and answer with response.
>>>  * MHD will stay with master thread and one connection thread waiting
>>  for additional requests from same client.
>>>  * Call MHD shutdown. Main thread will shutdown all sockets, but
>>  additional connection thread will stay at MHD_sys_select_ and will get
>>  notification about socket shutdown only after 2 minutes. May be it's
>>  after libcurl will close connection.
>>>  Again - have no idea how to fix it properly. Use pair of sockets
>>  (emulated pipe) for each connection thread? Add daemon pipe FD to
>>  select() in connection thread?
2015-04-09 22:43:05 +00:00
Christian Grothoff d8ac6fd245 -bump 2015-04-09 07:04:08 +00:00
Christian Grothoff 086ba366b7 Hi all,
I was trying to use MHD_suspend_connection() and MHD_resume_connection() to implement long polling on a request. I am using options MHD_USE_SELECT_INTERNALLY and MHD_USE_POLL options. I noticed the server thread went to 100% CPU after the first MHD_resume_connection() call. Looking at the code in MHD_poll_all() I can see that the file descriptor from daemon->wpipe[0] gets inserted into the list of file descriptors to poll but this file descriptor is never read so every time this function is called it returns immediately. The code works fine if I drop to using just MHD_USE_SELECT_INTERNALLY.

The patch below fixes the problem.

Regards,
Denis
2015-04-09 07:03:26 +00:00
Christian Grothoff 741ca49079 -space 2015-04-07 23:57:13 +00:00
Christian Grothoff 9273b46d54 -disable this test on w32 2015-04-06 22:20:12 +00:00
Christian Grothoff f88e041ca0 tolerate TLS 1.1 / 1.2 disagreement 2015-04-06 22:18:40 +00:00
Christian Grothoff 334974b4b1 fix multi-threaded shutdown deadlock issue 2015-04-04 16:30:00 +00:00
Christian Grothoff 6d68b2d3af -minor test cleanup 2015-04-04 16:28:34 +00:00
Christian Grothoff f7c167cd0c -indentation, bracketing 2015-04-04 16:21:43 +00:00
Christian Grothoff 912db236f2 -fix indentation 2015-04-04 16:08:52 +00:00
Christian Grothoff f633852048 -fix minor type issue, and minor logging issue 2015-04-04 16:06:57 +00:00
Christian Grothoff 47c6b68006 fix thread-pool connection-limit shutdown issue, adding testcase 2015-04-04 15:50:15 +00:00
Christian Grothoff 7d1a24e754 fixing https testcases that require SSL3, but SSL3 is dead and with modern gnutls not even supported 2015-04-03 17:36:25 +00:00
Evgeny Grin (Karlson2k) 7c7af4340f Add MHD_FEATURE_HTTPS_KEY_PASSWORD 2015-04-03 13:03:19 +00:00
Christian Grothoff 570042a100 fix #3751 2015-04-03 10:29:12 +00:00
Christian Grothoff a05803df4f Robert Gronenberg wrote:
I am using libmicrohttpd in a multithreaded application in the
thread-per-connection mode. In order to maintain statistics and such on
the various clients, the application should be notified about
connections being started and stopped. Something like the
MHD_OPTION_NOTIFY_COMPLETED for requests, but then for connections. As
far as I could find libmicrohttpd does not (yet) provide that functionality.

Attached is a patch that does add this functionality by registering a
connection notification callback function: MHD_OPTION_NOTIFY_CONNECTION
(inspired by the MHD_OPTION_NOTIFY_COMPLETED option).

Could this be included in libmicrohttpd?

=>

The patch was only working for multithreaded apps, so I adjusted it
to cover other threading models, fixed a merge issue and added the
ability to associate a void* with the callbacks (and obtain it via
MHD connection info).  And I updated the manual & ChangeLog. Now
I think it can be included ;-).
2015-03-31 08:38:33 +00:00
Christian Grothoff 5fe98c7529 add MHD_HTTP_METHOD_PATCH for Martin 2015-03-27 13:56:20 +00:00
Christian Grothoff ece12fee55 -version bump 2015-03-27 13:56:07 +00:00
Christian Grothoff fbaeed35ad gnutls_certificate_set_x509_key_mem2 was actually introduced in 3.1 2015-03-23 20:18:57 +00:00
Evgeny Grin (Karlson2k) 80e6a8f3d0 configure.ac: add support for GnuTLS pkg-config 2015-03-13 11:18:48 +00:00