summaryrefslogtreecommitdiffstats
path: root/libcsoap
diff options
context:
space:
mode:
authorGravatar snowdrop2004-10-29 09:27:02 +0000
committerGravatar snowdrop2004-10-29 09:27:02 +0000
commit7b58a8fb0b95d6809fbe3e8c7dc7a05729b6c828 (patch)
treeebd31f5db83e2f94329dd25067cdc856feaf76f6 /libcsoap
parentd24d6ab7bbfda8e302af3a5cf8be62299d543c1a (diff)
downloadcsoap-7b58a8fb0b95d6809fbe3e8c7dc7a05729b6c828.tar.gz
csoap-7b58a8fb0b95d6809fbe3e8c7dc7a05729b6c828.tar.bz2
added hoption feature
Diffstat (limited to 'libcsoap')
-rw-r--r--libcsoap/soap-client.c33
-rwxr-xr-xlibcsoap/soap-ctx.h6
2 files changed, 33 insertions, 6 deletions
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c
index 2a56e11..160b255 100644
--- a/libcsoap/soap-client.c
+++ b/libcsoap/soap-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-client.c,v 1.10 2004/10/28 10:30:46 snowdrop Exp $
+* $Id: soap-client.c,v 1.11 2004/10/29 09:27:05 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -89,7 +89,10 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha
static int counter=1;
part_t *part;
int file_count=0;
-
+
+ /* for copy attachments */
+ char href[MAX_HREF_SIZE];
+
/* Create buffer */
buffer = xmlBufferCreate();
xmlNodeDump(buffer, call->env->root->doc,call->env->root, 1 ,0);
@@ -189,13 +192,33 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha
/* Build result */
status = _soap_client_build_result(res, &res_env);
- if (status != H_OK)
+ if (status != H_OK) {
+ hresponse_free(res);
+ httpc_free(conn);
return status;
+ }
/* Create Context */
*response = soap_ctx_new(res_env);
- soap_ctx_add_files(*response, res->attachments);
-
+/* soap_ctx_add_files(*response, res->attachments);*/
+
+ if (res->attachments!=NULL) {
+ part = res->attachments->parts;
+ while (part) {
+ soap_ctx_add_file(*response, part->filename, part->content_type, href);
+ part->deleteOnExit = 0;
+ part = part->next;
+ }
+ part = (*response)->attachments->parts;
+ while (part) {
+ part->deleteOnExit = 1;
+ part = part->next;
+ }
+ }
+
+
+ hresponse_free(res);
+ httpc_free(conn);
return H_OK;
}
diff --git a/libcsoap/soap-ctx.h b/libcsoap/soap-ctx.h
index 2ea107b..0aa8520 100755
--- a/libcsoap/soap-ctx.h
+++ b/libcsoap/soap-ctx.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.h,v 1.2 2004/10/28 10:30:46 snowdrop Exp $
+ * $Id: soap-ctx.h,v 1.3 2004/10/29 09:27:05 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -41,6 +41,10 @@ SoapCtx* soap_ctx_new(SoapEnv *env); /* should only be used internally */
/* Size of destination dest_href should be MAX_HREF_SIZE */
herror_t soap_ctx_add_file(SoapCtx* ctx, const char* filename, const char* content_type, char *dest_href);
+/*
+Used internally. Will switch the deleteOnExit flag from the
+given one to the added part.
+*/
void soap_ctx_add_files(SoapCtx* ctx, attachments_t *attachments);
void soap_ctx_free(SoapCtx* ctx);