Skip chunked framing when contentLength is null (#1970)

* Skip chunked framing when contentLength is null

IOClient mapped a null BaseRequest.contentLength to dart:io's -1
sentinel, which forces Transfer-Encoding: chunked. For bodyless GET/HEAD
this overwrote dart:io's contentLength = 0 default and sent an empty
chunked body that can desync pooled keep-alive connections. Skip the
assignment when contentLength is null so the per-method default stands.

* Minor tweeks

---------

Co-authored-by: Brian Quinlan <bquinlan@google.com>
8 files changed
tree: 40f0d0589e56a0d3b3f3d9671ed82bb8adc5aa63
  1. .gemini/
  2. .github/
  3. pkgs/
  4. tool/
  5. .gitattributes
  6. .gitignore
  7. analysis_options.yaml
  8. CONTRIBUTING.md
  9. LICENSE
  10. mono_repo.yaml
  11. README.md
README.md

Build Status

A composable, Future-based library for making HTTP requests.

package:http contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform, and supports mobile, desktop, and the browser.

Packages

PackageDescriptionVersion
cronet_httpAn Android Flutter plugin that provides access to the Cronet HTTP client.pub package
cupertino_httpA macOS/iOS Flutter plugin that provides access to the Foundation URL Loading System.pub package
flutter_http_exampleAn Flutter app that demonstrates how to configure and use package:http.
httpA composable, multi-platform, Future-based API for HTTP requests.pub package
http2A HTTP/2 implementation in Dart.pub package
http_client_conformance_testsA library that tests whether implementations of package:http's Client class behave as expected.
http_multi_serverA dart:io HttpServer wrapper that handles requests from multiple servers.pub package
http_parserA platform-independent package for parsing and serializing HTTP formats.pub package
http_profileA library used by HTTP client authors to integrate with the DevTools Network View.pub package
ok_httpAn Android Flutter plugin that provides access to the OkHttp HTTP client and the OkHttp WebSocket API.pub package
web_socketAny easy-to-use library for communicating with WebSockets that has multiple implementations.pub package
web_socket_channelStreamChannel wrappers for WebSockets. Provides a cross-platform WebSocketChannel API.package issues
web_socket_conformance_testsA library that tests whether implementations of package:web_socket's WebSocket class behave as expected.

Contributing

If you'd like to contribute to any of these packages, see the Contributing Guide.