X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-c.c;h=da0d86743d0dac3c4f77e758f45053b514fb362a;hp=3d38105378c178db1b83062d014f93a2e1c96cd4;hb=ce627148dbba2878565b8d9da33f6b25f33da4bd;hpb=192c53b56174fa2d80db61029ba95bfa2a1a480a diff --git a/src/zoom-c.c b/src/zoom-c.c index 3d38105..da0d867 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -361,7 +361,6 @@ ZOOM_API(void) const char *host, int portnum) { const char *val; - const char *http_lead; initlog(); @@ -428,16 +427,18 @@ ZOOM_API(void) else c->lang = 0; - val = ZOOM_options_get(c->options, "sru"); - if (val && *val && !strstr(host, "://")) - http_lead = "http://"; - else - http_lead = ""; - c->sru_mode = get_sru_mode_from_string(val); - if (host) { char hostn[128]; + const char *http_lead; + + val = ZOOM_options_get(c->options, "sru"); + if (val && *val && !strstr(host, "://")) + http_lead = "http://"; + else + http_lead = ""; + c->sru_mode = get_sru_mode_from_string(val); + xfree(c->host_port); if (portnum) { @@ -1063,7 +1064,7 @@ static zoom_ret do_connect_host(ZOOM_connection c, const char *logical_url) if (c->cs) cs_close(c->cs); - c->cs = cs_create_host_proxy(logical_url, 0, &add, + c->cs = cs_create_host_proxy(logical_url, CS_FLAGS_DNS_NO_BLOCK, &add, c->tproxy ? c->tproxy : c->proxy); if (c->cs && c->cs->protocol == PROTO_HTTP) @@ -1128,7 +1129,7 @@ ZOOM_API(ZOOM_record) const char *schema = ZOOM_options_get(s->options, "schema"); - return ZOOM_record_cache_lookup(s, pos, syntax, elementSetName, schema); + return ZOOM_record_cache_lookup_i(s, pos, syntax, elementSetName, schema); } ZOOM_API(ZOOM_record) @@ -1562,6 +1563,7 @@ static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres) location, &host_change); if (do_connect_host(c, location) == zoom_complete) return; /* connect failed.. */ + cs_rcvconnect(c->cs); send_HTTP_redirect(c, location); return; } @@ -1959,7 +1961,7 @@ static void ZOOM_connection_do_io(ZOOM_connection c, int mask) if (c->cs->io_pending & CS_WANT_READ) mask += ZOOM_SELECT_READ; ZOOM_connection_set_mask(c, mask); - event = ZOOM_Event_create(ZOOM_EVENT_NONE); + event = ZOOM_Event_create(ZOOM_EVENT_CONNECT); ZOOM_connection_put_event(c, event); } else if (ret == 0) @@ -1972,9 +1974,11 @@ static void ZOOM_connection_do_io(ZOOM_connection c, int mask) else { /* no init request for SRW .. */ - assert(c->tasks->which == ZOOM_TASK_CONNECT); - ZOOM_connection_remove_task(c); - ZOOM_connection_set_mask(c, 0); + if (c->tasks->which == ZOOM_TASK_CONNECT) + { + ZOOM_connection_remove_task(c); + ZOOM_connection_set_mask(c, 0); + } ZOOM_connection_exec_task(c); } c->state = STATE_ESTABLISHED;