Skip to content

Feature request: passing headers to response.writeContinue() #7588

Description

@Lennie
  • Version: 6.3.0
  • Platform: any
  • Subsystem: http

It would be very useful if someone (I'm willing to create a pull request for it) would add the ability to set the headers of the Continue intermediate headers. One reason for it, is to tell the reverse proxy/webserver which URLs do to a HTTP/2 push for:

http://blog.kazuhooku.com/2016/06/h2o-http2-server-201-210-beta1-released.html

Activity

  1. jasnell commented on Jul 7, 2016

    @jasnell
    Member

    Interesting... I wouldn't be opposed to this.

    /cc @nodejs/http

  2. added
    httpIssues and PRs related to the http subsystem.
    feature requestIssues requesting new Node.js features.
    on Jul 7, 2016
  3. Fishrock123 commented on Jul 8, 2016

    @Fishrock123
    Contributor

    Seem like an ok idea to me.

  4. Lennie commented on Jul 8, 2016

    @Lennie
    Author

    Maybe I can add some things I've noticed so far.

    My first thought was to extend the response.writeContinue() to be similar to response.writeHead()

    But for setting those push headers, you'd need to set the same header multiple times.

    The current API for normal HTTP-responses doesn't allow multiple headers with response.setHeader and response.writeHead. They are 'merged'.

    So should the writeHead/setHeader API be extended first to allow for multiple headers ?

    An other thing I noticed is that I can already do this as a hack by calling some lower level methods:

        var CRLF = '\r\n';
    
        var links = ['/style1.css', '/style2.css'];
    
        var strlinks = '';
    
        for (var i in links) {
            strlinks += CRLF + 'Link: <'+links[i]+'>; rel=preload'
        }
    
        response._writeRaw ('HTTP/1.1 100 Continue' + strlinks + CRLF + CRLF, 'ascii');
  5. dougwilson commented on Jul 8, 2016

    @dougwilson
    Member

    The current API for normal HTTP-responses doesn't allow multiple headers with response.setHeader and response.writeHead.

    This is a very common misconception, especially since the HTTP client in Node.js (which many people to use to confirm) also does a merge on read. You can very easily emit the same header multiple times in the current API: you just set the header's value to an array instead of a string, and each element in the array will be a separate header line in the response.

    So should the writeHead/setHeader API be extended first to allow for multiple headers ?

    If we make it match .writeHead, then it would, as .writeHead already does.

  6. Lennie commented on Jul 9, 2016

    @Lennie
    Author

    This morning I had the same idea before I read your comment. I remembered you can combine multiple of the same HTTP headers in a single response separated with ','. Just tested that with h2o and it works just fine. So all we need to do is extend writeContinue () to be more like writeHead()

  7. Trott commented on Jul 8, 2017

    @Trott
    Member

    Pull request welcome.

    This issue has been inactive for sufficiently long that it seems like perhaps it should be closed. Feel free to re-open (or leave a comment requesting that it be re-opened) if you disagree. I'm just tidying up and not acting on a super-strong opinion or anything like that.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.httpIssues and PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions