Created basicauth.h header

This commit is contained in:
Evgeny Grin (Karlson2k)
2022-05-20 13:12:20 +03:00
parent b1fff186c5
commit 223013b2e7
5 changed files with 49 additions and 9 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ endif
if ENABLE_BAUTH
libmicrohttpd_la_SOURCES += \
basicauth.c \
basicauth.c basicauth.h \
base64.c base64.h
endif
+6 -8
View File
@@ -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
+38
View File
@@ -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 */
+1
View File
@@ -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" />
+3
View File
@@ -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>