ESP32 HTTPS Server: /home/frank/Projekte/esp32/https_server/esp32_https_server/src/HTTPResponse.hpp Source File

1 #ifndef SRC_HTTPRESPONSE_HPP_

2 #define SRC_HTTPRESPONSE_HPP_

3 

4 #include <Arduino.h>

5 #include <string>

6 

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 

21 

26 public:

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  std::string getHeader(std::string const &name);

36  bool isHeaderWritten();

37 

38  void printStd(std::string const &str);

39 

40 

41  size_t write(const uint8_t *buffer, size_t size);

42  size_t write(uint8_t);

43 

45 

46  bool isResponseBuffered();

47  void finalize();

48 

50 

51 private:

52  void printHeader();

53  void printInternal(const std::string &str, bool skipBuffer = false);

54  size_t writeBytesInternal(const void * data, int length, bool skipBuffer = false);

55  void drainBuffer(bool onOverflow = false);

56 

57  uint16_t _statusCode;

58  std::string _statusText;

60  bool _headerWritten;

61  bool _isError;

62 

63 

64  byte * _responseCache;

65  size_t _responseCacheSize;

66  size_t _responseCachePointer;

67 };

68 

69 }

70 

71 #endif

void error()

Definition: HTTPResponse.cpp:131

Represents the response stream of an HTTP request.

Definition: HTTPResponse.hpp:25

size_t write(const uint8_t *buffer, size_t size)

Definition: HTTPResponse.cpp:88

void printStd(std::string const &str)

Definition: HTTPResponse.cpp:81

Internal class to handle the state of a connection.

Definition: ConnectionContext.hpp:18

Definition: ConnectionContext.cpp:3