Skip to content

Commit 92d317a

Browse files
authored
Merge pull request #1319 from dart-lang/merge-http_parser-package
Merge `package:http_parser`
2 parents 75bd389 + f1e57b4 commit 92d317a

28 files changed

+2564
-1
lines changed

.github/ISSUE_TEMPLATE/http_parser.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
name: "package:http_parser"
3+
about: "Create a bug or file a feature request against package:http_parser."
4+
labels: "package:http_parser"
5+
---

.github/labeler.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
- changed-files:
1717
- any-glob-to-any-file: 'pkgs/http/**'
1818

19+
'package:http_parser':
20+
- changed-files:
21+
- any-glob-to-any-file: 'pkgs/http_parser/**'
22+
1923
'package:http_client_conformance_tests':
2024
- changed-files:
21-
- any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**'
25+
- any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**'

.github/workflows/http_parser.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: package:http_parser
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '.github/workflows/http_parser.yaml'
9+
- 'pkgs/http_parser/**'
10+
pull_request:
11+
paths:
12+
- '.github/workflows/http_parser.yaml'
13+
- 'pkgs/http_parser/**'
14+
schedule:
15+
- cron: "0 0 * * 0"
16+
17+
env:
18+
PUB_ENVIRONMENT: bot.github
19+
20+
defaults:
21+
run:
22+
working-directory: pkgs/http_parser/
23+
24+
permissions: read-all
25+
26+
jobs:
27+
# Check code formatting and static analysis on a single OS (linux)
28+
# against Dart dev.
29+
analyze:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
sdk: [dev]
35+
steps:
36+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
37+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
38+
with:
39+
sdk: ${{ matrix.sdk }}
40+
- id: install
41+
name: Install dependencies
42+
run: dart pub get
43+
- name: Check formatting
44+
run: dart format --output=none --set-exit-if-changed .
45+
if: always() && steps.install.outcome == 'success'
46+
- name: Analyze code
47+
run: dart analyze --fatal-infos
48+
if: always() && steps.install.outcome == 'success'
49+
50+
test:
51+
needs: analyze
52+
runs-on: ${{ matrix.os }}
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
os: [ubuntu-latest]
57+
sdk: [3.4, dev]
58+
steps:
59+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
60+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
61+
with:
62+
sdk: ${{ matrix.sdk }}
63+
- id: install
64+
name: Install dependencies
65+
run: dart pub get
66+
- name: Run VM tests
67+
run: dart test --platform vm
68+
if: always() && steps.install.outcome == 'success'
69+
- name: Run Chrome tests
70+
run: dart test --platform chrome
71+
if: always() && steps.install.outcome == 'success'
72+
- name: Run Chrome tests - wasm
73+
run: dart test --platform chrome --compiler dart2wasm
74+
if: always() && steps.install.outcome == 'success'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and the browser.
1515
| [flutter_http_example](pkgs/flutter_http_example/) | An Flutter app that demonstrates how to configure and use `package:http`. ||
1616
| [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) |
1717
| [http_client_conformance_tests](pkgs/http_client_conformance_tests/) | A library that tests whether implementations of package:http's `Client` class behave as expected. | |
18+
| [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) |
1819
| [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) |
1920
| [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) |
2021
| [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) |

pkgs/http_parser/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Don’t commit the following directories created by pub.
2+
.dart_tool/
3+
.packages
4+
pubspec.lock

pkgs/http_parser/CHANGELOG.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
## 4.1.1
2+
3+
* Move to `dart-lang/http` monorepo.
4+
5+
## 4.1.0
6+
7+
* `CaseInsensitiveMap`: added constructor `fromEntries`.
8+
* Require `package:collection` `^1.19.0`
9+
* Require Dart `^3.4.0`
10+
11+
## 4.0.2
12+
13+
* Remove `package:charcode` from dev_dependencies.
14+
15+
## 4.0.1
16+
17+
* Remove dependency on `package:charcode`.
18+
19+
## 4.0.0
20+
21+
* Stable null safety stable release.
22+
23+
## 4.0.0-nullsafety
24+
25+
* Migrate to null safety.
26+
27+
## 3.1.4
28+
29+
* Fixed lints affecting package health score.
30+
* Added an example.
31+
32+
## 3.1.3
33+
34+
* Set max SDK version to `<3.0.0`, and adjust other dependencies.
35+
36+
## 3.1.2
37+
38+
* Require Dart SDK 2.0.0-dev.17.0 or greater.
39+
40+
* A number of strong-mode fixes.
41+
42+
## 3.1.1
43+
44+
* Fix a logic bug in the `chunkedCoding` codec. It had been producing invalid
45+
output and rejecting valid input.
46+
47+
## 3.1.0
48+
49+
* Add `chunkedCoding`, a `Codec` that supports encoding and decoding the
50+
[chunked transfer coding][].
51+
52+
[chunked transfer coding]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1
53+
54+
## 3.0.2
55+
56+
* Support `string_scanner` 1.0.0.
57+
58+
## 3.0.1
59+
60+
* Remove unnecessary dependencies.
61+
62+
## 3.0.0
63+
64+
* All deprecated APIs have been removed. No new APIs have been added. Packages
65+
that would use 3.0.0 as a lower bound should use 2.2.0 instead—for example,
66+
`http_parser: ">=2.2.0 <4.0.0"`.
67+
68+
* Fix all strong-mode warnings.
69+
70+
## 2.2.1
71+
72+
* Add support for `crypto` 1.0.0.
73+
74+
## 2.2.0
75+
76+
* `WebSocketChannel` has been moved to
77+
[the `web_socket_channel` package][web_socket_channel]. The implementation
78+
here is now deprecated.
79+
80+
[web_socket_channel]: https://pub.dev/packages/web_socket_channel
81+
82+
## 2.1.0
83+
84+
* Added `WebSocketChannel`, an implementation of `StreamChannel` that's backed
85+
by a `WebSocket`.
86+
87+
* Deprecated `CompatibleWebSocket` in favor of `WebSocketChannel`.
88+
89+
## 2.0.0
90+
91+
* Removed the `DataUri` class. It's redundant with the `Uri.data` getter that's
92+
coming in Dart 1.14, and the `DataUri.data` field in particular was an invalid
93+
override of that field.
94+
95+
## 1.1.0
96+
97+
* The MIME spec says that media types and their parameter names are
98+
case-insensitive. Accordingly, `MediaType` now uses a case-insensitive map for
99+
its parameters and its `type` and `subtype` fields are now always lowercase.
100+
101+
## 1.0.0
102+
103+
This is 1.0.0 because the API is stable—there are no breaking changes.
104+
105+
* Added an `AuthenticationChallenge` class for parsing and representing the
106+
value of `WWW-Authenticate` and related headers.
107+
108+
* Added a `CaseInsensitiveMap` class for representing case-insensitive HTTP
109+
values.
110+
111+
## 0.0.2+8
112+
113+
* Bring in the latest `dart:io` WebSocket code.
114+
115+
## 0.0.2+7
116+
117+
* Add more detail to the readme.
118+
119+
## 0.0.2+6
120+
121+
* Updated homepage URL.
122+
123+
## 0.0.2+5
124+
125+
* Widen the version constraint on the `collection` package.
126+
127+
## 0.0.2+4
128+
129+
* Widen the `string_scanner` version constraint.
130+
131+
## 0.0.2+3
132+
133+
* Fix a library name conflict.
134+
135+
## 0.0.2+2
136+
137+
* Fixes for HTTP date formatting.
138+
139+
## 0.0.2+1
140+
141+
* Minor code refactoring.
142+
143+
## 0.0.2
144+
145+
* Added `CompatibleWebSocket`, for platform- and API-independent support for the
146+
WebSocket API.

