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
ef4bd8f7
Commit
ef4bd8f7
authored
Jun 04, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setting content-length
parent
e6357396
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
hello.c
examples/hello.c
+11
-5
No files found.
examples/hello.c
View file @
ef4bd8f7
...
...
@@ -6,11 +6,17 @@ static void *callback(enum mg_event event,
struct
mg_connection
*
conn
,
const
struct
mg_request_info
*
request_info
)
{
if
(
event
==
MG_NEW_REQUEST
)
{
// Echo requested URI back to the client
mg_printf
(
conn
,
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: text/plain
\r\n\r\n
"
"%s"
,
request_info
->
uri
);
return
""
;
// Mark as processed
const
char
*
content
=
"hello from mongoose!"
;
mg_printf
(
conn
,
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: text/plain
\r\n
"
"Content-Length: %d
\r\n
"
// Always set Content-Length
"
\r\n
"
"%s"
,
strlen
(
content
),
content
);
// Mark as processed
return
""
;
}
else
{
return
NULL
;
}
...
...
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