summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorGravatar m0gg2006-12-01 10:55:59 +0000
committerGravatar m0gg2006-12-01 10:55:59 +0000
commit1e0e97fe7b654ecd7f5315d129df6e57f3e63371 (patch)
treedce178f3f876c04f4e5b1385f388c81fc1b6994c /examples
parent77ce98ff186515cce217814886d9d5b899380c7b (diff)
downloadcsoap-1e0e97fe7b654ecd7f5315d129df6e57f3e63371.tar.gz
csoap-1e0e97fe7b654ecd7f5315d129df6e57f3e63371.tar.bz2
Fix nanoHTTP HTTPS client (still needs port in URL)
Diffstat (limited to 'examples')
-rw-r--r--examples/nanohttp/http_client.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/nanohttp/http_client.c b/examples/nanohttp/http_client.c
index 7c1b2f0..7deeb03 100644
--- a/examples/nanohttp/http_client.c
+++ b/examples/nanohttp/http_client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: http_client.c,v 1.7 2006/11/30 14:23:59 m0gg Exp $
+* $Id: http_client.c,v 1.8 2006/12/01 10:56:00 m0gg Exp $
*
* CSOAP Project: A http client/server library in C (example)
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -43,7 +43,7 @@ static void show_response(hresponse_t *res)
if (!res)
{
- fprintf(stderr, "hresponse_t is NULL!");
+ fprintf(stderr, "hresponse_t is NULL!\n");
return;
}
@@ -60,7 +60,7 @@ static void show_response(hresponse_t *res)
if (!res->in)
{
- fprintf(stderr, "No input stream!");
+ fprintf(stderr, "No input stream!\n");
return;
}
@@ -109,25 +109,27 @@ int main(int argc, char **argv)
/* Initialize httpc module */
if (httpc_init(argc, argv))
{
- fprintf(stderr, "Cannot inititialize httpc");
+ fprintf(stderr, "Cannot inititialize HTTP client\n");
exit(1);
}
/* Create the client connection object */
if (!(conn = httpc_new()))
{
- fprintf(stderr, "httpc_new failed");
+ fprintf(stderr, "httpc_new failed\n");
exit(1);
}
/* set the credentials, if specified */
if (username || password)
+ {
httpc_set_basic_authorization(conn, username, password);
+ }
/* Send GET method and receive response */
if ((status = httpc_get(conn, &res, argv[argc-1])) != H_OK)
{
- fprintf(stderr, "httpc_get failed (%s)", herror_message(status));
+ fprintf(stderr, "httpc_get failed (%s)\n", herror_message(status));
herror_release(status);
exit(1);
}