From f4c29af542bbded2fe36d9bdc80808c3a7f5d92b Mon Sep 17 00:00:00 2001 From: m0gg Date: Sun, 10 Dec 2006 19:21:05 +0000 Subject: nhttp client fix and documentation update --- nanohttp/nanohttp-admin.c | 87 ++++++++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 31 deletions(-) (limited to 'nanohttp/nanohttp-admin.c') diff --git a/nanohttp/nanohttp-admin.c b/nanohttp/nanohttp-admin.c index 29462a0..2babec6 100644 --- a/nanohttp/nanohttp-admin.c +++ b/nanohttp/nanohttp-admin.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-admin.c,v 1.7 2006/12/02 21:50:47 m0gg Exp $ +* $Id: nanohttp-admin.c,v 1.8 2006/12/10 19:21:06 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -66,6 +66,14 @@ _httpd_admin_send_title(httpd_conn_t *conn, const char *title) return; } +static void +_httpd_admin_send_footer(httpd_conn_t *conn) +{ + http_output_stream_write_string(conn->out, ""); + + return; +} + static void _httpd_admin_list_services(httpd_conn_t *conn) { @@ -91,7 +99,7 @@ _httpd_admin_list_services(httpd_conn_t *conn) } http_output_stream_write_string(conn->out, ""); - http_output_stream_write_string(conn->out, ""); + _httpd_admin_send_footer(conn); return; } @@ -108,8 +116,10 @@ _httpd_admin_list_statistics(httpd_conn_t *conn, const char *service_name) if (!(service = httpd_find_service(service_name))) { http_output_stream_write_string(conn->out, - "

Service not found!

" - ""); + "

" + "Service not found!" + "

"); + _httpd_admin_send_footer(conn); return; } @@ -129,7 +139,7 @@ _httpd_admin_list_statistics(httpd_conn_t *conn, const char *service_name) http_output_stream_write_string(conn->out, buffer); - http_output_stream_write_string(conn->out, ""); + _httpd_admin_send_footer(conn); return; } @@ -146,16 +156,22 @@ _httpd_admin_enable_service(httpd_conn_t *conn, const char *service_name) if (!(service = httpd_find_service(service_name))) { http_output_stream_write_string(conn->out, - "

Service not found!

" - ""); + "

" + "Service not found!" + "

"); + + _httpd_admin_send_footer(conn); return; } httpd_enable_service(service); http_output_stream_write_string(conn->out, - "

Service enabled

" - ""); + "

" + "Service enabled" + "

"); + + _httpd_admin_send_footer(conn); return; } @@ -172,16 +188,20 @@ _httpd_admin_disable_service(httpd_conn_t *conn, const char *service_name) if (!(service = httpd_find_service(service_name))) { http_output_stream_write_string(conn->out, - "

service not found!

" - ""); + "

" + "Service not found!" + "

"); + _httpd_admin_send_footer(conn); return; } httpd_disable_service(service); http_output_stream_write_string(conn->out, - "

Service disabled

" - ""); + "

" + "Service disabled" + "

"); + _httpd_admin_send_footer(conn); return; } @@ -211,12 +231,17 @@ _httpd_admin_handle_get(httpd_conn_t * conn, struct hrequest_t *req) { _httpd_admin_send_title(conn, "Welcome to the admin site"); - http_output_stream_write_string(conn->out, ""); - - http_output_stream_write_string(conn->out, ""); + ""); + + _httpd_admin_send_footer(conn); } return; @@ -233,15 +258,15 @@ _httpd_admin_entry(httpd_conn_t * conn, struct hrequest_t *req) { httpd_send_header(conn, 200, HTTP_STATUS_200_REASON_PHRASE); http_output_stream_write_string(conn->out, - "" - "" - "" - "" - "

Sorry!

" - "
" - "
POST Service is not implemented now. Use your browser.
" - "" - ""); + "" + "" + "" + "" + "

Sorry!

" + "
" + "
POST Service is not implemented now. Use your browser.
" + "" + ""); } return; } @@ -251,10 +276,10 @@ httpd_admin_init_args(int argc, char **argv) { int i; - for (i=0; i