[rygel] core: Return HTTP 400 for invalid range



commit f63e927e8ff63ab25e197d8d048a416d3ff29da0
Author: Santakivi Topi <Topi Santakivi digia com>
Date:   Wed May 11 15:16:22 2011 +0200

    core: Return HTTP 400 for invalid range

 src/rygel/rygel-http-get.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index 4a76cfd..e7118d4 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -144,9 +144,16 @@ internal class Rygel.HTTPGet : HTTPRequest {
             } else if (need_byte_seek) {
                 this.seek = new HTTPByteSeek (this);
             }
-        } catch (HTTPSeekError.OUT_OF_RANGE error) {
+        } catch (HTTPSeekError error) {
             this.server.unpause_message (this.msg);
-            this.end (Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
+
+            if (error is HTTPSeekError.INVALID_RANGE) {
+                this.end (Soup.KnownStatusCode.BAD_REQUEST);
+            } else if (error is HTTPSeekError.OUT_OF_RANGE) {
+                this.end (Soup.KnownStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE);
+            } else {
+                throw error;
+            }
 
             return;
         }



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