Skip to content

Commit

Permalink
added support for HEAD request, but curl hangs for some reason, so in…
Browse files Browse the repository at this point in the history
…vestigating
  • Loading branch information
Jason J. Gullickson committed Jan 3, 2015
1 parent a4eb156 commit 112991a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions jsfs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,27 @@ http.createServer(function(req, res){

break;

case "HEAD":

if(typeof stored_files[target_url] != "undefined"){
var requested_file = stored_files[target_url];
if(!requested_file.private || (requested_file.access_token === access_token)){
res.writeHead(200,{
"Content-Type": requested_file.content_type,
"Content-Length": requested_file.file_size
});
res.end();
} else {
res.statusCode = 401;
res.end();
}
} else {
res.statusCode = 404;
res.end();
}

break;

case "OPTIONS":

// support for OPTIONS is required to support cross-domain requests (CORS)
Expand Down

0 comments on commit 112991a

Please sign in to comment.