Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix HEAD requests #21

Closed
wants to merge 1 commit into from
Closed

fix HEAD requests #21

wants to merge 1 commit into from

Conversation

kesla
Copy link
Contributor

@kesla kesla commented Jul 2, 2012

The http responses were not ended properly

The http responses were not ended properly
@kesla
Copy link
Contributor Author

kesla commented Aug 4, 2012

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

@bahamas10
Copy link

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
       }

@bahamas10
Copy link

@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.

@mikeal
Copy link
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants