Commit Graph
2 Commits
Author SHA1 Message Date
Chris Tate dea734d63a Support request signals, destroy(err), servername, Expect events and maxHeaderSize in http
- http.request accepts `signal`: an abort, or a signal already aborted at
  construction, destroys the request with an AbortError (code ABORT_ERR,
  the signal's reason as cause). The abort listener is removed when the
  request closes, and a value that is not an AbortSignal throws
  ERR_INVALID_ARG_TYPE.
- req.destroy(err) reports err as the request's 'error'. Error listeners
  receive the Error object through scr_event_error_payload, and
  AbortError construction is shared through scr_error_abort.
- https.request accepts `servername`, sent as SNI and used for the
  certificate name check.
- server.on('checkContinue' | 'checkExpectation') take Expect requests
  instead of 'request', and the client emits 'continue' on a 100
  response.
- createServer and http.request accept maxHeaderSize, validated with
  Node's ERR_OUT_OF_RANGE messages.

Corpus 5564 and the extended 5559, 5561 and 5562 cover each API.
2026-10-15 21:43:27 -05:00
Chris Tate f7362fc386 Match Node's http keep-alive, header and framing behavior
- server.close() closes idle keep-alive connections, and every open
  connection closes after keepAliveTimeout + keepAliveTimeoutBuffer, so a
  closed server whose clients keep their connections no longer stays up.
  The Keep-Alive response header gives keepAliveTimeout in whole seconds
  and is omitted when it is 0.
- A client request through an Agent with neither keepAlive nor a finite
  maxSockets sends Connection: close.
- "socket hang up" and "aborted" errors carry code ECONNRESET, a client
  head over the header limit fails with HPE_HEADER_OVERFLOW, and TLS
  verification failures carry their openssl code.
- Outgoing header values keep the type they were set with: getHeader and
  getHeaders answer numbers and arrays, appendHeader turns an existing
  value into an array, and setHeader(name, string[]) writes one line per
  element.
- Repeated incoming header fields join with ", " ("; " for cookie),
  Node's single-value fields keep the first value, and set-cookie reads
  as an array under @types/node, on server requests and client responses.
  Fetch reads response headers line by line.
- Expect: 100-continue is answered with 100 Continue before 'request';
  other expectations answer 417.
- HEAD requests and 1xx/204/304 responses send no body or length header,
  and HTTP/1.0 requests without a set length get an unframed body and
  Connection: close.
- The 16 KiB maxHeaderSize applies to the request target plus header
  names and values (431 on the server).
- https.Agent TLS options are refused by name instead of being dropped,
  and server.address() lowers for @types/node's
  string | AddressInfo | null result.

Corpus 5555-5563 and the node-types http-headers-address fixture cover
each case.
2026-10-15 13:06:33 -05:00