d968304570
This is a reland of d84f359786
Original change's description:
> Revert commits part of #40548 which still has some design debates and breaks valid local network http traffic
>
> Bug: https://github.com/flutter/flutter/issues/72723
> Change-Id: Ib5f809fccf1fad69add441fd40c463da8dc8be36
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192953
> Auto-Submit: Xiao Yu <xster@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Bug: https://github.com/flutter/flutter/issues/72723
Change-Id: I466d888b3f324a996f0bef0463e7ab3df3179c56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195485
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Xiao Yu <xster@google.com>
49 lines
1.7 KiB
Dart
49 lines
1.7 KiB
Dart
// Copyright (c) 2012, 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.
|
|
|
|
library dart._http;
|
|
|
|
import "dart:async";
|
|
import "dart:collection";
|
|
import "dart:convert";
|
|
import "dart:developer";
|
|
import "dart:io";
|
|
import "dart:isolate";
|
|
import "dart:math";
|
|
import "dart:typed_data";
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
import "../../../sdk/lib/internal/internal.dart"
|
|
show Since, valueOfNonNullableParamWithDefault, HttpStatus;
|
|
|
|
part "../../../sdk/lib/_http/crypto.dart";
|
|
part "../../../sdk/lib/_http/embedder_config.dart";
|
|
part "../../../sdk/lib/_http/http_impl.dart";
|
|
part "../../../sdk/lib/_http/http_date.dart";
|
|
part "../../../sdk/lib/_http/http_parser.dart";
|
|
part "../../../sdk/lib/_http/http_headers.dart";
|
|
part "../../../sdk/lib/_http/http_session.dart";
|
|
|
|
void testParseHttpCookieDate() {
|
|
Expect.throws(() => HttpDate._parseCookieDate(""));
|
|
|
|
test(int year, int month, int day, int hours, int minutes, int seconds,
|
|
String formatted) {
|
|
DateTime date =
|
|
new DateTime.utc(year, month, day, hours, minutes, seconds, 0);
|
|
Expect.equals(date, HttpDate._parseCookieDate(formatted));
|
|
}
|
|
|
|
test(2012, DateTime.june, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
|
|
test(2021, DateTime.june, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
|
|
test(2021, DateTime.january, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
|
|
test(2013, DateTime.january, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
|
|
test(1970, DateTime.january, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
|
|
}
|
|
|
|
void main() {
|
|
testParseHttpCookieDate();
|
|
}
|