Returns service XML now
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 27 May 2013 08:05:23 +0000 (10:05 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 27 May 2013 08:05:23 +0000 (10:05 +0200)
src/http_command.c
src/pazpar2_config.c
test/test_url.urls
test/test_url_19.res [new file with mode: 0644]

index dd3d5f5..cdb7712 100644 (file)
@@ -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);
 }
index 770ec7d..49a73d7 100644 (file)
@@ -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;
 }
 
index a3de7ac..4a0f2e3 100644 (file)
@@ -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 (file)
index 0000000..0f9cf45
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service><status>OK</status><service xmlns="http://www.indexdata.com/pazpar2/1.0">
+      <icu_chain id="relevance" locale="en">
+       <transform rule="[:Control:] Any-Remove"/>
+       <tokenize rule="l"/>
+       <transform rule="[[:WhiteSpace:][:Punctuation:]`] Remove"/>
+       <casemap rule="l"/>
+      </icu_chain>
+      
+      <icu_chain id="sort" locale="en">
+       <transform rule="[[:Control:][:WhiteSpace:][:Punctuation:]`] Remove"/>
+       <casemap rule="l"/>
+      </icu_chain>
+      
+      <icu_chain id="mergekey" locale="en">
+       <tokenize rule="l"/>
+       <transform rule="[[:Control:][:WhiteSpace:][:Punctuation:]`] Remove"/>
+       <casemap rule="l"/>
+      </icu_chain>
+      
+      <icu_chain id="facet" locale="en">
+       <display/>
+       <transform rule="Title"/>
+      </icu_chain>
+      
+      <metadata name="url" merge="unique"/>
+      <metadata name="title" brief="yes" sortkey="skiparticle" merge="longest" rank="6" mergekey="required"/>
+      <metadata name="title-remainder" brief="yes" merge="longest" rank="5"/>
+      <metadata name="isbn"/>
+      <metadata name="date" brief="yes" sortkey="numeric" type="year" merge="range" termlist="yes"/>
+      <metadata name="author" brief="yes" termlist="yes" merge="longest" rank="2" mergekey="optional"/>
+      <metadata name="subject" merge="unique" termlist="yes" rank="3"/>
+      <metadata name="id"/>
+      <metadata name="lccn" merge="unique"/>
+      <metadata name="description" brief="yes" merge="longest" rank="3"/>
+    </service></service>
\ No newline at end of file