Skip to content

Commit

Permalink
Merge branch 'master' into merge-http2-package
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem authored Oct 18, 2024
2 parents e7db29d + 92d317a commit e6f2fb5
Show file tree
Hide file tree
Showing 28 changed files with 2,563 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/http_parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:http_parser"
about: "Create a bug or file a feature request against package:http_parser."
labels: "package:http_parser"
---
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/http2/**'

'package:http_parser':
- changed-files:
- any-glob-to-any-file: 'pkgs/http_parser/**'

'package:http_client_conformance_tests':
- changed-files:
- any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**'
74 changes: 74 additions & 0 deletions .github/workflows/http_parser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: package:http_parser

on:
push:
branches:
- master
paths:
- '.github/workflows/http_parser.yaml'
- 'pkgs/http_parser/**'
pull_request:
paths:
- '.github/workflows/http_parser.yaml'
- 'pkgs/http_parser/**'
schedule:
- cron: "0 0 * * 0"

env:
PUB_ENVIRONMENT: bot.github

defaults:
run:
working-directory: pkgs/http_parser/

permissions: read-all

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [3.4, dev]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests
run: dart test --platform chrome
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests - wasm
run: dart test --platform chrome --compiler dart2wasm
if: always() && steps.install.outcome == 'success'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and the browser.
| [http](pkgs/http/) | A composable, multi-platform, Future-based API for HTTP requests. | [![pub package](https://img.shields.io/pub/v/http.svg)](https://pub.dev/packages/http) |
| [http2](pkgs/http2/) | A HTTP/2 implementation in Dart. | [![pub package](https://img.shields.io/pub/v/http2.svg)](https://pub.dev/packages/http2) |
| [http_client_conformance_tests](pkgs/http_client_conformance_tests/) | A library that tests whether implementations of package:http's `Client` class behave as expected. | |
| [http_parser](pkgs/http_parser/) | A platform-independent package for parsing and serializing HTTP formats. | [![pub package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dev/packages/http_parser) |
| [http_profile](pkgs/http_profile/) | A library used by HTTP client authors to integrate with the DevTools Network View. | [![pub package](https://img.shields.io/pub/v/http_profile.svg)](https://pub.dev/packages/http_profile) |
| [ok_http](pkgs/ok_http/) | An Android Flutter plugin that provides access to the [OkHttp](https://square.github.io/okhttp/) HTTP client and the OkHttp [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) API. | [![pub package](https://img.shields.io/pub/v/ok_http.svg)](https://pub.dev/packages/ok_http) |
| [web_socket](pkgs/web_socket/) | Any easy-to-use library for communicating with WebSockets that has multiple implementations. | [![pub package](https://img.shields.io/pub/v/web_socket.svg)](https://pub.dev/packages/web_socket) |
Expand Down
4 changes: 4 additions & 0 deletions pkgs/http_parser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Don’t commit the following directories created by pub.
.dart_tool/
.packages
pubspec.lock
146 changes: 146 additions & 0 deletions pkgs/http_parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
## 4.1.1

* Move to `dart-lang/http` monorepo.

## 4.1.0

* `CaseInsensitiveMap`: added constructor `fromEntries`.
* Require `package:collection` `^1.19.0`
* Require Dart `^3.4.0`

## 4.0.2

* Remove `package:charcode` from dev_dependencies.

## 4.0.1

* Remove dependency on `package:charcode`.

## 4.0.0

* Stable null safety stable release.

## 4.0.0-nullsafety

* Migrate to null safety.

## 3.1.4

* Fixed lints affecting package health score.
* Added an example.

## 3.1.3

* Set max SDK version to `<3.0.0`, and adjust other dependencies.

## 3.1.2

* Require Dart SDK 2.0.0-dev.17.0 or greater.

* A number of strong-mode fixes.

## 3.1.1

* Fix a logic bug in the `chunkedCoding` codec. It had been producing invalid
output and rejecting valid input.

## 3.1.0

* Add `chunkedCoding`, a `Codec` that supports encoding and decoding the
[chunked transfer coding][].

[chunked transfer coding]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1

## 3.0.2

* Support `string_scanner` 1.0.0.

## 3.0.1

* Remove unnecessary dependencies.

## 3.0.0

* All deprecated APIs have been removed. No new APIs have been added. Packages
that would use 3.0.0 as a lower bound should use 2.2.0 instead—for example,
`http_parser: ">=2.2.0 <4.0.0"`.

* Fix all strong-mode warnings.

## 2.2.1

* Add support for `crypto` 1.0.0.

## 2.2.0

* `WebSocketChannel` has been moved to
[the `web_socket_channel` package][web_socket_channel]. The implementation
here is now deprecated.

[web_socket_channel]: https://pub.dev/packages/web_socket_channel

## 2.1.0

* Added `WebSocketChannel`, an implementation of `StreamChannel` that's backed
by a `WebSocket`.

* Deprecated `CompatibleWebSocket` in favor of `WebSocketChannel`.

## 2.0.0

* Removed the `DataUri` class. It's redundant with the `Uri.data` getter that's
coming in Dart 1.14, and the `DataUri.data` field in particular was an invalid
override of that field.

## 1.1.0

* The MIME spec says that media types and their parameter names are
case-insensitive. Accordingly, `MediaType` now uses a case-insensitive map for
its parameters and its `type` and `subtype` fields are now always lowercase.

## 1.0.0

This is 1.0.0 because the API is stable—there are no breaking changes.

* Added an `AuthenticationChallenge` class for parsing and representing the
value of `WWW-Authenticate` and related headers.

* Added a `CaseInsensitiveMap` class for representing case-insensitive HTTP
values.

## 0.0.2+8

* Bring in the latest `dart:io` WebSocket code.

## 0.0.2+7

* Add more detail to the readme.

## 0.0.2+6

* Updated homepage URL.

## 0.0.2+5

* Widen the version constraint on the `collection` package.

## 0.0.2+4

* Widen the `string_scanner` version constraint.

## 0.0.2+3

* Fix a library name conflict.

## 0.0.2+2

* Fixes for HTTP date formatting.

## 0.0.2+1

* Minor code refactoring.

## 0.0.2

* Added `CompatibleWebSocket`, for platform- and API-independent support for the
WebSocket API.
27 changes: 27 additions & 0 deletions pkgs/http_parser/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2014, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 changes: 22 additions & 0 deletions pkgs/http_parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[![Pub Package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dartlang.org/packages/http_parser)
[![package publisher](https://img.shields.io/pub/publisher/http_parser.svg)](https://pub.dev/packages/http_parser/publisher)

`http_parser` is a platform-independent package for parsing and serializing
various HTTP-related formats. It's designed to be usable on both the browser and
the server, and thus avoids referencing any types from `dart:io` or `dart:html`.

## Features

* Support for parsing and formatting dates according to [HTTP/1.1][2616], the
HTTP/1.1 standard.

* A `MediaType` class that represents an HTTP media type, as used in `Accept`
and `Content-Type` headers. This class supports both parsing and formatting
media types according to [HTTP/1.1][2616].

* A `WebSocketChannel` class that provides a `StreamChannel` interface for both
the client and server sides of the [WebSocket protocol][6455] independently of
any specific server implementation.

[2616]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html
[6455]: https://tools.ietf.org/html/rfc6455
33 changes: 33 additions & 0 deletions pkgs/http_parser/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# https://dart.dev/tools/analysis#the-analysis-options-file
include: package:dart_flutter_team_lints/analysis_options.yaml

analyzer:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true

linter:
rules:
- avoid_bool_literals_in_conditional_expressions
- avoid_classes_with_only_static_members
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_returning_this
- avoid_unused_constructor_parameters
- avoid_void_async
- cancel_subscriptions
- join_return_with_assignment
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- package_api_docs
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- unnecessary_await_in_return
- unnecessary_breaks
- use_if_null_to_convert_nulls_to_bools
- use_raw_strings
- use_string_buffers
16 changes: 16 additions & 0 deletions pkgs/http_parser/example/example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:http_parser/http_parser.dart';

void main() {
final date = DateTime.utc(2014, 9, 9, 9, 9, 9);
print(date); // 2014-09-09 09:09:09.000Z

final httpDateFormatted = formatHttpDate(date);
print(httpDateFormatted); // Tue, 09 Sep 2014 09:09:09 GMT

final nowParsed = parseHttpDate(httpDateFormatted);
print(nowParsed); // 2014-09-09 09:09:09.000Z
}
9 changes: 9 additions & 0 deletions pkgs/http_parser/lib/http_parser.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

export 'src/authentication_challenge.dart';
export 'src/case_insensitive_map.dart';
export 'src/chunked_coding.dart';
export 'src/http_date.dart';
export 'src/media_type.dart';
Loading

0 comments on commit e6f2fb5

Please sign in to comment.