FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
esp32_https_server/src/HTTPServer.hpp at master · sledgehammer-dev/esp32_https_server · GitHub
sledgehammer-dev
esp32_https_server
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
esp32_https_server
/
src
/
HTTPServer.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
76 lines (59 loc) · 1.83 KB
Breadcrumbs
esp32_https_server
/
src
/
HTTPServer.hpp
Copy path
File metadata and controls
76 lines (59 loc) · 1.83 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
74
75
76
#
ifndef
SRC_HTTPSERVER_HPP_
#
define
SRC_HTTPSERVER_HPP_
//
Standard library
#
include
<
string
>
//
Arduino stuff
#
include
<
Arduino.h
>
//
Required for sockets
#
include
"
lwip/netdb.h
"
#
undef
read
#
include
"
lwip/sockets.h
"
#
include
"
lwip/inet.h
"
//
Internal includes
#
include
"
HTTPSServerConstants.hpp
"
#
include
"
HTTPHeaders.hpp
"
#
include
"
HTTPHeader.hpp
"
#
include
"
ResourceNode.hpp
"
#
include
"
ResourceResolver.hpp
"
#
include
"
ResolvedResource.hpp
"
#
include
"
HTTPConnection.hpp
"
namespace
httpsserver
{
/*
*
* \brief Main implementation for the plain HTTP server. Use HTTPSServer for TLS support
*/
class
HTTPServer
:
public
ResourceResolver
{
public:
HTTPServer
(
const
uint16_t
portHTTPS =
80
,
const
uint8_t
maxConnections =
8
,
const
in_addr_t
bindAddress =
0
);
virtual
~HTTPServer
();
uint8_t
start
();
void
stop
();
bool
isRunning
();
void
loop
();
void
setDefaultHeader
(std::string name, std::string value);
protected:
//
Static configuration. Port, keys, etc. ====================
//
Certificate that should be used (includes private key)
const
uint16_t
_port;
//
Max parallel connections that the server will accept
const
uint8_t
_maxConnections;
//
Address to bind to (0 = all interfaces)
const
in_addr_t
_bindAddress;
//
// Runtime data ============================================
//
The array of connections that are currently active
HTTPConnection ** _connections;
//
Status of the server: Are we running, or not?
boolean _running;
//
The server socket
int
_socket;
//
The server socket address, that our service is bound to
sockaddr_in _sock_addr;
//
Headers that are included in every response
HTTPHeaders _defaultHeaders;
//
Setup functions
virtual
uint8_t
setupSocket
();
virtual
void
teardownSocket
();
//
Helper functions
virtual
int
createConnection
(
int
idx);
};
}
#
endif
/*
SRC_HTTPSERVER_HPP_
*/
Back
|
FazBrowse Home
|
New Git URL