+const char *yaz_check_location(ODR odr, const char *uri, const char *location,
+ int *host_change)
+{
+ if (*location == '/')
+ { /* relative location */
+ char *args = 0;
+ char *nlocation = (char *) odr_malloc(odr, strlen(location)
+ + strlen(uri) + 3);
+ strcpy(nlocation, uri);
+ cs_get_host_args(nlocation, (const char **) &args);
+ if (!args || !*args)
+ args = nlocation + strlen(nlocation);
+ else
+ args--;
+ strcpy(args, location);
+ *host_change = 0;
+ return nlocation;
+ }
+ else
+ {
+ /* we don't check if host is the same as before - yet */
+ *host_change = 1;
+ return location;
+ }
+}
+