ESP32 HTTPS Server
HTTPSConnection.hpp
1 #ifndef SRC_HTTPSCONNECTION_HPP_
2 #define SRC_HTTPSCONNECTION_HPP_
3 
4 #include <Arduino.h>
5 
6 #include <string>
7 
8 // Required for SSL
9 #include "openssl/ssl.h"
10 #undef read
11 
12 // Required for sockets
13 #include "lwip/netdb.h"
14 #undef read
15 #include "lwip/sockets.h"
16 
17 #include "HTTPSServerConstants.hpp"
18 #include "HTTPConnection.hpp"
19 #include "HTTPHeaders.hpp"
20 #include "HTTPHeader.hpp"
21 #include "ResourceResolver.hpp"
22 #include "ResolvedResource.hpp"
23 #include "ResourceNode.hpp"
24 #include "HTTPRequest.hpp"
25 #include "HTTPResponse.hpp"
26 
27 namespace httpsserver {
28 
33 public:
34  HTTPSConnection(ResourceResolver * resResolver);
35  virtual ~HTTPSConnection();
36 
37  virtual int initialize(int serverSocketID, SSL_CTX * sslCtx, HTTPHeaders *defaultHeaders);
38  virtual void closeConnection();
39  virtual bool isSecure();
40 
41 protected:
42  friend class HTTPRequest;
43  friend class HTTPResponse;
44 
45  virtual size_t readBytesToBuffer(byte* buffer, size_t length);
46  virtual size_t pendingByteCount();
47  virtual bool canReadData();
48  virtual size_t writeBuffer(byte* buffer, size_t length);
49 
50 private:
51  // SSL context for this connection
52  SSL * _ssl;
53 
54 };
55 
56 } /* namespace httpsserver */
57 
58 #endif /* SRC_HTTPSCONNECTION_HPP_ */
Represents the request stream for an HTTP request.
Definition: HTTPRequest.hpp:22
Represents the response stream of an HTTP request.
Definition: HTTPResponse.hpp:25
Connection class for an open TLS-enabled connection to an HTTPSServer.
Definition: HTTPSConnection.hpp:32
Groups and manages a set of HTTPHeader instances.
Definition: HTTPHeaders.hpp:18
This class is used internally to resolve a string URL to the corresponding HTTPNode.
Definition: ResourceResolver.hpp:22
Represents a single open connection for the plain HTTPServer, without TLS.
Definition: HTTPConnection.hpp:38
Definition: ConnectionContext.cpp:3
virtual int initialize(int serverSocketID, SSL_CTX *sslCtx, HTTPHeaders *defaultHeaders)
Definition: HTTPSConnection.cpp:25