I am seeing an issue where a server response has cache-control: no-cache="set-cookie" as one of the headers. The double-quotes fail the token regular expression match used in DioCacheInterceptor resulting in a thrown exception.
I understand that DioCacheInterceptor does not process the additional attributes, but the interceptor is failing on legal syntax as described in RFC 2616 Section 14.9 and RFC 9111 Section 5.2.2.4
This unit test will trigger the issue:
test('HTTP GET with qualified cache-control no-cache directive', () async {
final testHttpServer = await HttpServer.bind(InternetAddress.anyIPv6, 0);
testHttpServer.listen((request) {
// Set header that causes crash in DioCacheInterceptor
request.response.headers.add('cache-control', 'no-cache="Set-Cookie"');
request.response.write('Hello test!');
request.response.close();
});
final uriStr = 'http://localhost:${testHttpServer.port}';
// The error happens in this call
final responseInfo = await MyHttpClient.get(Uri.parse(uriStr));
expect(responseInfo.statusCode, 200);
});
In the test, MyHttpClient is an HTTP client that uses the DioCacheInterceptor to handle caching.
I am seeing an issue where a server response has
cache-control: no-cache="set-cookie"
as one of the headers. The double-quotes fail thetoken
regular expression match used inDioCacheInterceptor
resulting in a thrown exception.I understand that
DioCacheInterceptor
does not process the additional attributes, but the interceptor is failing on legal syntax as described in RFC 2616 Section 14.9 and RFC 9111 Section 5.2.2.4This unit test will trigger the issue:
In the test,
MyHttpClient
is an HTTP client that uses theDioCacheInterceptor
to handle caching.