projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prefix URL with http:// if sru setting hints SRU/Solr mode YAZ-731
[yaz-moved-to-github.git]
/
src
/
zoom-c.c
diff --git
a/src/zoom-c.c
b/src/zoom-c.c
index
331f544
..
c3d7f0c
100644
(file)
--- a/
src/zoom-c.c
+++ b/
src/zoom-c.c
@@
-370,6
+370,7
@@
ZOOM_API(void)
const char *host, int portnum)
{
const char *val;
const char *host, int portnum)
{
const char *val;
+ const char *http_lead;
initlog();
initlog();
@@
-436,17
+437,25
@@
ZOOM_API(void)
else
c->lang = 0;
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)
{
if (host)
{
+ char hostn[128];
xfree(c->host_port);
if (portnum)
{
xfree(c->host_port);
if (portnum)
{
- char hostn[128];
sprintf(hostn, "%.80s:%d", host, portnum);
sprintf(hostn, "%.80s:%d", host, portnum);
- c->host_port = xstrdup(hostn);
+ host = hostn;
}
}
- else
- c->host_port = xstrdup(host);
+ c->host_port = xmalloc(strlen(host) + strlen(http_lead) + 1);
+ strcpy(c->host_port, http_lead);
+ strcat(c->host_port, host);
}
{
}
{
@@
-482,9
+491,6
@@
ZOOM_API(void)
}
}
}
}
- val = ZOOM_options_get(c->options, "sru");
- c->sru_mode = get_sru_mode_from_string(val);
-
xfree(c->sru_version);
val = ZOOM_options_get(c->options, "sru_version");
c->sru_version = xstrdup(val ? val : "1.2");
xfree(c->sru_version);
val = ZOOM_options_get(c->options, "sru_version");
c->sru_version = xstrdup(val ? val : "1.2");
@@
-1559,11
+1565,8
@@
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
int host_change = 0;
location = yaz_check_location(c->odr_in, c->host_port,
location, &host_change);
int host_change = 0;
location = yaz_check_location(c->odr_in, c->host_port,
location, &host_change);
- if (host_change)
- {
- if (do_connect_host(c, location) == zoom_complete)
- return; /* connect failed.. */
- }
+ if (do_connect_host(c, location) == zoom_complete)
+ return; /* connect failed.. */
send_HTTP_redirect(c, location);
return;
}
send_HTTP_redirect(c, location);
return;
}