Updated tests due to more brief data and removed childish language.
[pazpar2-moved-to-github.git] / src / http_command.c
index 0de007b..2670b26 100644 (file)
@@ -17,15 +17,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
-/*
- * $Id: http_command.c,v 1.66 2007-10-28 18:55:26 adam Exp $
- */
-
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <sys/types.h>
-#if HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -36,10 +32,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <sys/time.h>
 #endif
 #include <yaz/snprintf.h>
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <yaz/yaz-util.h>
 
 #include "util.h"
@@ -246,7 +238,7 @@ static int process_settings(struct session *se, struct http_request *rq,
 static void cmd_exit(struct http_channel *c)
 {
     yaz_log(YLOG_WARN, "exit");
-    exit(0);
+    http_close_server();
 }
 
 static void cmd_init(struct http_channel *c)
@@ -542,8 +534,8 @@ static void show_raw_record_ok_binary(void *data, const char *buf, size_t sz)
 
 void show_raw_reset(void *data, struct http_channel *c, void *data2)
 {
-    struct client *client = data;
-    client_show_raw_remove(client, data2);
+    //struct client *client = data;
+    //client_show_raw_remove(client, data2);
 }
 
 static void cmd_record_ready(void *data);
@@ -621,7 +613,9 @@ static void cmd_record(struct http_channel *c)
     else
     {
         wrbuf_puts(c->wrbuf, "<record>\n");
-        wrbuf_printf(c->wrbuf, "<recid>%s</recid>\n", rec->recid);
+        wrbuf_puts(c->wrbuf, "<recid>");
+        wrbuf_xmlputs(c->wrbuf, rec->recid);
+        wrbuf_puts(c->wrbuf, "</recid>\n");
         write_metadata(c->wrbuf, service, rec->metadata, 1);
         for (r = rec->records; r; r = r->next)
             write_subrecord(r, c->wrbuf, service, 1);
@@ -696,7 +690,9 @@ static void show_records(struct http_channel *c, int active)
             write_subrecord(p, c->wrbuf, service, 0); // subrecs w/o details
         if (ccount > 1)
             wrbuf_printf(c->wrbuf, "<count>%d</count>\n", ccount);
-        wrbuf_printf(c->wrbuf, "<recid>%s</recid>\n", rec->recid);
+        wrbuf_puts(c->wrbuf, "<recid>");
+        wrbuf_xmlputs(c->wrbuf, rec->recid);
+        wrbuf_puts(c->wrbuf, "</recid>\n");
         wrbuf_puts(c->wrbuf, "</hit>\n");
     }
 
@@ -833,9 +829,7 @@ static void cmd_stat(struct http_channel *c)
     wrbuf_printf(c->wrbuf, "<clients>%d</clients>\n", stat.num_clients);
     wrbuf_printf(c->wrbuf, "<unconnected>%d</unconnected>\n", stat.num_no_connection);
     wrbuf_printf(c->wrbuf, "<connecting>%d</connecting>\n", stat.num_connecting);
-    wrbuf_printf(c->wrbuf, "<initializing>%d</initializing>\n", stat.num_initializing);
-    wrbuf_printf(c->wrbuf, "<searching>%d</searching>\n", stat.num_searching);
-    wrbuf_printf(c->wrbuf, "<presenting>%d</presenting>\n", stat.num_presenting);
+    wrbuf_printf(c->wrbuf, "<working>%d</working>\n", stat.num_working);
     wrbuf_printf(c->wrbuf, "<idle>%d</idle>\n", stat.num_idle);
     wrbuf_printf(c->wrbuf, "<failed>%d</failed>\n", stat.num_failed);
     wrbuf_printf(c->wrbuf, "<error>%d</error>\n", stat.num_error);