+http_server_t http_server_create(void)
+{
+ http_server_t hs = xmalloc(sizeof(*hs));
+ hs->mutex = 0;
+ hs->proxy_addr = 0;
+ hs->ref_count = 1;
+ hs->http_sessions = 0;
+ hs->record_file = 0;
+
+ log_level_post = yaz_log_module_level("post");
+
+ return hs;
+}
+
+void http_server_destroy(http_server_t hs)
+{
+ if (hs)
+ {
+ int r;
+
+ yaz_mutex_enter(hs->mutex); /* OK: hs->mutex may be NULL */
+ r = --(hs->ref_count);
+ yaz_mutex_leave(hs->mutex);
+
+ if (r == 0)
+ {
+ http_sessions_destroy(hs->http_sessions);
+ xfree(hs->proxy_addr);
+ yaz_mutex_destroy(&hs->mutex);
+ if (hs->record_file)
+ fclose(hs->record_file);
+ xfree(hs);
+ }
+ }
+}
+
+void http_server_incref(http_server_t hs)
+{
+ assert(hs);
+ yaz_mutex_enter(hs->mutex);
+ (hs->ref_count)++;
+ yaz_mutex_leave(hs->mutex);
+}
+
+void http_mutex_init(struct conf_server *server)
+{
+ assert(server);
+
+ assert(server->http_server->mutex == 0);
+ pazpar2_mutex_create(&server->http_server->mutex, "http_server");
+ server->http_server->http_sessions = http_sessions_create();
+}