mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-07-30 18:57:29 +02:00
wrap string literals in namespace
This commit is contained in:
committed by
Mathieu Carbou
parent
c004ca8cd3
commit
bc8cadbcb4
@ -24,6 +24,8 @@
|
|||||||
#include "AsyncEventSource.h"
|
#include "AsyncEventSource.h"
|
||||||
#include "literals.h"
|
#include "literals.h"
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
static String generateEventMessage(const char* message, const char* event, uint32_t id, uint32_t reconnect) {
|
static String generateEventMessage(const char* message, const char* event, uint32_t id, uint32_t reconnect) {
|
||||||
String ev;
|
String ev;
|
||||||
|
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
|
|
||||||
#define MAX_PRINTF_LEN 64
|
#define MAX_PRINTF_LEN 64
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
|
|
||||||
size_t webSocketSendFrameWindow(AsyncClient* client) {
|
size_t webSocketSendFrameWindow(AsyncClient* client) {
|
||||||
if (!client->canSend())
|
if (!client->canSend())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -153,7 +153,7 @@ class AsyncWebHeader {
|
|||||||
|
|
||||||
const String& name() const { return _name; }
|
const String& name() const { return _name; }
|
||||||
const String& value() const { return _value; }
|
const String& value() const { return _value; }
|
||||||
String toString() const { return _name + (char)0x3a + (char)0x20 /*": "*/ + _value + T_rn; }
|
String toString() const { return _name + (char)0x3a + (char)0x20 /*": "*/ + _value + asyncsrv::T_rn; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "literals.h"
|
#include "literals.h"
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
// Basic Auth hash = base64("username:password")
|
// Basic Auth hash = base64("username:password")
|
||||||
|
|
||||||
bool checkBasicAuthentication(const char* hash, const char* username, const char* password) {
|
bool checkBasicAuthentication(const char* hash, const char* username, const char* password) {
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
#include "WebHandlerImpl.h"
|
#include "WebHandlerImpl.h"
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
|
|
||||||
AsyncStaticWebHandler::AsyncStaticWebHandler(const char* uri, FS& fs, const char* path, const char* cache_control)
|
AsyncStaticWebHandler::AsyncStaticWebHandler(const char* uri, FS& fs, const char* path, const char* cache_control)
|
||||||
: _fs(fs), _uri(uri), _path(path), _default_file(F("index.htm")), _cache_control(cache_control), _last_modified(), _callback(nullptr) {
|
: _fs(fs), _uri(uri), _path(path), _default_file(F("index.htm")), _cache_control(cache_control), _last_modified(), _callback(nullptr) {
|
||||||
// Ensure leading '/'
|
// Ensure leading '/'
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#define __is_param_char(c) ((c) && ((c) != '{') && ((c) != '[') && ((c) != '&') && ((c) != '='))
|
#define __is_param_char(c) ((c) && ((c) != '{') && ((c) != '[') && ((c) != '&') && ((c) != '='))
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
enum { PARSE_REQ_START,
|
enum { PARSE_REQ_START,
|
||||||
PARSE_REQ_HEADERS,
|
PARSE_REQ_HEADERS,
|
||||||
PARSE_REQ_BODY,
|
PARSE_REQ_BODY,
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "WebResponseImpl.h"
|
#include "WebResponseImpl.h"
|
||||||
#include "cbuf.h"
|
#include "cbuf.h"
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
// Since ESP8266 does not link memchr by default, here's its implementation.
|
// Since ESP8266 does not link memchr by default, here's its implementation.
|
||||||
void* memchr(void* ptr, int ch, size_t count) {
|
void* memchr(void* ptr, int ch, size_t count) {
|
||||||
unsigned char* p = static_cast<unsigned char*>(ptr);
|
unsigned char* p = static_cast<unsigned char*>(ptr);
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
#include "WebHandlerImpl.h"
|
#include "WebHandlerImpl.h"
|
||||||
|
|
||||||
|
using namespace asyncsrv;
|
||||||
|
|
||||||
bool ON_STA_FILTER(AsyncWebServerRequest* request) {
|
bool ON_STA_FILTER(AsyncWebServerRequest* request) {
|
||||||
return WiFi.localIP() == request->client()->localIP();
|
return WiFi.localIP() == request->client()->localIP();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace asyncsrv {
|
||||||
|
|
||||||
#ifndef ESP8622
|
#ifndef ESP8622
|
||||||
static constexpr const char* T_100_CONTINUE = "100-continue";
|
static constexpr const char* T_100_CONTINUE = "100-continue";
|
||||||
@ -336,3 +337,5 @@ static const char T_uri[] PROGMEM = "uri";
|
|||||||
static const char T_username[] PROGMEM = "username";
|
static const char T_username[] PROGMEM = "username";
|
||||||
|
|
||||||
#endif // ESP8622
|
#endif // ESP8622
|
||||||
|
|
||||||
|
} // namespace asyncsrv {}
|
||||||
|
Reference in New Issue
Block a user