+/* $Id: http_command.c,v 1.32 2007-04-10 08:48:56 adam Exp $
+ Copyright (c) 2006-2007, Index Data.
+
+This file is part of Pazpar2.
+
+Pazpar2 is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Pazpar2; see the file LICENSE. If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+ */
+
/*
- * $Id: http_command.c,v 1.27 2007-03-20 05:32:58 quinn Exp $
+ * $Id: http_command.c,v 1.32 2007-04-10 08:48:56 adam Exp $
*/
#include <stdio.h>
struct session *psession;
unsigned int session_id;
int timestamp;
+ NMEM nmem;
struct http_session *next;
};
struct http_session *http_session_create()
{
- struct http_session *r = xmalloc(sizeof(*r));
- r->psession = new_session();
+ NMEM nmem = nmem_create();
+ struct http_session *r = nmem_malloc(nmem, sizeof(*r));
+
+ r->psession = new_session(nmem);
r->session_id = 0;
r->timestamp = 0;
+ r->nmem = nmem;
r->next = session_list;
session_list = r;
r->timeout_iochan = iochan_create(-1, session_timeout, 0);
}
iochan_destroy(s->timeout_iochan);
destroy_session(s->psession);
- xfree(s);
+ nmem_destroy(s->nmem);
}
static void error(struct http_response *rs, char *code, char *msg, char *txt)
name++;
}
wrbuf_puts(c->wrbuf, "</termlist>");
- rs->payload = nmem_strdup(rq->channel->nmem, wrbuf_buf(c->wrbuf));
+ rs->payload = nmem_strdup(rq->channel->nmem, wrbuf_cstr(c->wrbuf));
http_send_response(c);
}
}
wrbuf_puts(c->wrbuf, "</bytarget>");
- rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf));
http_send_response(c);
}
for (r = rec->records; r; r = r->next)
write_subrecord(r, c->wrbuf, service);
wrbuf_puts(c->wrbuf, "</record>\n");
- rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf));
http_send_response(c);
}
}
wrbuf_puts(c->wrbuf, "</show>\n");
- rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf));
http_send_response(c);
}
wrbuf_printf(c->wrbuf, "<failed>%d</failed>\n", stat.num_failed);
wrbuf_printf(c->wrbuf, "<error>%d</error>\n", stat.num_error);
wrbuf_puts(c->wrbuf, "</stat>");
- rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf));
http_send_response(c);
}
wrbuf_printf(c->wrbuf, " </version>\n");
wrbuf_puts(c->wrbuf, "</info>");
- rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf));
http_send_response(c);
}