Skip to content

Commit

Permalink
Fix partial request header regex
Browse files Browse the repository at this point in the history
  • Loading branch information
meloncholy committed Apr 21, 2012
1 parent ce87c8d commit b58aee0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/vidStreamer-sample.json
Expand Up @@ -4,5 +4,5 @@
"random": false,
"rootFolder": "/path/to/videos/",
"rootPath": "videos/",
"server": "VidStreamer.js/0.1.1"
"server": "VidStreamer.js/0.1.2"
}
7 changes: 4 additions & 3 deletions index.js
Expand Up @@ -3,7 +3,7 @@
*
* Copyright (c) 2012 Andrew Weeks http://meloncholy.com
* Licensed under the MIT licence. See http://meloncholy.com/licence
* Version 0.1.1
* Version 0.1.2
*/

"use strict";
Expand Down Expand Up @@ -57,7 +57,8 @@ var mimeTypes = {
".doc": "application/msword",
".vcf": "text/x-vcard",
".vrml": "x-world/x-vrml",
".zip": "application/zip"
".zip": "application/zip",
".webm": "video/webm"
};

var vidStreamer = function (req, res) {
Expand Down Expand Up @@ -116,7 +117,7 @@ var vidStreamer = function (req, res) {
info.modified = stat.mtime;
info.rangeRequest = false;

if (range !== undefined && (range = range.match(/bytes=(.+)-(.+)/)) !== null) {
if (range !== undefined && (range = range.match(/bytes=(.+)-(.+)?/)) !== null) {
// Check range contains numbers and they fit in the file.
// Make sure info.start & info.end are numbers (not strings) or stream.pipe errors out if start > 0.
info.start = isNumber(range[1]) && range[1] >= 0 && range[1] < info.end ? range[1] - 0 : info.start;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "vid-streamer",
"description": "VidStreamer.js: A simple streamer for Flash and other videos. Supports HTTP pseudostreaming and works with JW Player's bitrate switching.",
"version": "0.1.1",
"version": "0.1.2",
"author": "Andrew Weeks <andrew@meloncholy.com>",
"dependencies": {
"konphyg": "1.0.x"
Expand Down

0 comments on commit b58aee0

Please sign in to comment.