+static void http_error(struct http_channel *hc, int no, const char *msg)
+{
+ struct http_response *rs = http_create_response(hc);
+
+ hc->response = rs;
+ hc->keep_alive = 0; // not keeping this HTTP session alive
+
+ sprintf(rs->code, "%d", no);
+
+ rs->msg = nmem_strdup(hc->nmem, msg);
+ rs->payload = nmem_malloc(hc->nmem, 100);
+ yaz_snprintf(rs->payload, 99, "<error>HTTP Error %d: %s</error>\n",
+ no, msg);
+ http_send_response(hc);
+}
+