httpauth.c
来自「MiniWeb是一个针对嵌入式应用而开发的微型Web Server」· C语言 代码 · 共 40 行
C
40 行
/////////////////////////////////////////////////////////////////////////////
//
// http.c
//
// MiniWeb HTTP authentication implementation
//
/////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "httppil.h"
#include "httpapi.h"
#include "httpint.h"
#ifdef HTTPAUTH
extern HttpParam g_httpParam;
////////////////////////////////////////////////////////////////////////////
// _mwCheckAuthentication
// Check if a connected peer is authenticated
////////////////////////////////////////////////////////////////////////////
BOOL _mwCheckAuthentication(HttpSocket* phsSocket)
{
if (!ISFLAGSET(phsSocket,FLAG_AUTHENTICATION))
return TRUE;
if (g_httpParam.dwAuthenticatedNode!=phsSocket->ipAddr.laddr) {
// Not authenticated
g_httpParam.stats.authFailCount++;
return FALSE;
}
// Extend authentication period
g_httpParam.tmAuthExpireTime = time(NULL) + HTTPAUTHTIMEOUT;
return TRUE;
}
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?