actix-web icon indicating copy to clipboard operation
actix-web copied to clipboard

[awc] Fix response body when no content-length header

Open armandmgt opened this issue 2 years ago • 0 comments
trafficstars

PR Type

Bug Fix for awc

PR Checklist

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt.
  • [x] (Team) Label with affected crates and semver status.

Overview

As noted in #2287 response body should be read until connection is closed when neither Transfer-Encoding nor Content-Length are specified in HTTP/1.1 (item 7 in https://www.rfc-editor.org/rfc/rfc7230#section-3.3.3). In order not to break any current tests I added a check for the presence of the Connection: close header (which is not required by the spec). For reference this is how go's standard library is doing it: https://github.com/golang/go/blob/aeb0644bd33e67f24e2411a651ac9ff72ddc96b4/src/net/http/transfer.go#L548

armandmgt avatar May 20 '23 11:05 armandmgt