Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
cd54b18d
Commit
cd54b18d
authored
8 years ago
by
Marko Mikulicic
Committed by
Cesanta Bot
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
After establishing tun, remove http proto handler
PUBLISHED_FROM=8449d4df2a4caf7afc0f9b50f85bb01d79b8c4eb
parent
65e01dba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/tun/tun.c
+10
-1
10 additions, 1 deletion
examples/tun/tun.c
with
10 additions
and
1 deletion
examples/tun/tun.c
+
10
−
1
View file @
cd54b18d
...
@@ -5,6 +5,7 @@ static const char *s_dispatcher = "ws://foo:bar@localhost:8000";
...
@@ -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
)
{
void
ev_handler
(
struct
mg_connection
*
nc
,
int
ev
,
void
*
ev_data
)
{
struct
http_message
*
hm
=
(
struct
http_message
*
)
ev_data
;
struct
http_message
*
hm
=
(
struct
http_message
*
)
ev_data
;
int
i
;
switch
(
ev
)
{
switch
(
ev
)
{
case
MG_EV_ACCEPT
:
case
MG_EV_ACCEPT
:
fprintf
(
stderr
,
"HTTP accept. nc=%p
\n
"
,
nc
);
fprintf
(
stderr
,
"HTTP accept. nc=%p
\n
"
,
nc
);
...
@@ -15,7 +16,15 @@ void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
...
@@ -15,7 +16,15 @@ void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
case
MG_EV_HTTP_REQUEST
:
case
MG_EV_HTTP_REQUEST
:
fprintf
(
stderr
,
"HTTP got request. nc=%p path=%.*s
\n
"
,
nc
,
fprintf
(
stderr
,
"HTTP got request. nc=%p path=%.*s
\n
"
,
nc
,
(
int
)
hm
->
uri
.
len
,
hm
->
uri
.
p
);
(
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
;
break
;
case
MG_EV_CLOSE
:
case
MG_EV_CLOSE
:
fprintf
(
stderr
,
"HTTP close
\n
"
);
fprintf
(
stderr
,
"HTTP close
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment