Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

fix HEAD requests #21

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

kesla commented Jul 2, 2012

The http responses were not ended properly

@kesla kesla fix HEAD requests
The http responses were not ended properly
d8dc964
Contributor

kesla commented Aug 4, 2012

@mikeal Ping! This seem to have been forgotten about :)

I just ended up implementing this on my own, to cover the same issue. Making a HEAD request to a static asset without if-none-match, it just hangs.

I made a second change, not sure if it is appropriate or not

@@ -108,7 +108,9 @@ function File (options) {
           return
         }

-        if (self.src.method !== 'HEAD') {
+        if (self.src.method === 'HEAD') {
+          self.dest.end()
+        } else {
           fs.createReadStream(self.path).pipe(self.dest)
         }
         return
@@ -137,7 +139,11 @@ function File (options) {
         self.dest.setHeader('etag', self.etag)
         self.dest.setHeader('last-modified', self.lastmodified)
         self.dest.setHeader('content-length', stats.size)
-        fs.createReadStream(self.path).pipe(self.dest)
+        if (self.src.method === 'HEAD') {
+          self.dest.end()
+        } else {
+          fs.createReadStream(self.path).pipe(self.dest)
+        }
         return
       }

@mikeal ping on this again. not trying to annoy, but i'm working on a new project, and filed is 99% perfect for the job, it's just lacking proper support for HEAD requests. i'd love to see this get implemented.

Owner

mikeal commented Jan 28, 2013

can we get @bahamas10's additions to this pull request?

@kesla kesla closed this Feb 25, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment