}
#endif
protocol = conn->protocol;
- if (conn->protocol == PROTO_HTTP)
- set_base("");
- else
- set_base("Default");
printf("Connecting...");
fflush(stdout);
if (cs_connect(conn, add) < 0)
printf("OK.\n");
cs_print_session_info(conn);
if (basep && *basep)
- set_base (basep);
+ set_base(basep);
+ else if (protocol == PROTO_Z3950)
+ set_base("Default");
+
if (protocol == PROTO_Z3950)
{
send_initRequest(type_and_host);
strncpy(cur_host, arg, sizeof(cur_host)-1);
cur_host[sizeof(cur_host)-1] = 0;
}
+
+ set_base("");
r = session_connect(cur_host);
if (conn && conn->protocol == PROTO_HTTP)
queryType = QueryType_CQL;
+
+
return r;
}
*path = '/';
strcpy(path+1, databaseNames[0]);
+ printf("path=%s\n", path);
gdu = z_get_HTTP_Request_host_path(out, host_port, path);
if (!yaz_matchstr(sru_method, "get"))
int ret = -1;
const char *connection_head = z_HTTP_header_lookup(hres->headers,
"Connection");
+
+ if (hres->code != 200)
+ {
+ printf("HTTP Error Status=%d\n", hres->code);
+ }
+
if (!yaz_srw_check_content_type(hres))
printf("Content type does not appear to be XML\n");
else
printf("Got update response. Status: %s\n",
sr->u.update_response->operationStatus);
else
+ {
+ printf("Decoding of SRW package failed\n");
ret = -1;
+ }
}
else if (soap_package && (soap_package->which == Z_SOAP_fault
|| soap_package->which == Z_SOAP_error))
{
- printf("HTTP Error Status=%d\n", hres->code);
printf("SOAP Fault code %s\n",
soap_package->u.fault->fault_code);
printf("SOAP Fault string %s\n",
odr_destroy(o);
}
if (ret)
- {
- if (hres->code != 200)
- {
- printf("HTTP Error Status=%d\n", hres->code);
- }
- else
- {
- printf("Decoding of SRW package failed\n");
- }
- close_session();
- }
+ close_session(); /* close session on error */
else
{
if (!strcmp(hres->version, "1.0"))