From d7bead298ebcacf0726f2ea25764003526b564b7 Mon Sep 17 00:00:00 2001 From: m0gg Date: Sat, 16 Dec 2006 16:09:45 +0000 Subject: Code cleanup --- TODO | 6 +++--- libcsoap/soap-nhttp.c | 47 ++++++++++++++++++++++------------------------- nanohttp/nanohttp-url.c | 14 +++++++++++++- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/TODO b/TODO index ba36121..7ee64a0 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.10 2006/12/08 21:21:41 m0gg Exp $ +$Id: TODO,v 1.11 2006/12/16 16:09:45 m0gg Exp $ =============================================================================== Things to do _before_ 1.2 release: @@ -17,9 +17,8 @@ nanohttp: csoap: ------ - move service description documents from router to service (???) -- add examples from http://www.xmethods.org (Google, UDDI) +- Re-enable WSDL via HTTP GET - Check portability to Win32/Linux/MaxOS (only tested on FreeBSD 6.2) -- soap-nudp.c needs testing - Improve API documentation - Add reference to http://www.w3.org/TR/SOAP-attachments - Write README.xmlsec like README.ssl @@ -43,6 +42,7 @@ nanohttp: csoap: ------ +- add examples from http://www.xmethods.org (Google, UDDI) - soap-nudp.c one thread per request (see soap_nudp_server_run) - soap-nudp message re-transmission - http://www.ws-i.org/Profiles/BasicProfile-1.0.html conformance testing diff --git a/libcsoap/soap-nhttp.c b/libcsoap/soap-nhttp.c index 22f78de..d43de46 100644 --- a/libcsoap/soap-nhttp.c +++ b/libcsoap/soap-nhttp.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-nhttp.c,v 1.10 2006/12/06 11:27:20 m0gg Exp $ +* $Id: soap-nhttp.c,v 1.11 2006/12/16 16:09:45 m0gg Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -99,18 +99,13 @@ _soap_nhttp_send_fault(httpd_conn_t *conn, const char *message) return ret; } -static herror_t -_soap_nhttp_send(httpd_conn_t *conn, struct SoapCtx *context, struct SoapEnv *env) -{ - return _soap_nhttp_send_document(conn, env->root->doc); -} - static int _soap_nhttp_xml_io_read(void *ctx, char *buffer, int len) { int ret; - - struct http_input_stream_t *in = (struct http_input_stream_t *)ctx; + struct http_input_stream_t *in; + + in = (struct http_input_stream_t *)ctx; if (!http_input_stream_is_ready(in)) return 0; @@ -147,11 +142,11 @@ soap_nhttp_process(httpd_conn_t * conn, struct hrequest_t * req) { char *action; struct SoapEnv *env; - struct SoapCtx *ctx; + struct SoapCtx *request; struct SoapCtx *response; herror_t err; -/* if (req->method == HTTP_REQUEST_GET && router->wsdl) + /* if (req->method == HTTP_REQUEST_GET && router->wsdl) { _soap_nhttp_send_document(conn, router->wsdl); return; @@ -182,35 +177,31 @@ soap_nhttp_process(httpd_conn_t * conn, struct hrequest_t * req) if (env == NULL) { - _soap_nhttp_send_fault(conn, "Can not receive POST data!"); + _soap_nhttp_send_fault(conn, "Cannot receive POST data!"); return; } - ctx = soap_ctx_new(env); + request = soap_ctx_new(env); if ((action = hpairnode_get_ignore_case(req->header, SOAP_NHTTP_SOAP_ACTION))) { - xmlURI *uri; - - uri = xmlParseURI(action); - soap_addressing_set_action(env, uri); - xmlFree(uri); + soap_addressing_set_action_string(env, action); } - xmlDocFormatDump(stdout, ctx->env->root->doc, 1); + /* xmlDocFormatDump(stdout, ctx->env->root->doc, 1); */ - soap_ctx_add_files(ctx, req->attachments); + soap_ctx_add_files(request, req->attachments); /* only local part is interesting... soap_addressing_set_to_address_string(ctx->env, req->path); */ - soap_transport_process(ctx, &response); + soap_transport_process(request, &response); _soap_nhttp_send_document(conn, response->env->root->doc); soap_ctx_free(response); - soap_ctx_free(ctx); + soap_ctx_free(request); return; } @@ -232,7 +223,13 @@ soap_nhttp_server_init_args(int argc, char **argv) return err; } - return soap_admin_init_args(argc, argv); + if ((err = soap_admin_init_args(argc, argv)) != H_OK) + { + log_error2("soap_admin_init_args failed (%s)", herror_message(err)); + return err; + } + + return H_OK; } static herror_t @@ -280,7 +277,7 @@ _soap_nhttp_client_invoke(void *unused, struct SoapCtx *request, struct SoapCtx /* for copy attachments */ char href[MAX_HREF_SIZE]; - log_verbose1("nanohttp client"); + /* log_verbose1("nanohttp client"); */ xmlDocDumpMemory(request->env->root->doc, &buffer, &size); @@ -406,7 +403,7 @@ _soap_nhttp_client_invoke(void *unused, struct SoapCtx *request, struct SoapCtx hresponse_free(res); httpc_close_free(conn); - log_verbose1("done"); + /* log_verbose1("done"); */ return H_OK; } diff --git a/nanohttp/nanohttp-url.c b/nanohttp/nanohttp-url.c index 194eba9..316fd27 100644 --- a/nanohttp/nanohttp-url.c +++ b/nanohttp/nanohttp-url.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-url.c,v 1.2 2006/12/10 19:21:07 m0gg Exp $ +* $Id: nanohttp-url.c,v 1.3 2006/12/16 16:09:45 m0gg Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -29,6 +29,18 @@ #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + #ifdef HAVE_ERRNO_H #include #endif -- cgit v1.1-32-gdbae