[libsoup] soup-message-client-io: add a Host header to HTTP/1.0 messages too



commit 2d58084816390a61d384bfc150e5383dabdf7448
Author: Dan Winship <danw gnome org>
Date:   Sat Nov 17 11:35:24 2012 -0500

    soup-message-client-io: add a Host header to HTTP/1.0 messages too
    
    per recommendation of the httpbis spec

 libsoup/soup-message-client-io.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/libsoup/soup-message-client-io.c b/libsoup/soup-message-client-io.c
index 7c62368..06fe5cc 100644
--- a/libsoup/soup-message-client-io.c
+++ b/libsoup/soup-message-client-io.c
@@ -97,20 +97,17 @@ get_request_headers (SoupMessage *req, GString *header,
 		}
 	}
 
-	if (priv->http_version == SOUP_HTTP_1_0) {
-		g_string_append_printf (header, "%s %s HTTP/1.0\r\n",
-					req->method, uri_string);
-	} else {
-		g_string_append_printf (header, "%s %s HTTP/1.1\r\n",
-					req->method, uri_string);
-		if (!soup_message_headers_get_one (req->request_headers, "Host")) {
-			if (soup_uri_uses_default_port (uri)) {
-				g_string_append_printf (header, "Host: %s\r\n",
-							uri_host);
-			} else {
-				g_string_append_printf (header, "Host: %s:%d\r\n",
-							uri_host, uri->port);
-			}
+	g_string_append_printf (header, "%s %s HTTP/1.%d\r\n",
+				req->method, uri_string,
+				(priv->http_version == SOUP_HTTP_1_0) ? 0 : 1);
+
+	if (!soup_message_headers_get_one (req->request_headers, "Host")) {
+		if (soup_uri_uses_default_port (uri)) {
+			g_string_append_printf (header, "Host: %s\r\n",
+						uri_host);
+		} else {
+			g_string_append_printf (header, "Host: %s:%d\r\n",
+						uri_host, uri->port);
 		}
 	}
 	g_free (uri_string);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]