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
cd54b18d
Commit
cd54b18d
authored
Nov 14, 2016
by
Marko Mikulicic
Committed by
Cesanta Bot
Nov 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After establishing tun, remove http proto handler
PUBLISHED_FROM=8449d4df2a4caf7afc0f9b50f85bb01d79b8c4eb
parent
65e01dba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
tun.c
examples/tun/tun.c
+10
-1
No files found.
examples/tun/tun.c
View file @
cd54b18d
...
...
@@ -5,6 +5,7 @@ static const char *s_dispatcher = "ws://foo:bar@localhost:8000";
void
ev_handler
(
struct
mg_connection
*
nc
,
int
ev
,
void
*
ev_data
)
{
struct
http_message
*
hm
=
(
struct
http_message
*
)
ev_data
;
int
i
;
switch
(
ev
)
{
case
MG_EV_ACCEPT
:
fprintf
(
stderr
,
"HTTP accept. nc=%p
\n
"
,
nc
);
...
...
@@ -15,7 +16,15 @@ void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
case
MG_EV_HTTP_REQUEST
:
fprintf
(
stderr
,
"HTTP got request. nc=%p path=%.*s
\n
"
,
nc
,
(
int
)
hm
->
uri
.
len
,
hm
->
uri
.
p
);
mg_http_send_error
(
nc
,
200
,
"OK"
);
mg_printf
(
nc
,
"%s"
,
"HTTP/1.1 200 OK
\r\n
Transfer-Encoding: chunked
\r\n\r\n
"
);
for
(
i
=
0
;
i
<
10
;
i
++
)
{
mg_printf_http_chunk
(
nc
,
"OK %d
\n
"
,
i
);
}
mg_send_http_chunk
(
nc
,
""
,
0
);
/* Send empty chunk, the end of response */
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
break
;
case
MG_EV_CLOSE
:
fprintf
(
stderr
,
"HTTP close
\n
"
);
...
...
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