ctx->uri = uri;
ctx->refcnt = 0;
- if (!uri->protocol || strcmp (uri->protocol, "http") == 0)
+ if (strcmp (uri->protocol, "http") == 0)
ctx->protocol = SOUP_PROTOCOL_HTTP;
else if (strcmp (uri->protocol, "https") == 0)
ctx->protocol = SOUP_PROTOCOL_SHTTP;
SoupContext *ret = NULL;
SoupUri *suri = soup_uri_new (uri);
+ if (!suri->protocol) {
+ soup_uri_free (suri);
+ return NULL;
+ }
+
if (!soup_servers)
soup_servers = g_hash_table_new (soup_str_case_hash,
soup_str_case_equal);
if (proxy)
uri = soup_uri_to_string (proxy->uri, FALSE);
- else
- uri = g_strconcat (req->context->uri->path,
- req->context->uri->querystring);
+ else if (req->context->uri->querystring)
+ uri = g_strconcat (req->context->uri->path, "?",
+ req->context->uri->querystring, NULL);
+ else
+ uri = g_strdup (req->context->uri->path);
/* If we specify an absoluteURI in the request line, the
Host header MUST be ignored by the proxy. */
static gint
soup_uri_get_default_port (gchar *proto)
{
- if (!proto || *proto == '\0') {
- g_warning ("URI Protocol not specified, defaulting to HTTP.");
- return 80;
- } else if (strcasecmp (proto, "http") == 0)
+ if (strcasecmp (proto, "http") == 0)
return 80;
else if (strcasecmp (proto, "https") == 0)
return 443;
g_free (uri);
}
+
+static void
+soup_debug_print_uri (SoupUri *uri)
+{
+ g_return_if_fail (uri != NULL);
+
+ g_print ("Protocol: %s\n", uri->protocol);
+ g_print ("User: %s\n", uri->user);
+ g_print ("Authmech: %s\n", uri->authmech);
+ g_print ("Password: %s\n", uri->passwd);
+ g_print ("Host: %s\n", uri->host);
+ g_print ("Path: %s\n", uri->path);
+ g_print ("Querystr: %s\n", uri->querystring);
+}
+