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

Server closes connection on chunked pipelining #78

Closed
ronag opened this issue May 6, 2020 · 1 comment
Closed

Server closes connection on chunked pipelining #78

ronag opened this issue May 6, 2020 · 1 comment
Labels
question [Use a Discussion instead]

Comments

@ronag
Copy link
Member

ronag commented May 6, 2020

This was a bit surprising for me. It seem the server always ends the connection at the end of a request which sent a chunked body, i.e. this will always close the connection once the first request has completed.

@mcollina Are you familiar with this behavior?

test('pipelined POST does not interleave', (t) => {
  t.plan(5)

  const server = createServer((req, res) => {
    req.on('data', chunk => {
      console.error(chunk)
    }).on('end', () => {
      res.end()
    })
  })
  t.tearDown(server.close.bind(server))

  server.listen(0, () => {
    const client = new Client(`http://localhost:${server.address().port}`, {
      pipelining: 2
    })

    let a = 0
    client.request({
      path: '/',
      method: 'POST',
      body: new Readable({
        read () {
          this.push(a++ > 128 ? null : 'a')
        }
      })
    }, (err, data) => {
      console.error('a', err)
    })

    let b = 0
    client.request({
      path: '/',
      method: 'POST',
      body: new Readable({
        read () {
          this.push(b++ > 128 ? null : 'b')
        }
      })
    }, (err, data) => {
      console.error('b', err)
      // t.ok(err)
    })
  })
})
@ronag ronag added the question [Use a Discussion instead] label May 6, 2020
@ronag
Copy link
Member Author

ronag commented May 7, 2020

Moved to PR #76

@ronag ronag closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question [Use a Discussion instead]
Projects
None yet
Development

No branches or pull requests

1 participant