libmicrohttpd

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

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

Created digestauth.h header

Diffstat:
Msrc/microhttpd/Makefile.am | 2+-
Msrc/microhttpd/digestauth.c | 19+++++++------------
Asrc/microhttpd/digestauth.h | 38++++++++++++++++++++++++++++++++++++++
Mw32/common/libmicrohttpd-files.vcxproj | 1+
Mw32/common/libmicrohttpd-filters.vcxproj | 3+++
5 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am @@ -163,7 +163,7 @@ endif if ENABLE_DAUTH libmicrohttpd_la_SOURCES += \ - digestauth.c \ + digestauth.c digestauth.h \ mhd_bithelpers.h mhd_byteorder.h mhd_align.h \ md5.c md5.h \ sha256.c sha256.h diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c @@ -25,6 +25,7 @@ * @author Christian Grothoff (RFC 7616 support) * @author Karlson2k (Evgeny Grin) */ +#include "digestauth.h" #include "platform.h" #include "mhd_limits.h" #include "internal.h" @@ -119,12 +120,6 @@ #define VLA_CHECK_LEN_DIGEST(n) \ do { if ((n) > MAX_DIGEST) MHD_PANIC (_ ("VLA too big.\n")); } while (0) - -/** - * Beginning string for any valid Digest authentication header. - */ -#define _BASE "Digest " - /** * Maximum length of a username for digest authentication. */ @@ -794,10 +789,10 @@ MHD_digest_auth_get_username (struct MHD_Connection *connection) NULL)) return NULL; if (0 != strncmp (header, - _BASE, - MHD_STATICSTR_LEN_ (_BASE))) + _MHD_AUTH_DIGEST_BASE, + MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE))) return NULL; - header += MHD_STATICSTR_LEN_ (_BASE); + header += MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE); if (0 == lookup_sub_value (user, sizeof (user), header, @@ -1244,10 +1239,10 @@ digest_auth_check_all (struct MHD_Connection *connection, NULL)) return MHD_DAUTH_WRONG_HEADER; if (0 != strncmp (header, - _BASE, - MHD_STATICSTR_LEN_ (_BASE))) + _MHD_AUTH_DIGEST_BASE, + MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE))) return MHD_DAUTH_WRONG_HEADER; - header += MHD_STATICSTR_LEN_ (_BASE); + header += MHD_STATICSTR_LEN_ (_MHD_AUTH_DIGEST_BASE); left = strlen (header); if (1) diff --git a/src/microhttpd/digestauth.h b/src/microhttpd/digestauth.h @@ -0,0 +1,38 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010, 2011, 2012, 2015, 2018 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 digestauth.c + * @brief Implements HTTP digest authentication + * @author Amr Ali + * @author Matthieu Speder + * @author Christian Grothoff (RFC 7616 support) + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_DIGESTAUTH_H +#define MHD_DIGESTAUTH_H 1 +/** + * Beginning string for any valid Digest authentication header. + */ +#define _MHD_AUTH_DIGEST_BASE "Digest " + +#endif /* ! MHD_DIGESTAUTH_H */ + +/* end of digestauth.h */ diff --git a/w32/common/libmicrohttpd-files.vcxproj b/w32/common/libmicrohttpd-files.vcxproj @@ -34,6 +34,7 @@ <ClInclude Include="$(MhdSrc)microhttpd\base64.h" /> <ClInclude Include="$(MhdSrc)microhttpd\basicauth.h" /> <ClInclude Include="$(MhdSrc)microhttpd\connection.h" /> + <ClInclude Include="$(MhdSrc)microhttpd\digestauth.h" /> <ClInclude Include="$(MhdSrc)microhttpd\internal.h" /> <ClInclude Include="$(MhdSrc)microhttpd\md5.h" /> <ClInclude Include="$(MhdSrc)microhttpd\sha256.h" /> diff --git a/w32/common/libmicrohttpd-filters.vcxproj b/w32/common/libmicrohttpd-filters.vcxproj @@ -49,6 +49,9 @@ <ClInclude Include="$(MhdSrc)microhttpd\connection.h"> <Filter>Internal Headers</Filter> </ClInclude> + <ClInclude Include="$(MhdSrc)microhttpd\digestauth.h"> + <Filter>Internal Headers</Filter> + </ClInclude> <ClInclude Include="$(MhdSrc)microhttpd\internal.h"> <Filter>Internal Headers</Filter> </ClInclude>