Skip to content

Commit a2d9b77

Browse files
committedMar 14, 2014
show some info on start; add index.html link
1 parent 1068cb4 commit a2d9b77

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎tinyweb3.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ void tinyweb_start(uv_loop_t* loop, const char* ip, int port, const char* doc_ro
3030
uv_tcp_init(_loop, &_server);
3131
uv_tcp_bind(&_server, (const struct sockaddr*) &addr, 0);
3232
uv_listen((uv_stream_t*)&_server, 8, tinyweb_on_connection);
33+
34+
puts("Tinyweb v3 is started, listening port 8080...");
35+
puts("Please access http://localhost:8080 from you web browser.");
3336
}
3437

3538
static void after_uv_close_client(uv_handle_t* client) {
@@ -180,7 +183,7 @@ static void tinyweb_on_request_get(uv_stream_t* client, const char* pathinfo, co
180183

181184
//request an action
182185
if(strcmp(pathinfo, "/") == 0) {
183-
char* respone = format_http_respone("200 OK", "text/html", "Welcome to tinyweb", -1, NULL);
186+
char* respone = format_http_respone("200 OK", "text/html", "Welcome to tinyweb. <a href=\"index.html\">index.html</a>", -1, NULL);
184187
write_uv_data(client, respone, -1, 0, 1);
185188
} else if(strcmp(pathinfo, "/404") == 0) {
186189
char* respone = format_http_respone("404 Not Found", "text/html", "<h3>404 Page Not Found<h3>", -1, NULL);

0 commit comments

Comments
 (0)
Please sign in to comment.