[rygel] core: Throw error on seeking request for the unseekable
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Throw error on seeking request for the unseekable
- Date: Sun, 8 Aug 2010 23:18:56 +0000 (UTC)
commit f9e4e756bc1349843b7d180e2d75cfbeaada27c3
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Aug 6 19:18:58 2010 +0300
core: Throw error on seeking request for the unseekable
This is required by DLNA (7.3.33.4).
src/rygel/rygel-http-byte-seek.vala | 16 +++++++++++-----
src/rygel/rygel-http-time-seek.vala | 19 +++++++++++++------
2 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-http-byte-seek.vala b/src/rygel/rygel-http-byte-seek.vala
index ddd4c69..cafaee6 100644
--- a/src/rygel/rygel-http-byte-seek.vala
+++ b/src/rygel/rygel-http-byte-seek.vala
@@ -77,11 +77,17 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
base (request.msg, start, stop, total_length);
}
- public static bool needed (HTTPGet request) {
- return (request.item.size > 0 &&
- request.handler is HTTPIdentityHandler) ||
- (request.thumbnail != null && request.thumbnail.size > 0) ||
- (request.subtitle != null && request.subtitle.size > 0);
+ public static bool needed (HTTPGet request) throws HTTPRequestError {
+ var needed = (request.item.size > 0 &&
+ request.handler is HTTPIdentityHandler) ||
+ (request.thumbnail != null && request.thumbnail.size > 0) ||
+ (request.subtitle != null && request.subtitle.size > 0);
+
+ if (!needed && request.msg.request_headers.get ("Range") != null) {
+ throw new HTTPRequestError.UNACCEPTABLE ("Invalid seek request");
+ }
+
+ return needed;
}
public override void add_response_headers () {
diff --git a/src/rygel/rygel-http-time-seek.vala b/src/rygel/rygel-http-time-seek.vala
index 8a101bf..7834d0e 100644
--- a/src/rygel/rygel-http-time-seek.vala
+++ b/src/rygel/rygel-http-time-seek.vala
@@ -78,12 +78,19 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
base (request.msg, start, stop, duration);
}
- public static bool needed (HTTPGet request) {
- return request.item.duration > 0 &&
- (request.handler is HTTPTranscodeHandler ||
- (request.thumbnail == null &&
- request.subtitle == null &&
- request.item.should_stream ()));
+ public static bool needed (HTTPGet request) throws HTTPRequestError {
+ var needed = request.item.duration > 0 &&
+ (request.handler is HTTPTranscodeHandler ||
+ (request.thumbnail == null &&
+ request.subtitle == null &&
+ request.item.should_stream ()));
+
+ if (!needed &&
+ request.msg.request_headers.get ("TimeSeekRange.dlna.org") != null) {
+ throw new HTTPRequestError.UNACCEPTABLE ("Invalid seek request");
+ }
+
+ return needed;
}
public override void add_response_headers () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]