From: Adam Dickmeiss Date: Mon, 2 Sep 2013 10:39:51 +0000 (+0200) Subject: Strip #-suffix for ZOOM URLs PAZ-892 X-Git-Tag: v1.6.35~11 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=1034064601914be4fd6de1b8fdad1ce13eab1c1d;p=pazpar2-moved-to-github.git Strip #-suffix for ZOOM URLs PAZ-892 --- diff --git a/src/connection.c b/src/connection.c index 465693e..710d436 100644 --- a/src/connection.c +++ b/src/connection.c @@ -411,6 +411,7 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) const char *charset; const char *sru; const char *sru_version = 0; + WRBUF w; struct session_database *sdb = client_get_database(con->client); const char *apdulog = session_setting_oneval(sdb, PZ_APDULOG); @@ -471,26 +472,19 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) return -1; } + w = wrbuf_alloc(); if (sru && *sru && !strstr(con->url, "://")) - { - WRBUF w = wrbuf_alloc(); wrbuf_puts(w, "http://"); - wrbuf_puts(w, con->url); - ZOOM_connection_connect(con->link, wrbuf_cstr(w), 0); - wrbuf_destroy(w); - } - else if (strchr(con->url, '#')) + if (strchr(con->url, '#')) { const char *cp = strchr(con->url, '#'); - WRBUF w = wrbuf_alloc(); wrbuf_write(w, con->url, cp - con->url); - ZOOM_connection_connect(con->link, wrbuf_cstr(w), 0); - wrbuf_destroy(w); } else - { - ZOOM_connection_connect(con->link, con->url, 0); - } + wrbuf_puts(w, con->url); + + ZOOM_connection_connect(con->link, wrbuf_cstr(w), 0); + con->iochan = iochan_create(-1, connection_handler, 0, "connection_socket"); con->state = Conn_Connecting; iochan_settimeout(con->iochan, con->operation_timeout); @@ -499,6 +493,7 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man) client_set_state(con->client, Client_Connecting); ZOOM_options_destroy(zoptions); + wrbuf_destroy(w); return 0; }