pkgs/http_parser/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright 2014, the Dart project authors.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following
11+
disclaimer in the documentation and/or other materials provided
12+
with the distribution.
13+
* Neither the name of Google LLC nor the names of its
14+
contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pkgs/http_parser/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[![Pub Package](https://img.shields.io/pub/v/http_parser.svg)](https://pub.dartlang.org/packages/http_parser)
2+
[![package publisher](https://img.shields.io/pub/publisher/http_parser.svg)](https://pub.dev/packages/http_parser/publisher)
3+
4+
`http_parser` is a platform-independent package for parsing and serializing
5+
various HTTP-related formats. It's designed to be usable on both the browser and
6+
the server, and thus avoids referencing any types from `dart:io` or `dart:html`.
7+
8+
## Features
9+
10+
* Support for parsing and formatting dates according to [HTTP/1.1][2616], the
11+
HTTP/1.1 standard.
12+
13+
* A `MediaType` class that represents an HTTP media type, as used in `Accept`
14+
and `Content-Type` headers. This class supports both parsing and formatting
15+
media types according to [HTTP/1.1][2616].
16+
17+
* A `WebSocketChannel` class that provides a `StreamChannel` interface for both
18+
the client and server sides of the [WebSocket protocol][6455] independently of
19+
any specific server implementation.
20+
21+
[2616]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html
22+
[6455]: https://tools.ietf.org/html/rfc6455
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# https://dart.dev/tools/analysis#the-analysis-options-file
2+
include: package:dart_flutter_team_lints/analysis_options.yaml
3+
4+
analyzer:
5+
language:
6+
strict-casts: true
7+
strict-inference: true
8+
strict-raw-types: true
9+
10+
linter:
11+
rules:
12+
- avoid_bool_literals_in_conditional_expressions
13+
- avoid_classes_with_only_static_members
14+
- avoid_private_typedef_functions
15+
- avoid_redundant_argument_values
16+
- avoid_returning_this
17+
- avoid_unused_constructor_parameters
18+
- avoid_void_async
19+
- cancel_subscriptions
20+
- join_return_with_assignment
21+
- literal_only_boolean_expressions
22+
- missing_whitespace_between_adjacent_strings
23+
- no_adjacent_strings_in_list
24+
- no_runtimeType_toString
25+
- package_api_docs
26+
- prefer_const_declarations
27+
- prefer_expression_function_bodies
28+
- prefer_final_locals
29+
- unnecessary_await_in_return
30+
- unnecessary_breaks
31+
- use_if_null_to_convert_nulls_to_bools
32+
- use_raw_strings
33+
- use_string_buffers

pkgs/http_parser/example/example.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:http_parser/http_parser.dart';
6+
7+
void main() {
8+
final date = DateTime.utc(2014, 9, 9, 9, 9, 9);
9+
print(date); // 2014-09-09 09:09:09.000Z
10+
11+
final httpDateFormatted = formatHttpDate(date);
12+
print(httpDateFormatted); // Tue, 09 Sep 2014 09:09:09 GMT
13+
14+
final nowParsed = parseHttpDate(httpDateFormatted);
15+
print(nowParsed); // 2014-09-09 09:09:09.000Z
16+
}

pkgs/http_parser/lib/http_parser.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
export 'src/authentication_challenge.dart';
6+
export 'src/case_insensitive_map.dart';
7+
export 'src/chunked_coding.dart';
8+
export 'src/http_date.dart';
9+
export 'src/media_type.dart';

0 commit comments

Comments
 (0)