diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/csoap/simpleserver.c | 8 | ||||
-rw-r--r-- | examples/nanohttp/http_client.c | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/examples/csoap/simpleserver.c b/examples/csoap/simpleserver.c index 676be5f..6439a65 100644 --- a/examples/csoap/simpleserver.c +++ b/examples/csoap/simpleserver.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: simpleserver.c,v 1.27 2006/11/28 23:45:57 m0gg Exp $ + * $Id: simpleserver.c,v 1.28 2006/12/10 19:21:05 m0gg Exp $ * * CSOAP Project: CSOAP examples project * Copyright (C) 2003-2004 Ferhat Ayaz @@ -102,6 +102,7 @@ main(int argc, char **argv) { printf("soap_router_new failed (%p)\n", router); herror_release(err); + soap_server_destroy(); exit(1); } @@ -109,6 +110,7 @@ main(int argc, char **argv) { printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err)); herror_release(err); + soap_server_destroy(); exit(1); } @@ -116,6 +118,7 @@ main(int argc, char **argv) { printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err)); herror_release(err); + soap_server_destroy(); exit(1); } printf("router (%p) registered for \"%s\"\n", router, url); @@ -125,11 +128,12 @@ main(int argc, char **argv) { printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err)); herror_release(err); + soap_server_destroy(); exit(1); } printf("shutting down\n"); soap_server_destroy(); - return 0; + exit(0); } diff --git a/examples/nanohttp/http_client.c b/examples/nanohttp/http_client.c index 7deeb03..1b9c912 100644 --- a/examples/nanohttp/http_client.c +++ b/examples/nanohttp/http_client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: http_client.c,v 1.8 2006/12/01 10:56:00 m0gg Exp $ +* $Id: http_client.c,v 1.9 2006/12/10 19:21:06 m0gg Exp $ * * CSOAP Project: A http client/server library in C (example) * Copyright (C) 2003-2004 Ferhat Ayaz @@ -39,7 +39,7 @@ static char *password = NULL; static void show_response(hresponse_t *res) { unsigned char buffer[MAX_BUFFER_SIZE+1]; - int read; + int len; if (!res) { @@ -53,6 +53,7 @@ static void show_response(hresponse_t *res) if (show_headers) { hpair_t *pair; + printf("HTTP Headers:\n"); for (pair = res->header; pair; pair=pair->next) printf(" %s: %s\n", pair->key, pair->value); @@ -66,10 +67,10 @@ static void show_response(hresponse_t *res) while (http_input_stream_is_ready(res->in)) { - read = http_input_stream_read(res->in, buffer, MAX_BUFFER_SIZE); + len = http_input_stream_read(res->in, buffer, MAX_BUFFER_SIZE); if (show_content) - fwrite(buffer, read, 1, stdout); + fwrite(buffer, len, 1, stdout); } return; } |