/* Find the separator at the end of the host name, or the '?' in cases like  */
static const char* find_host_sep(const char *url)
/* Find the separator at the end of the host name, or the '?' in cases like  */
static const char* find_host_sep(const char *url)
{
  const char *sep;
  const char *query;
  sep = strstr(url, "
  if(!sep)
    sep = url;
  else
    sep += 2;
  query = strchr(sep, '?');
  sep = strchr(sep, '/');
  if(!sep)
    sep = url + strlen(url);
  if(!query)
    query = url + strlen(url);
  return sep < query ? sep : query;
}