Skip to content

Commit d2d2bf8

Browse files
brianquinlanCommit Queue
authored andcommitted
[io] HttpClient: add a more descriptive message if the HTTP
authentication challenge is incorrectly formatted. Bug:#57117 Change-Id: Iceace8ae5c43293f66c2167e2c5ee598e5fecb54 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402280 Commit-Queue: Brian Quinlan <[email protected]> Reviewed-by: Lasse Nielsen <[email protected]>
1 parent 6884914 commit d2d2bf8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sdk/lib/_http/http_impl.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,18 @@ class _HttpClientResponse extends _HttpInboundMessageListInt
845845

846846
List<String> challenge = authChallenge()!;
847847
assert(challenge.length == 1);
848-
_HeaderValue header = _HeaderValue.parse(
849-
challenge[0],
850-
parameterSeparator: ",",
851-
);
848+
final _HeaderValue header;
849+
try {
850+
header = _HeaderValue.parse(challenge[0], parameterSeparator: ",");
851+
} on HttpException catch (_, s) {
852+
Error.throwWithStackTrace(
853+
HttpException(
854+
'The authentication challenge sent by the server is '
855+
'not correctly formatted.',
856+
),
857+
s,
858+
);
859+
}
852860
_AuthenticationScheme scheme = _AuthenticationScheme.fromString(
853861
header.value,
854862
);

0 commit comments

Comments
 (0)