8000 Fix HttpResponse line mangling · exocode/esp32-snippets@2dcd6aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dcd6aa

Browse files
committed
Fix HttpResponse line mangling
1 parent b50dec3 commit 2dcd6aa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cpp_utils/HttpResponse.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const int HttpResponse::HTTP_STATUS_NOT_IMPLEMENTED = 501;
2626
const int HttpResponse::HTTP_STATUS_SERVICE_UNAVAILABLE = 503;
2727

2828
static std::string lineTerminator = "\r\n";
29+
HttpResponse::HttpResponse(HttpRequest* request) {
2930
m_request = request;
3031
m_status = 200;
31-
HttpResponse::HttpResponse(HttpRequest* request) {
3232
m_headerCommitted = false; // We have not yet sent a header.
3333
}
3434

@@ -125,7 +125,7 @@ void HttpResponse::sendFile(std::string fileName, size_t bufSize) {
125125
ESP_LOGI(LOG_TAG, "Opening file: %s", fileName.c_str());
126126
std::ifstream ifStream;
127127
ifStream.open(fileName, std::ifstream::in | std::ifstream::binary); // Attempt to open the file for reading.
128-
128+
129129
// If we failed to open the requested file, then it probably didn't exist so return a not found.
130130
if (!ifStream.is_open()) {
131131
ESP_LOGE(LOG_TAG, "Unable to open file %s for reading", fileName.c_str());

cpp_utils/HttpResponse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class HttpResponse {
3939
void sendData(uint8_t* pData, size_t size); // Send data to the client.
4040
void setStatus(int status, std::string message); // Set the response status.
4141
void sendFile(std::string fileName, size_t bufSize = 4 * 1024); // Send file contents if exists.
42+
4243
private:
4344
bool m_headerCommitted; // Has the header been sent?
4445
HttpRequest* m_request; // The request associated with this response.

0 commit comments

Comments
 (0)
0