[rygel] server: Set HTTP version as late as possible



commit 8a459297a87d034469ee5343d02f930295735b6b
Author: Craig Pratt <craig ecaspia com>
Date:   Tue Feb 18 03:19:00 2014 +0000

    server: Set HTTP version as late as possible
    
    So that requests might change headers depending on HTTP request version.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702555

 src/librygel-server/rygel-http-get.vala     |    6 ++++++
 src/librygel-server/rygel-http-request.vala |    4 ----
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/librygel-server/rygel-http-get.vala b/src/librygel-server/rygel-http-get.vala
index 95be210..1ddb3c1 100644
--- a/src/librygel-server/rygel-http-get.vala
+++ b/src/librygel-server/rygel-http-get.vala
@@ -181,6 +181,12 @@ internal class Rygel.HTTPGet : HTTPRequest {
             this.msg.response_headers.set_encoding (Soup.Encoding.EOF);
         }
 
+        if (msg.get_http_version () == Soup HTTPVersion  1_0) {
+            // Set the response version to HTTP 1.1 (see DLNA 7.5.4.3.2.7.2)
+            msg.set_http_version (Soup HTTPVersion  1_1);
+            msg.response_headers.append ("Connection", "close");
+        }
+
         debug ("Following HTTP headers appended to response:");
         this.msg.response_headers.foreach ((name, value) => {
             debug ("%s : %s", name, value);
diff --git a/src/librygel-server/rygel-http-request.vala b/src/librygel-server/rygel-http-request.vala
index 9b77f04..7fb229e 100644
--- a/src/librygel-server/rygel-http-request.vala
+++ b/src/librygel-server/rygel-http-request.vala
@@ -54,10 +54,6 @@ internal abstract class Rygel.HTTPRequest : GLib.Object, Rygel.StateMachine {
         this.root_container = http_server.root_container;
         this.server = server;
         this.msg = msg;
-        if (msg.get_http_version () == Soup HTTPVersion  1_0) {
-            msg.set_http_version (Soup HTTPVersion  1_1);
-            msg.response_headers.append ("Connection", "close");
-        }
 
         try {
             this.hack = ClientHacks.create (msg);


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