Done. Attached the entire file. :-)

It was applied in my fork too: https://gitlab.com/silvioprog/libmicrohttpd/
commit/2660ba6a163ad485aecd45b1f61d77ad32417061 . (I'm checking how to
create pull-requests in GitLab platform ...)

(anyway I need to check why my git generates broken patches ... :-/ )

On Sun, Feb 26, 2017 at 6:32 PM, silvioprog <[email protected]> wrote:

> Strange, I got same problem here. I've generated it using command git
> format-patch HEAD^ in the root MHD directory, anyway I'm going to send
> the entire file ...
>
> On Sun, Feb 26, 2017 at 6:19 PM, Christian Grothoff <[email protected]>
> wrote:
>
>> Actually, we must, according to the GNU maintainer guide (it was an
>> oversight of not putting a header in the first place).  But the patch
>> didn't apply cleanly here, that's why I didn't yet do it...
>>
>> On 02/26/2017 09:44 PM, Evgeny Grin wrote:
>> > Christian,
>> >
>> > It's up to you to change/add copyright lines.
>> > I'm OK with this change.
>>
>
> --
> Silvio Clécio
>

-- 
Silvio Clécio
/*
     This file is part of libmicrohttpd
     Copyright (C) 2016, 2017 Christian Grothoff,
     Silvio Clecio (silvioprog), Karlson2k (Evgeny Grin)

     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     License as published by the Free Software Foundation; either
     version 2.1 of the License, or (at your option) any later version.

     This library is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Lesser General Public License for more details.

     You should have received a copy of the GNU Lesser General Public
     License along with this library; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/
/**
 * @file timeout.c
 * @brief example for how to use libmicrohttpd request timeout
 * @author Christian Grothoff, Silvio Clecio (silvioprog), Karlson2k (Evgeny Grin)
 */

#include <microhttpd.h>
#include <stdio.h>
#include <string.h>

#define PORT 8080

static int
answer_to_connection(void *cls,
                     struct MHD_Connection *connection,
                     const char *url,
                     const char *method,
                     const char *version,
                     const char *upload_data,
                     size_t *upload_data_size,
                     void **con_cls)
{
  const char *page = "<html><body>Hello timeout!</body></html>";
  struct MHD_Response *response;
  int ret;

  response = MHD_create_response_from_buffer (strlen(page),
                                              (void *) page,
                                              MHD_RESPMEM_PERSISTENT);
  MHD_add_response_header (response,
                           MHD_HTTP_HEADER_CONTENT_TYPE,
                           "text/html");
  ret = MHD_queue_response (connection,
                            MHD_HTTP_OK,
                            response);
  MHD_destroy_response(response);
  return ret;
}


int
main (int argc,
      char **argv)
{
  struct MHD_Daemon *daemon;

  daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD,
                             PORT,
                             NULL, NULL,
                             &answer_to_connection, NULL,
                             /* 3 seconds */
                             MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 3,
                             MHD_OPTION_END);
  if (NULL == daemon)
    return 1;
  getchar();
  MHD_stop_daemon(daemon);
  return 0;
}

Reply via email to