libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 223013b2e70dfcf4f2fe529224fec10ee5272aa2
parent b1fff186c5cc039a86febe7d2fa7e24c61b68c60
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Wed, 18 May 2022 12:07:26 +0300

Created basicauth.h header

Diffstat:
Msrc/microhttpd/Makefile.am | 2+-
Msrc/microhttpd/basicauth.c | 14++++++--------
Asrc/microhttpd/basicauth.h | 38++++++++++++++++++++++++++++++++++++++
Mw32/common/libmicrohttpd-files.vcxproj | 1+
Mw32/common/libmicrohttpd-filters.vcxproj | 3+++
5 files changed, 49 insertions(+), 9 deletions(-)

diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am @@ -171,7 +171,7 @@ endif if ENABLE_BAUTH libmicrohttpd_la_SOURCES += \ - basicauth.c \ + basicauth.c basicauth.h \ base64.c base64.h endif diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c @@ -1,6 +1,7 @@ /* This file is part of libmicrohttpd Copyright (C) 2010, 2011, 2012 Daniel Pittman and Christian Grothoff + Copyright (C) 2014-2022 Evgeny Grin (Karlson2k) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -21,18 +22,15 @@ * @brief Implements HTTP basic authentication methods * @author Amr Ali * @author Matthieu Speder + * @author Karlson2k (Evgeny Grin) */ +#include "basicauth.h" #include "platform.h" #include "mhd_limits.h" #include "internal.h" #include "base64.h" #include "mhd_compat.h" -/** - * Beginning string for any valid Basic authentication header. - */ -#define _BASIC_BASE "Basic " - /** * Get the username and password from the basic authorization header sent by the client @@ -60,10 +58,10 @@ MHD_basic_auth_get_username_password (struct MHD_Connection *connection, &header, NULL)) || (0 != strncmp (header, - _BASIC_BASE, - MHD_STATICSTR_LEN_ (_BASIC_BASE))) ) + _MHD_AUTH_BASIC_BASE, + MHD_STATICSTR_LEN_ (_MHD_AUTH_BASIC_BASE))) ) return NULL; - header += MHD_STATICSTR_LEN_ (_BASIC_BASE); + header += MHD_STATICSTR_LEN_ (_MHD_AUTH_BASIC_BASE); if (NULL == (decode = BASE64Decode (header))) { #ifdef HAVE_MESSAGES diff --git a/src/microhttpd/basicauth.h b/src/microhttpd/basicauth.h @@ -0,0 +1,38 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010, 2011, 2012 Daniel Pittman and Christian Grothoff + Copyright (C) 2014-2022 Evgeny Grin (Karlson2k) + + 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 basicauth.c + * @brief Implements HTTP basic authentication methods + * @author Amr Ali + * @author Matthieu Speder + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_BASICAUTH_H +#define MHD_BASICAUTH_H 1 + +/** + * Beginning string for any valid Basic authentication header. + */ +#define _MHD_AUTH_BASIC_BASE "Basic " + +#endif /* ! MHD_BASICAUTH_H */ + +/* end of basicauth.h */ diff --git a/w32/common/libmicrohttpd-files.vcxproj b/w32/common/libmicrohttpd-files.vcxproj @@ -32,6 +32,7 @@ <ClInclude Include="$(MhdSrc)include\mhd_options.h" /> <ClInclude Include="$(MhdSrc)include\platform.h" /> <ClInclude Include="$(MhdSrc)microhttpd\base64.h" /> + <ClInclude Include="$(MhdSrc)microhttpd\basicauth.h" /> <ClInclude Include="$(MhdSrc)microhttpd\connection.h" /> <ClInclude Include="$(MhdSrc)microhttpd\internal.h" /> <ClInclude Include="$(MhdSrc)microhttpd\md5.h" /> diff --git a/w32/common/libmicrohttpd-filters.vcxproj b/w32/common/libmicrohttpd-filters.vcxproj @@ -43,6 +43,9 @@ <ClInclude Include="$(MhdSrc)microhttpd\base64.h"> <Filter>Internal Headers</Filter> </ClInclude> + <ClInclude Include="$(MhdSrc)microhttpd\basicauth.h"> + <Filter>Internal Headers</Filter> + </ClInclude> <ClInclude Include="$(MhdSrc)microhttpd\connection.h"> <Filter>Internal Headers</Filter> </ClInclude>