Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel Firmware
Zephyr Firmware
Commits
76938bb4
Commit
76938bb4
authored
3 years ago
by
Raptor Engineering Development Team
Browse files
Options
Download
Email Patches
Plain Diff
Remove unwanted cookie demo from Web service
parent
8e69bf2c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
40 deletions
+0
-40
kestrel/src/webservice.c
kestrel/src/webservice.c
+0
-40
No files found.
kestrel/src/webservice.c
View file @
76938bb4
...
...
@@ -56,7 +56,6 @@ int hello_world_handler(struct mg_connection *conn, void *cbdata)
mg_printf
(
conn
,
"See also:
\n
"
);
mg_printf
(
conn
,
"<ul>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/info>system info</a></li>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/history>cookie demo</a></li>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/firmwareupload>firmware upload</a></li>
\n
"
);
mg_printf
(
conn
,
"</ul>
\n
"
);
mg_printf
(
conn
,
"</body></html>
\n
"
);
...
...
@@ -107,44 +106,6 @@ int system_info_handler(struct mg_connection *conn, void *cbdata)
return
200
;
}
int
history_handler
(
struct
mg_connection
*
conn
,
void
*
cbdata
)
{
const
struct
mg_request_info
*
req_info
=
mg_get_request_info
(
conn
);
const
char
*
cookie
=
mg_get_header
(
conn
,
"Cookie"
);
char
history_str
[
64
];
mg_get_cookie
(
cookie
,
"history"
,
history_str
,
sizeof
(
history_str
));
mg_printf
(
conn
,
"HTTP/1.1 200 OK
\r\n
"
);
mg_printf
(
conn
,
"Connection: close
\r\n
"
);
mg_printf
(
conn
,
"Set-Cookie: history='%s'
\r\n
"
,
req_info
->
local_uri
);
mg_printf
(
conn
,
"Content-Type: text/html
\r\n\r\n
"
);
mg_printf
(
conn
,
"<html><body>"
);
mg_printf
(
conn
,
"<h3>Your URI is: %s<h3>
\n
"
,
req_info
->
local_uri
);
if
(
history_str
[
0
]
==
0
)
{
mg_printf
(
conn
,
"<h5>This is your first visit.</h5>
\n
"
);
}
else
{
mg_printf
(
conn
,
"<h5>your last /history visit was: %s</h5>
\n
"
,
history_str
);
}
mg_printf
(
conn
,
"Some cookie-saving links to try:
\n
"
);
mg_printf
(
conn
,
"<ul>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/history/first>first</a></li>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/history/second>second</a></li>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/history/third>third</a></li>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/history/fourth>fourth</a></li>
\n
"
);
mg_printf
(
conn
,
"<li><a href=/history/fifth>fifth</a></li>
\n
"
);
mg_printf
(
conn
,
"</ul>
\n
"
);
mg_printf
(
conn
,
"</body></html>
\n
"
);
return
200
;
}
int
firmware_upload_form_handler
(
struct
mg_connection
*
conn
,
void
*
cbdata
)
{
mg_printf
(
conn
,
...
...
@@ -264,7 +225,6 @@ void *main_pthread(void *arg)
mg_set_request_handler
(
ctx
,
"/$"
,
hello_world_handler
,
(
void
*
)
0
);
mg_set_request_handler
(
ctx
,
"/info$"
,
system_info_handler
,
(
void
*
)
0
);
mg_set_request_handler
(
ctx
,
"/history"
,
history_handler
,
(
void
*
)
0
);
mg_set_request_handler
(
ctx
,
"/firmwareupload"
,
firmware_upload_form_handler
,
(
void
*
)
"/firmwareupload.callback"
);
mg_set_request_handler
(
ctx
,
"/firmwareupload.callback"
,
firmware_upload_handler
,
(
void
*
)
0
);
...
...
This diff is collapsed.
Click to expand it.
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