diff --git a/kestrel/src/webservice.c b/kestrel/src/webservice.c index c6fe73f2c3d2045a53b6165080e49640dda63f0c..9710b3126def9230b229c48ce21d7808e8917494 100644 --- a/kestrel/src/webservice.c +++ b/kestrel/src/webservice.c @@ -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);