gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 01/02: introduce new MHD_CONNECTION_INFO_HTTP_STATUS


From: gnunet
Subject: [libmicrohttpd] 01/02: introduce new MHD_CONNECTION_INFO_HTTP_STATUS
Date: Wed, 04 Aug 2021 19:10:51 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository libmicrohttpd.

commit f1f8851cd2c297d228617d5fc0f92be509ffe66a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Aug 4 18:58:55 2021 +0200

    introduce new MHD_CONNECTION_INFO_HTTP_STATUS
---
 ChangeLog                   |  3 +++
 doc/libmicrohttpd.texi      |  6 ++++++
 src/include/microhttpd.h    | 20 ++++++++++++++++----
 src/microhttpd/connection.c |  8 +++++++-
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 020711bc..728cd156 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Wed 04 Aug 2021 06:56:52 PM CEST
+    Introduce new MHD_CONNECTION_INFO_HTTP_STATUS. -CG
+
 Mon 26 Apr 2021 02:09:46 PM CEST
     Importing experimental Websocket support by David Gausmann. -CG
 
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index bb6cab7c..d829923b 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -3159,6 +3159,12 @@ to the access handler.
 
 Takes no extra arguments.
 
+@index MHD_CONNECTION_INFO_HTTP_STATUS
+Returns the HTTP status code of the response that was
+queued. Returns NULL if no response was queued yet.
+
+Takes no extra arguments.
+
 @end table
 @end deftp
 
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 7dcfd275..f4232ae5 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1,6 +1,6 @@
 /*
      This file is part of libmicrohttpd
-     Copyright (C) 2006--2020 Christian Grothoff (and other contributing 
authors)
+     Copyright (C) 2006-2021 Christian Grothoff (and other contributing 
authors)
      Copyright (C) 2015-2021 Evgeny Grin (Karlson2k)
 
      This library is free software; you can redistribute it and/or
@@ -131,7 +131,7 @@ typedef intptr_t ssize_t;
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097302
+#define MHD_VERSION 0x00097303
 
 
 #ifdef __has_attribute
@@ -139,7 +139,7 @@ typedef intptr_t ssize_t;
 #define _MHD_FLAGS_ENUM __attribute__((flag_enum))
 #endif /* flag_enum */
 #if __has_attribute (enum_extensibility)
-#define _MHD_FIXED_ENUM __attribute__((enum_extensibility(closed)))
+#define _MHD_FIXED_ENUM __attribute__((enum_extensibility (closed)))
 #endif /* enum_extensibility */
 #endif /* __has_attribute */
 
@@ -1980,6 +1980,11 @@ union MHD_ConnectionInfo
    */
   unsigned int connection_timeout;
 
+  /**
+   * HTTP status queued with the response, for 
#MHD_CONNECTION_INFO_HTTP_STATUS.
+   */
+  unsigned int http_status;
+
   /**
    * Connect socket
    */
@@ -2121,7 +2126,14 @@ enum MHD_ConnectionInfoType
    * Return length of the client's HTTP request header.
    * @ingroup request
    */
-  MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE
+  MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE,
+
+  /**
+   * Return HTTP status queued with the response. NULL
+   * if no HTTP response has been queued yet.
+   */
+  MHD_CONNECTION_INFO_HTTP_STATUS
+
 } _MHD_FIXED_ENUM;
 
 
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 12e5739d..b2d285e3 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1389,6 +1389,7 @@ connection_shrink_read_buffer (struct MHD_Connection 
*connection)
   new_buf = MHD_pool_reallocate (c->pool, c->read_buffer, c->read_buffer_size,
                                  c->read_buffer_offset);
   mhd_assert (c->read_buffer == new_buf);
+  (void) new_buf; /* squash compiler warning */
   c->read_buffer_size = c->read_buffer_offset;
   if (0 == c->read_buffer_size)
     c->read_buffer = NULL;
@@ -1463,6 +1464,7 @@ connection_shrink_write_buffer (struct MHD_Connection 
*connection)
   new_buf = MHD_pool_reallocate (pool, c->write_buffer, c->write_buffer_size,
                                  c->write_buffer_append_offset);
   mhd_assert (c->write_buffer == new_buf);
+  (void) new_buf; /* squash compiler warning */
   c->write_buffer_size = c->write_buffer_append_offset;
 }
 
@@ -2008,7 +2010,7 @@ transmit_error_response_len (struct MHD_Connection 
*connection,
  * Transmit static string as error response
  */
 #define transmit_error_response_static(c, code, msg) \
-  transmit_error_response_len (c, code, msg, MHD_STATICSTR_LEN_(msg))
+  transmit_error_response_len (c, code, msg, MHD_STATICSTR_LEN_ (msg))
 
 /**
  * Update the 'event_loop_info' field of this connection based on the state
@@ -4443,6 +4445,10 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
          (MHD_CONNECTION_CLOSED == connection->state) )
       return NULL;   /* invalid, too early! */
     return (const union MHD_ConnectionInfo *) &connection->header_size;
+  case MHD_CONNECTION_INFO_HTTP_STATUS:
+    if (NULL == connection->response)
+      return NULL;
+    return (const union MHD_ConnectionInfo *) &connection->responseCode;
   default:
     return NULL;
   }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]