ESP32 HTTPS Server
HTTPSServer.hpp
1 #ifndef SRC_HTTPSSERVER_HPP_
2 #define SRC_HTTPSSERVER_HPP_
3 
4 // Standard library
5 #include <string>
6 
7 // Arduino stuff
8 #include <Arduino.h>
9 
10 // Required for SSL
11 #include "openssl/ssl.h"
12 #undef read
13 
14 // Internal includes
15 #include "HTTPServer.hpp"
16 #include "HTTPSServerConstants.hpp"
17 #include "HTTPHeaders.hpp"
18 #include "HTTPHeader.hpp"
19 #include "ResourceNode.hpp"
20 #include "ResourceResolver.hpp"
21 #include "ResolvedResource.hpp"
22 #include "HTTPSConnection.hpp"
23 #include "SSLCert.hpp"
24 
25 namespace httpsserver {
26 
30 class HTTPSServer : public HTTPServer {
31 public:
32  HTTPSServer(SSLCert * cert, const uint16_t portHTTPS = 443, const uint8_t maxConnections = 4, const in_addr_t bindAddress = 0);
33  virtual ~HTTPSServer();
34 
35 private:
36  // Static configuration. Port, keys, etc. ====================
37  // Certificate that should be used (includes private key)
38  SSLCert * _cert;
39 
41  SSL_CTX * _sslctx;
42  // Status of the server: Are we running, or not?
43 
44  // Setup functions
45  virtual uint8_t setupSocket();
46  virtual void teardownSocket();
47  uint8_t setupSSLCTX();
48  uint8_t setupCert();
49 
50  // Helper functions
51  virtual int createConnection(int idx);
52 };
53 
54 } /* namespace httpsserver */
55 
56 #endif /* SRC_HTTPSSERVER_HPP_ */
Main implementation for the plain HTTP server. Use HTTPSServer for TLS support.
Definition: HTTPServer.hpp:30
Certificate and private key that can be passed to the HTTPSServer.
Definition: SSLCert.hpp:59
Main implementation of the HTTP Server with TLS support. Use HTTPServer for plain HTTP...
Definition: HTTPSServer.hpp:30
Definition: ConnectionContext.cpp:3