ESP32 HTTPS Server
HTTPResponse.hpp
1
#ifndef SRC_HTTPRESPONSE_HPP_
2
#define SRC_HTTPRESPONSE_HPP_
3
4
#include <Arduino.h>
5
#include <string>
6
// Arduino declares it's own min max, incompatible with the stl...
7
#undef min
8
#undef max
9
#undef write
10
#include <vector>
11
12
#include <openssl/ssl.h>
13
14
#include "util.hpp"
15
16
#include "ConnectionContext.hpp"
17
#include "HTTPHeaders.hpp"
18
#include "HTTPHeader.hpp"
19
20
namespace
httpsserver
{
21
25
class
HTTPResponse
:
public
Print {
26
public
:
27
HTTPResponse
(
ConnectionContext
* con);
28
virtual
~
HTTPResponse
();
29
30
void
setStatusCode(uint16_t statusCode);
31
void
setStatusText(std::string
const
&statusText);
32
uint16_t getStatusCode();
33
std::string getStatusText();
34
void
setHeader(std::string
const
&name, std::string
const
&value);
35
bool
isHeaderWritten();
36
37
void
printStd
(std::string
const
&str);
38
39
// From Print:
40
size_t
write
(
const
uint8_t *buffer,
size_t
size);
41
size_t
write
(uint8_t);
42
43
void
error
();
44
45
bool
isResponseBuffered();
46
void
finalize();
47
48
ConnectionContext
* _con;
49
50
private
:
51
void
printHeader();
52
void
printInternal(
const
std::string &str,
bool
skipBuffer =
false
);
53
size_t
writeBytesInternal(
const
void
* data,
int
length,
bool
skipBuffer =
false
);
54
void
drainBuffer(
bool
onOverflow =
false
);
55
56
uint16_t _statusCode;
57
std::string _statusText;
58
HTTPHeaders
_headers;
59
bool
_headerWritten;
60
bool
_isError;
61
62
// Response cache
63
byte * _responseCache;
64
size_t
_responseCacheSize;
65
size_t
_responseCachePointer;
66
};
67
68
}
/* namespace httpsserver */
69
70
#endif
/* SRC_HTTPRESPONSE_HPP_ */
httpsserver::HTTPResponse::error
void error()
Definition:
HTTPResponse.cpp:122
httpsserver::HTTPResponse
Represents the response stream of an HTTP request.
Definition:
HTTPResponse.hpp:25
httpsserver::HTTPResponse::write
size_t write(const uint8_t *buffer, size_t size)
Definition:
HTTPResponse.cpp:79
httpsserver::HTTPHeaders
Groups and manages a set of HTTPHeader instances.
Definition:
HTTPHeaders.hpp:18
httpsserver::HTTPResponse::printStd
void printStd(std::string const &str)
Definition:
HTTPResponse.cpp:72
httpsserver::ConnectionContext
Internal class to handle the state of a connection.
Definition:
ConnectionContext.hpp:17
httpsserver
Definition:
ConnectionContext.cpp:3
src
HTTPResponse.hpp
Generated by
1.8.13