Skip to content

Commit 86e6070

Browse files
committed
Merge package:http_parser into the http monorepo
2 parents 75bd389 + 85d2651 commit 86e6070

28 files changed

+2608
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Dependabot configuration file.
2+
version: 2
3+
4+
updates:
5+
- package-ecosystem: github-actions
6+
directory: /
7+
schedule:
8+
interval: monthly
9+
labels:
10+
- autosubmit
11+
groups:
12+
github-actions:
13+
patterns:
14+
- "*"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# A workflow to close issues where the author hasn't responded to a request for
2+
# more information; see https://github.com/actions/stale.
3+
4+
name: No Response
5+
6+
# Run as a daily cron.
7+
on:
8+
schedule:
9+
# Every day at 8am
10+
- cron: '0 8 * * *'
11+
12+
# All permissions not specified are set to 'none'.
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
17+
jobs:
18+
no-response:
19+
runs-on: ubuntu-latest
20+
if: ${{ github.repository_owner == 'dart-lang' }}
21+
steps:
22+
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e
23+
with:
24+
# Don't automatically mark inactive issues+PRs as stale.
25+
days-before-stale: -1
26+
# Close needs-info issues and PRs after 14 days of inactivity.
27+
days-before-close: 14
28+
stale-issue-label: "needs-info"
29+
close-issue-message: >
30+
Without additional information we're not able to resolve this issue.
31+
Feel free to add more info or respond to any questions above and we
32+
can reopen the case. Thanks for your contribution!
33+
stale-pr-label: "needs-info"
34+
close-pr-message: >
35+
Without additional information we're not able to resolve this PR.
36+
Feel free to add more info or respond to any questions above.
37+
Thanks for your contribution!
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# A CI configuration to auto-publish pub packages.
2+
3+
name: Publish
4+
5+
on:
6+
pull_request:
7+
branches: [ master ]
8+
push:
9+
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
10+
11+
jobs:
12+
publish:
13+
if: ${{ github.repository_owner == 'dart-lang' }}
14+
uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main
15+
permissions:
16+
id-token: write # Required for authentication using OIDC
17+
pull-requests: write # Required for writing the pull request note
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Dart CI
2+
3+
on:
4+
# Run on PRs and pushes to the default branch.
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
schedule:
10+
- cron: "0 0 * * 0"
11+
12+
env:
13+
PUB_ENVIRONMENT: bot.github
14+
permissions: read-all
15+
16+
jobs:
17+
# Check code formatting and static analysis on a single OS (linux)
18+
# against Dart dev.
19+
analyze:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
sdk: [dev]
25+
steps:
26+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
27+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
28+
with:
29+
sdk: ${{ matrix.sdk }}
30+
- id: install
31+
name: Install dependencies
32+
run: dart pub get
33+
- name: Check formatting
34+
run: dart format --output=none --set-exit-if-changed .
35+
if: always() && steps.install.outcome == 'success'
36+
- name: Analyze code
37+
run: dart analyze --fatal-infos
38+
if: always() && steps.install.outcome == 'success'
39+
40+
test:
41+
needs: analyze
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: [ubuntu-latest]
47+
sdk: [3.4, dev]
48+
steps:
49+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
50+
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
51+
with:
52+
sdk: ${{ matrix.sdk }}
53+
- id: install
54+
name: Install dependencies
55+
run: dart pub get
56+
- name: Run VM tests
57+
run: dart test --platform vm
58+
if: always() && steps.install.outcome == 'success'
59+
- name: Run Chrome tests
60+
run: dart test --platform chrome
61+
if: always() && steps.install.outcome == 'success'
62+
- name: Run Chrome tests - wasm
63+
run: dart test --platform chrome --compiler dart2wasm
64+
if: always() && steps.install.outcome == 'success'

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

0 commit comments

Comments
 (0)