⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpauth.c

📁 A small implementation of web server
💻 C
字号:
/////////////////////////////////////////////////////////////////////////////
//
// 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -