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
Example of punctuals removal at sentence end
[yaz-moved-to-github.git]
/
src
/
zoom-c.c
diff --git
a/src/zoom-c.c
b/src/zoom-c.c
index
742b956
..
3615ed9
100644
(file)
--- a/
src/zoom-c.c
+++ b/
src/zoom-c.c
@@
-70,8
+70,9
@@
void ZOOM_set_dset_error(ZOOM_connection c, int error,
}
if (addinfo && addinfo2)
{
}
if (addinfo && addinfo2)
{
- c->addinfo = (char*) xmalloc(strlen(addinfo) + strlen(addinfo2) + 2);
+ c->addinfo = (char*) xmalloc(strlen(addinfo) + strlen(addinfo2) + 3);
strcpy(c->addinfo, addinfo);
strcpy(c->addinfo, addinfo);
+ strcat(c->addinfo, ": ");
strcat(c->addinfo, addinfo2);
}
else if (addinfo)
strcat(c->addinfo, addinfo2);
}
else if (addinfo)
@@
-266,6
+267,7
@@
ZOOM_API(ZOOM_connection)
c->host_port = 0;
c->proxy = 0;
c->host_port = 0;
c->proxy = 0;
+ c->tproxy = 0;
c->charset = c->lang = 0;
c->charset = c->lang = 0;
@@
-388,6
+390,16
@@
ZOOM_API(void)
c->proxy = xstrdup(val);
}
c->proxy = xstrdup(val);
}
+ xfree(c->tproxy);
+ c->tproxy = 0;
+ val = ZOOM_options_get(c->options, "tproxy");
+ if (val && *val)
+ {
+ yaz_log(c->log_details, "%p ZOOM_connection_connect tproxy=%s", c, val);
+ c->tproxy = xstrdup(val);
+ }
+
+
xfree(c->charset);
c->charset = 0;
val = ZOOM_options_get(c->options, "charset");
xfree(c->charset);
c->charset = 0;
val = ZOOM_options_get(c->options, "charset");
@@
-506,8
+518,15
@@
ZOOM_API(void)
ZOOM_options_get_int(c->options, "preferredMessageSize", 1024*1024);
c->async = ZOOM_options_get_bool(c->options, "async", 0);
ZOOM_options_get_int(c->options, "preferredMessageSize", 1024*1024);
c->async = ZOOM_options_get_bool(c->options, "async", 0);
+
+ if (c->sru_mode == zoom_sru_error)
+ {
+ ZOOM_set_error(c, ZOOM_ERROR_UNSUPPORTED_PROTOCOL, val);
+ ZOOM_connection_remove_tasks(c);
+ return;
+ }
+
yaz_log(c->log_details, "%p ZOOM_connection_connect async=%d", c, c->async);
yaz_log(c->log_details, "%p ZOOM_connection_connect async=%d", c, c->async);
-
ZOOM_connection_add_task(c, ZOOM_TASK_CONNECT);
if (!c->async)
ZOOM_connection_add_task(c, ZOOM_TASK_CONNECT);
if (!c->async)
@@
-583,6
+602,7
@@
ZOOM_API(void)
ZOOM_connection_remove_events(c);
xfree(c->host_port);
xfree(c->proxy);
ZOOM_connection_remove_events(c);
xfree(c->host_port);
xfree(c->proxy);
+ xfree(c->tproxy);
xfree(c->charset);
xfree(c->lang);
xfree(c->cookie_out);
xfree(c->charset);
xfree(c->lang);
xfree(c->cookie_out);
@@
-1037,7
+1057,8
@@
static zoom_ret do_connect_host(ZOOM_connection c, const char *logical_url)
if (c->cs)
cs_close(c->cs);
if (c->cs)
cs_close(c->cs);
- c->cs = cs_create_host_proxy(logical_url, 0, &add, c->proxy);
+ c->cs = cs_create_host_proxy(logical_url, 0, &add,
+ c->tproxy ? c->tproxy : c->proxy);
if (c->cs && c->cs->protocol == PROTO_HTTP)
{
if (c->cs && c->cs->protocol == PROTO_HTTP)
{
@@
-1526,7
+1547,7
@@
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
{
zoom_ret cret = zoom_complete;
int ret = -1;
{
zoom_ret cret = zoom_complete;
int ret = -1;
- const char *addinfo = 0;
+ char *addinfo = 0;
const char *connection_head = z_HTTP_header_lookup(hres->headers,
"Connection");
const char *location;
const char *connection_head = z_HTTP_header_lookup(hres->headers,
"Connection");
const char *location;
@@
-1556,7
+1577,7
@@
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
}
else
{
}
else
{
- ret = ZOOM_handle_sru(c, hres, &cret);
+ ret = ZOOM_handle_sru(c, hres, &cret, &addinfo);
if (ret == 0)
{
if (c->no_redirects) /* end of redirect. change hosts again */
if (ret == 0)
{
if (c->no_redirects) /* end of redirect. change hosts again */
@@
-1569,7
+1590,11
@@
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
if (hres->code != 200)
ZOOM_set_HTTP_error(c, hres->code, 0, 0);
else
if (hres->code != 200)
ZOOM_set_HTTP_error(c, hres->code, 0, 0);
else
+ {
+ yaz_log(YLOG_LOG, "set error... addinfo=%s", addinfo ?
+ addinfo : "NULL");
ZOOM_set_error(c, ZOOM_ERROR_DECODE, addinfo);
ZOOM_set_error(c, ZOOM_ERROR_DECODE, addinfo);
+ }
ZOOM_connection_close(c);
}
if (cret == zoom_complete)
ZOOM_connection_close(c);
}
if (cret == zoom_complete)
@@
-1601,6
+1626,8
@@
static void handle_http(ZOOM_connection c, Z_HTTP_Response *hres)
c->reconnect_ok = 0;
}
}
c->reconnect_ok = 0;
}
}
+ else
+ c->reconnect_ok = 1; /* if the server closes anyway */
}
}
#endif
}
}
#endif
@@
-1671,7
+1698,6
@@
static int do_read(ZOOM_connection c)
#endif
}
}
#endif
}
}
- c->reconnect_ok = 0;
}
return 1;
}
}
return 1;
}