Commit 4566ca56 authored by Sergey Lyubka's avatar Sergey Lyubka

Squashed warnings in callback()

parent 2e3e1ba7
...@@ -6,15 +6,17 @@ static void *callback(enum mg_event event, ...@@ -6,15 +6,17 @@ static void *callback(enum mg_event event,
struct mg_connection *conn, struct mg_connection *conn,
const struct mg_request_info *request_info) { const struct mg_request_info *request_info) {
if (event == MG_NEW_REQUEST) { if (event == MG_NEW_REQUEST) {
const char *content = "hello from mongoose!"; char content[1024];
int content_length = snprintf(content, sizeof(content),
"Hello from mongoose! Remote port: %d",
request_info->remote_port);
mg_printf(conn, mg_printf(conn,
"HTTP/1.1 200 OK\r\n" "HTTP/1.1 200 OK\r\n"
"Content-Type: text/plain\r\n" "Content-Type: text/plain\r\n"
"Content-Length: %d\r\n" // Always set Content-Length "Content-Length: %d\r\n" // Always set Content-Length
"\r\n" "\r\n"
"%s", "%s",
strlen(content), content_length, content);
content);
// Mark as processed // Mark as processed
return ""; return "";
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment