forked from fhessel/esp32_https_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTTPSServerConstants.hpp
More file actions
73 lines (55 loc) · 2.23 KB
/
HTTPSServerConstants.hpp
File metadata and controls
73 lines (55 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef SRC_HTTPSSERVERCONSTANTS_HPP_
#define SRC_HTTPSSERVERCONSTANTS_HPP_
#include "Arduino.h"
// 1: Error
// 2: Error + Warn
// 3: Error + Warn + Info
// 4: Error + Warn + Info + Debug
#ifndef HTTPS_LOGLEVEL
#define HTTPS_LOGLEVEL 3
#endif
#ifdef HTTPS_LOGTIMESTAMP
#define HTTPS_LOGTAG(LVL) Serial.printf("[HTTPS:" LVL ":%10lu] ", millis())
#else
#define HTTPS_LOGTAG(LVL) Serial.print("[HTTPS:" LVL "] ")
#endif
#if HTTPS_LOGLEVEL > 0
#define HTTPS_LOGE(...) HTTPS_LOGTAG("E");Serial.printf(__VA_ARGS__);Serial.println()
#else
#define HTTPS_LOGE(...) do {} while (0)
#endif
#if HTTPS_LOGLEVEL > 1
#define HTTPS_LOGW(...) HTTPS_LOGTAG("W");Serial.printf(__VA_ARGS__);Serial.println()
#else
#define HTTPS_LOGW(...) do {} while (0)
#endif
#if HTTPS_LOGLEVEL > 2
#define HTTPS_LOGI(...) HTTPS_LOGTAG("I");Serial.printf(__VA_ARGS__);Serial.println()
#else
#define HTTPS_LOGI(...) do {} while (0)
#endif
#if HTTPS_LOGLEVEL > 3
#define HTTPS_LOGD(...) HTTPS_LOGTAG("D");Serial.printf(__VA_ARGS__);Serial.println()
#else
#define HTTPS_LOGD(...) do {} while (0)
#endif
// The following lines define limits of the protocol. Exceeding these limits will lead to a 500 error
// Maximum of header lines that are parsed
#define HTTPS_REQUEST_MAX_HEADERS 20
// Maximum length of the request line (GET /... HTTP/1.1)
#define HTTPS_REQUEST_MAX_REQUEST_LENGTH 128
// Maximum length of a header line (including name and value)
#define HTTPS_REQUEST_MAX_HEADER_LENGTH 384
// Chunk size used for reading data from the ssl-enabled socket
#define HTTPS_CONNECTION_DATA_CHUNK_SIZE 512
// Size (in bytes) of the Connection:keep-alive Cache (we need to be able to
// store-and-forward the response to calculate the content-size)
#define HTTPS_KEEPALIVE_CACHESIZE 1400
// Timeout for an HTTPS connection without any transmission
#define HTTPS_CONNECTION_TIMEOUT 20000
// Timeout used to wait for shutdown of SSL connection (ms)
// (time for the client to return notify close flag) - without it, truncation attacks might be possible
#define HTTPS_SHUTDOWN_TIMEOUT 5000
// Length of a SHA1 hash
#define HTTPS_SHA1_LENGTH 20
#endif /* SRC_HTTPSSERVERCONSTANTS_HPP_ */