Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
ccf0ce4a
Commit
ccf0ce4a
authored
Jan 07, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using chunked API in post.c example
parent
134a5b7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
post.c
examples/post.c
+9
-11
No files found.
examples/post.c
View file @
ccf0ce4a
...
...
@@ -21,19 +21,17 @@ static int handler(struct mg_connection *conn) {
// Send reply to the client, showing submitted form values.
// POST data is in conn->content, data length is in conn->content_len
mg_printf
(
conn
,
"HTTP/1.0 200 OK
\r\n
"
"Content-Type: text/plain
\r\n\r\n
"
"Submitted data: [%.*s]
\n
"
"Submitted data length: %d bytes
\n
"
"input_1: [%s]
\n
"
"input_2: [%s]
\n
"
,
conn
->
content_len
,
conn
->
content
,
conn
->
content_len
,
var1
,
var2
);
mg_send_header
(
conn
,
"Content-Type"
,
"text/plain"
);
mg_printf_data
(
conn
,
"Submitted data: [%.*s]
\n
"
"Submitted data length: %d bytes
\n
"
"input_1: [%s]
\n
"
"input_2: [%s]
\n
"
,
conn
->
content_len
,
conn
->
content
,
conn
->
content_len
,
var1
,
var2
);
}
else
{
// Show HTML form.
mg_printf
(
conn
,
"HTTP/1.1 200 OK
\r\n
"
"Content-Length: %d
\r\n
"
"Content-Type: text/html
\r\n\r\n
%s"
,
(
int
)
strlen
(
html_form
),
html_form
);
mg_send_data
(
conn
,
html_form
,
strlen
(
html_form
));
}
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment