Skip to content
Snippets Groups Projects
Commit ccf0ce4a authored by Sergey Lyubka's avatar Sergey Lyubka
Browse files

Using chunked API in post.c example

parent 134a5b7b
No related branches found
No related tags found
No related merge requests found
...@@ -21,19 +21,17 @@ static int handler(struct mg_connection *conn) { ...@@ -21,19 +21,17 @@ static int handler(struct mg_connection *conn) {
// Send reply to the client, showing submitted form values. // Send reply to the client, showing submitted form values.
// POST data is in conn->content, data length is in conn->content_len // POST data is in conn->content, data length is in conn->content_len
mg_printf(conn, "HTTP/1.0 200 OK\r\n" mg_send_header(conn, "Content-Type", "text/plain");
"Content-Type: text/plain\r\n\r\n" mg_printf_data(conn,
"Submitted data: [%.*s]\n" "Submitted data: [%.*s]\n"
"Submitted data length: %d bytes\n" "Submitted data length: %d bytes\n"
"input_1: [%s]\n" "input_1: [%s]\n"
"input_2: [%s]\n", "input_2: [%s]\n",
conn->content_len, conn->content, conn->content_len, var1, var2); conn->content_len, conn->content,
conn->content_len, var1, var2);
} else { } else {
// Show HTML form. // Show HTML form.
mg_printf(conn, "HTTP/1.1 200 OK\r\n" mg_send_data(conn, html_form, strlen(html_form));
"Content-Length: %d\r\n"
"Content-Type: text/html\r\n\r\n%s",
(int) strlen(html_form), html_form);
} }
return 1; return 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment