append a '?' between path and query string in request header. NULL
authoralex <alex>
Thu, 11 Jan 2001 21:32:25 +0000 (21:32 +0000)
committeralex <alex>
Thu, 11 Jan 2001 21:32:25 +0000 (21:32 +0000)
* soup-queue.c (soup_get_request_header): append a '?' between path and query string in request header. NULL terminate the call to g_strconcat.

* soup-context.c (soup_context_get): bomb if url passed in does not have a protocol. do not default to HTTP.

libsoup/soup-context.c
libsoup/soup-queue.c
libsoup/soup-uri.c

index a9e6f94..9d21a5a 100644 (file)
@@ -32,7 +32,7 @@ soup_context_new (SoupServer *server, SoupUri *uri)
        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;
@@ -49,6 +49,11 @@ soup_context_get (gchar *uri)
        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);
index b0f69d3..0e5732c 100644 (file)
@@ -402,9 +402,11 @@ soup_get_request_header (SoupMessage *req)
 
        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. */
index f2a4942..1b88241 100644 (file)
 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;
@@ -223,3 +220,18 @@ soup_uri_free (SoupUri *uri)
 
        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);
+}
+