From e413b0a94252b858ec346ca98155e7ab61660802 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 27 May 2013 10:05:23 +0200 Subject: [PATCH] Returns service XML now --- src/http_command.c | 13 +++++++++++++ src/pazpar2_config.c | 3 +++ test/test_url.urls | 1 + test/test_url_19.res | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 test/test_url_19.res diff --git a/src/http_command.c b/src/http_command.c index dd3d5f5..cdb7712 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -651,10 +651,23 @@ static void session_status(struct http_channel *c, struct http_session *s) static void cmd_service(struct http_channel *c) { struct http_session *s = locate_session(c); + xmlNode *xml_node; if (!s) return; response_open(c, "service"); + xml_node = s->psession->service->xml_node; + if (xml_node) + { + xmlNode *tmp = xmlCopyNode(xml_node, 1); + xmlBufferPtr buf = xmlBufferCreate(); + + xmlNodeDump(buf, tmp->doc, tmp, 0, 0); + + wrbuf_write(c->wrbuf, (const char *) buf->content, buf->use); + xmlBufferFree(buf); + } + response_close(c, "service"); release_session(c, s); } diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index 770ec7d..49a73d7 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -273,6 +273,8 @@ void service_destroy(struct conf_service *service) if (!pazpar2_decref(&service->ref_count, service->mutex)) { service_xslt_destroy(service); + if (service->xml_node) + xmlFreeNode(service->xml_node); pp2_charset_fact_destroy(service->charsets); ccl_qual_rm(&service->ccl_bibset); yaz_mutex_destroy(&service->mutex); @@ -744,6 +746,7 @@ static struct conf_service *service_create_static(struct conf_server *server, } } } + service->xml_node = xmlCopyNode(node, 1); return service; } diff --git a/test/test_url.urls b/test/test_url.urls index a3de7ac..4a0f2e3 100644 --- a/test/test_url.urls +++ b/test/test_url.urls @@ -16,3 +16,4 @@ test_url_settings.xml http://localhost:9763/search.pz2?session=1&command=setting http://localhost:9763/search.pz2?session=1&command=search&query=water 2 http://localhost:9763/search.pz2?session=1&command=show&block=1&sort=title:1p 2 http://localhost:9763/search.pz2?session=1&command=show&block=1&sort=date:0p +http://localhost:9763/search.pz2?session=1&command=service diff --git a/test/test_url_19.res b/test/test_url_19.res new file mode 100644 index 0000000..0f9cf45 --- /dev/null +++ b/test/test_url_19.res @@ -0,0 +1,36 @@ + +OK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 1.7.10.4