Skip to content

Commit f94635c

Browse files
carundeanberris
authored andcommitted
Implemented review comments.
1 parent 9909fa4 commit f94635c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

libs/network/example/http/async_server_file_upload.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ struct connection_handler {
189189
/// @param [in] conn Connection object
190190
///
191191
void operator()(server::request const& req, const server::connection_ptr& conn) {
192-
static std::map<std::string, std::string> headers = {
192+
std::map<std::string, std::string> headers = {
193193
{"Connection","close"},
194194
{"Content-Length", "0"},
195195
{"Content-Type", "text/plain"}
@@ -225,8 +225,8 @@ struct connection_handler {
225225
conn->write(err);
226226
}
227227
} else {
228-
static std::string body("Only path allowed is /upload");
229-
headers["Content-Length"] = std::to_string(body.size());
228+
static constexpr char body[] = "Only path allowed is /upload";
229+
headers["Content-Length"] = std::to_string(sizeof(body));
230230
conn->set_status(server::connection::bad_request);
231231
conn->set_headers(headers);
232232
conn->write(body);

libs/network/example/http/hello_world_async_server_with_work_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void process_request(work_queue& queue) {
125125
// some heavy work!
126126
std::this_thread::sleep_for(std::chrono::seconds(10));
127127

128-
static std::map<std::string, std::string> headers = {
128+
std::map<std::string, std::string> headers = {
129129
{"Content-Length", "0"},
130130
{"Content-Type", "text/plain"},
131131
};

libs/network/example/http/hello_world_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct hello_world {
3030
std::ostringstream data;
3131
data << "Hello, " << ip << ':' << port << '!';
3232

33-
static std::map<std::string, std::string> headers = {
33+
std::map<std::string, std::string> headers = {
3434
{"Content-Length", "0"},
3535
{"Content-Type", "text/plain"},
3636
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy