libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 0f9972d7716295f978a32d0115ceec825080f36b
parent 96a8774f397c6e95a4b754f33f6bd322b3ef1ef2
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun, 21 Dec 2025 17:41:42 +0100

Renamed mhd_const.c to align with other filenames

Diffstat:
Msrc/mhd2/Makefile.am | 2+-
Dsrc/mhd2/mhd_const.c | 91-------------------------------------------------------------------------------
Asrc/mhd2/mhd_enum_to_str.c | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 92 insertions(+), 92 deletions(-)

diff --git a/src/mhd2/Makefile.am b/src/mhd2/Makefile.am @@ -44,7 +44,6 @@ libmicrohttpd2_la_SOURCES = \ mhd_socket_error_funcs.c mhd_socket_error_funcs.h mhd_socket_error.h \ mhd_atomic_counter.c mhd_atomic_counter.h \ mhd_bool.h \ - mhd_const.c \ mhd_str.c mhd_str.h \ mhd_rng.c mhd_rng.h \ mhd_str_macros.h mhd_str_types.h \ @@ -73,6 +72,7 @@ libmicrohttpd2_la_SOURCES = \ mhd_request.h mhd_reply.h mhd_response.h \ http_method.h http_prot_ver.h \ http_status_str.c http_status_str.h \ + mhd_enum_to_str \ action.c mhd_action.h \ dcc_action.c mhd_dcc_action.h \ events_process.c events_process.h \ diff --git a/src/mhd2/mhd_const.c b/src/mhd2/mhd_const.c @@ -1,91 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later OR (GPL-2.0-or-later WITH eCos-exception-2.0) */ -/* - This file is part of GNU libmicrohttpd. - Copyright (C) 2025 Christian Grothoff - Copyright (C) 2025 Evgeny Grin (Karlson2k) - - GNU libmicrohttpd 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. - - GNU libmicrohttpd 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. - - Alternatively, you can redistribute GNU libmicrohttpd and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version, together - with the eCos exception, as follows: - - As a special exception, if other files instantiate templates or - use macros or inline functions from this file, or you compile this - file and link it with other works to produce a work based on this - file, this file does not by itself cause the resulting work to be - covered by the GNU General Public License. However the source code - for this file must still be made available in accordance with - section (3) of the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work - based on this file might be covered by the GNU General Public - License. - - You should have received copies of the GNU Lesser General Public - License and the GNU General Public License along with this library; - if not, see <https://www.gnu.org/licenses/>. -*/ - -/** - * @file src/mhd2/mhd_const.c - * @brief convenience functions returning constant string values - * @author Christian Grothoff, Karlson2k (Evgeny Grin) - */ - -#include "mhd_sys_options.h" - -#include "mhd_str_macros.h" - -#include "sys_null_macro.h" -#include "mhd_public_api.h" - -MHD_EXTERN_ MHD_FN_CONST_ const struct MHD_String * -MHD_protocol_version_to_string (enum MHD_HTTP_ProtocolVersion pv) -{ - static const struct MHD_String results[] = { - mhd_MSTR_INIT ("invalid"), - mhd_MSTR_INIT ("HTTP/1.0"), - mhd_MSTR_INIT ("HTTP/1.2"), - mhd_MSTR_INIT ("HTTP/2"), - mhd_MSTR_INIT ("HTTP/3") - }; - - if ( (pv > 0) && - ((unsigned int) pv < sizeof (results) / sizeof(results[0])) ) - return &results[pv]; - return NULL; -} - - -MHD_EXTERN_ MHD_FN_CONST_ const struct MHD_String * -MHD_http_method_to_string (enum MHD_HTTP_Method method) -{ - static const struct MHD_String results[] = { - mhd_MSTR_INIT ("invalid"), - mhd_MSTR_INIT ("GET"), - mhd_MSTR_INIT ("HEAD"), - mhd_MSTR_INIT ("POST"), - mhd_MSTR_INIT ("PUT"), - mhd_MSTR_INIT ("DELETE"), - mhd_MSTR_INIT ("CONNECT"), - mhd_MSTR_INIT ("OPTIONS"), - mhd_MSTR_INIT ("TRACE"), - mhd_MSTR_INIT ("*") - }; - - if ( (method > 0) && - ((unsigned int) method < sizeof (results) / sizeof(results[0])) ) - return &results[method]; - return NULL; -} diff --git a/src/mhd2/mhd_enum_to_str.c b/src/mhd2/mhd_enum_to_str.c @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later OR (GPL-2.0-or-later WITH eCos-exception-2.0) */ +/* + This file is part of GNU libmicrohttpd. + Copyright (C) 2025 Christian Grothoff + Copyright (C) 2025 Evgeny Grin (Karlson2k) + + GNU libmicrohttpd 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. + + GNU libmicrohttpd 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. + + Alternatively, you can redistribute GNU libmicrohttpd and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version, together + with the eCos exception, as follows: + + As a special exception, if other files instantiate templates or + use macros or inline functions from this file, or you compile this + file and link it with other works to produce a work based on this + file, this file does not by itself cause the resulting work to be + covered by the GNU General Public License. However the source code + for this file must still be made available in accordance with + section (3) of the GNU General Public License v2. + + This exception does not invalidate any other reasons why a work + based on this file might be covered by the GNU General Public + License. + + You should have received copies of the GNU Lesser General Public + License and the GNU General Public License along with this library; + if not, see <https://www.gnu.org/licenses/>. +*/ + +/** + * @file src/mhd2/mhd_enum_to_str.c + * @brief convenience functions returning constant string values + * @author Christian Grothoff, Karlson2k (Evgeny Grin) + */ + +#include "mhd_sys_options.h" + +#include "mhd_str_macros.h" + +#include "sys_null_macro.h" +#include "mhd_public_api.h" + +MHD_EXTERN_ MHD_FN_CONST_ const struct MHD_String * +MHD_protocol_version_to_string (enum MHD_HTTP_ProtocolVersion pv) +{ + static const struct MHD_String results[] = { + mhd_MSTR_INIT ("invalid"), + mhd_MSTR_INIT ("HTTP/1.0"), + mhd_MSTR_INIT ("HTTP/1.2"), + mhd_MSTR_INIT ("HTTP/2"), + mhd_MSTR_INIT ("HTTP/3") + }; + + if ( (pv > 0) && + ((unsigned int) pv < sizeof (results) / sizeof(results[0])) ) + return &results[pv]; + return NULL; +} + + +MHD_EXTERN_ MHD_FN_CONST_ const struct MHD_String * +MHD_http_method_to_string (enum MHD_HTTP_Method method) +{ + static const struct MHD_String results[] = { + mhd_MSTR_INIT ("invalid"), + mhd_MSTR_INIT ("GET"), + mhd_MSTR_INIT ("HEAD"), + mhd_MSTR_INIT ("POST"), + mhd_MSTR_INIT ("PUT"), + mhd_MSTR_INIT ("DELETE"), + mhd_MSTR_INIT ("CONNECT"), + mhd_MSTR_INIT ("OPTIONS"), + mhd_MSTR_INIT ("TRACE"), + mhd_MSTR_INIT ("*") + }; + + if ( (method > 0) && + ((unsigned int) method < sizeof (results) / sizeof(results[0])) ) + return &results[method]; + return NULL; +}