[rygel/rygel-0-12] core: Set all headers in RygelHTTPGet
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/rygel-0-12] core: Set all headers in RygelHTTPGet
- Date: Thu, 8 Dec 2011 09:53:11 +0000 (UTC)
commit 62e79b46a9d72977ed1f15dca89ab40a809cdeae
Author: Jens Georg <mail jensge org>
Date: Tue Nov 22 22:21:39 2011 +0100
core: Set all headers in RygelHTTPGet
Don't set Content-Length header in HEAD request for transcoded
resources. This was previously caused by the message encoding being
set to CONTENT_LENGTH by default. Moving the code sets the encoding
to EOF causing libsoup to not set the Content-Length header.
Also adds a proper Range header for byte-seek HEAD requests.
This fixes the random fails of test-case 7.4.28.2,3,4,6
src/rygel/rygel-http-get.vala | 15 ++++++++++++++-
src/rygel/rygel-http-response.vala | 12 ------------
2 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index 0ea407c..4e8611e 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -160,6 +160,20 @@ internal class Rygel.HTTPGet : HTTPRequest {
// Add headers
this.handler.add_response_headers (this);
+
+ // Add general headers
+ if (this.msg.request_headers.get_one ("Range") != null) {
+ this.msg.set_status (Soup.KnownStatusCode.PARTIAL_CONTENT);
+ } else {
+ this.msg.set_status (Soup.KnownStatusCode.OK);
+ }
+
+ if (this.seek != null && this.seek is HTTPByteSeek) {
+ this.msg.response_headers.set_encoding (Soup.Encoding.CONTENT_LENGTH);
+ } else {
+ this.msg.response_headers.set_encoding (Soup.Encoding.EOF);
+ }
+
debug ("Following HTTP headers appended to response:");
this.msg.response_headers.foreach ((name, value) => {
debug ("%s : %s", name, value);
@@ -168,7 +182,6 @@ internal class Rygel.HTTPGet : HTTPRequest {
if (this.msg.method == "HEAD") {
// Only headers requested, no need to send contents
this.server.unpause_message (this.msg);
- this.end (Soup.KnownStatusCode.OK);
return;
}
diff --git a/src/rygel/rygel-http-response.vala b/src/rygel/rygel-http-response.vala
index 21ebcbe..5d003a4 100644
--- a/src/rygel/rygel-http-response.vala
+++ b/src/rygel/rygel-http-response.vala
@@ -69,18 +69,6 @@ internal class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine {
this.cancellable = request_handler.cancellable;
this.seek = request.seek;
- if (request.msg.request_headers.get_one ("Range") != null) {
- this.msg.set_status (Soup.KnownStatusCode.PARTIAL_CONTENT);
- } else {
- this.msg.set_status (Soup.KnownStatusCode.OK);
- }
-
- if (this.seek != null && this.seek is HTTPByteSeek) {
- this.msg.response_headers.set_encoding (Encoding.CONTENT_LENGTH);
- } else {
- this.msg.response_headers.set_encoding (Encoding.EOF);
- }
-
if (this.cancellable != null) {
this.cancellable.cancelled.connect (this.on_cancelled);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]