diff options
author | snowdrop | 2005-12-19 14:18:26 +0000 |
---|---|---|
committer | snowdrop | 2005-12-19 14:18:26 +0000 |
commit | 8684b8cf790b76fc68e2cc2b7f797c505c70ee2f (patch) | |
tree | 57a5b9a7280a4dd18ebd0a5f5c64cfafaa024418 | |
parent | 99a176eedc568df17240abdb0abad9b0931b791e (diff) | |
download | csoap-8684b8cf790b76fc68e2cc2b7f797c505c70ee2f.tar.gz csoap-8684b8cf790b76fc68e2cc2b7f797c505c70ee2f.tar.bz2 |
pathed stuf from mailinglist after 1.0.4rc1
-rw-r--r-- | libcsoap/soap-client.c | 22 | ||||
-rw-r--r-- | nanohttp/nanohttp-client.c | 16 | ||||
-rw-r--r-- | nanohttp/nanohttp-client.h | 10 |
3 files changed, 34 insertions, 14 deletions
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c index dfb6898..5c3aeac 100644 --- a/libcsoap/soap-client.c +++ b/libcsoap/soap-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-client.c,v 1.18 2005/12/19 14:06:16 snowdrop Exp $ +* $Id: soap-client.c,v 1.19 2005/12/19 14:18:26 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -124,21 +124,21 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha status = httpc_post_begin(conn, url); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } status = http_output_stream_write_string(conn->out, content); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } status = httpc_post_end(conn, &res); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } @@ -152,21 +152,21 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha sprintf(start_id, "289247829121218%d", counter++); status = httpc_mime_begin(conn, url, start_id, "", "text/xml"); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } status = httpc_mime_next(conn, start_id, "text/xml", "binary"); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } status = http_output_stream_write(conn->out, content, strlen(content)); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } @@ -178,7 +178,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha part->content_type, part->transfer_encoding, part->filename); if (status != H_OK) { log_error2("Send file failed. Status:%d", status); - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } @@ -187,7 +187,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha status = httpc_mime_end(conn, &res); if (status != H_OK) { - httpc_free(conn); + httpc_close_free(conn); xmlBufferFree(buffer); return status; } @@ -200,7 +200,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha status = _soap_client_build_result(res, &res_env); if (status != H_OK) { hresponse_free(res); - httpc_free(conn); + httpc_close_free(conn); return status; } @@ -224,7 +224,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha hresponse_free(res); - httpc_free(conn); + httpc_close_free(conn); return H_OK; } diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c index 79d6b0a..cd13af8 100644 --- a/nanohttp/nanohttp-client.c +++ b/nanohttp/nanohttp-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-client.c,v 1.29 2005/12/19 14:06:16 snowdrop Exp $ +* $Id: nanohttp-client.c,v 1.30 2005/12/19 14:18:26 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -126,6 +126,20 @@ httpc_free(httpc_conn_t * conn) } +/*-------------------------------------------------- + FUNCTION: httpc_close_free + DESC: Close and free the given http client object. + ----------------------------------------------------*/ +void +httpc_close_free(httpc_conn_t * conn) +{ + if (conn == NULL) + return; + + hsocket_close(conn->sock); + httpc_free(conn); +} + /*-------------------------------------------------- FUNCTION: httpc_set_header diff --git a/nanohttp/nanohttp-client.h b/nanohttp/nanohttp-client.h index 020f7e3..395b29a 100644 --- a/nanohttp/nanohttp-client.h +++ b/nanohttp/nanohttp-client.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: nanohttp-client.h,v 1.15 2005/07/27 07:45:57 snowdrop Exp $ + * $Id: nanohttp-client.h,v 1.16 2005/12/19 14:18:26 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -76,11 +76,17 @@ httpc_conn_t* httpc_new(); void httpc_close_free(httpc_conn_t* conn); /** - Release a connections + Release a connection + (use httpc_close_free() instead) */ void httpc_free(httpc_conn_t* conn); /** + * Close and release a connection + */ +void httpc_close_free(httpc_conn_t* conn); + +/** Set header element (key,value) pair. */ int httpc_set_header(httpc_conn_t *conn, const char* key, const char* value); |