mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
perf(core): parse the request URI only when the Cognito or S3 filter needs it (#7932)
The Cognito custom domain filter and the S3 virtual host filter run on every request of every service. Each read the full request URI first, which parses it and allocates about 340 bytes. RESTEasy keeps the first parse for the request, so both filters had to change. The Cognito filter now checks the routed path before it reads the URI. The S3 filter reads the URI only when the Host header is missing or a bucket matched.
This commit is contained in:
1 parent
f37afdad81
commit
57e4e3fe19
4 files changed
+17
-5
No files matched your search
@@ -78,6 +78,7 @@ class CognitoCustomDomainFilterTest {
|
||||
|
||||
verify(request, never()).setRequestUri(any());
|
||||
verify(request, never()).setProperty(any(), any());
|
||||
verify(request.getUriInfo(), never()).getRequestUri();
|
||||
}
|
||||
verifyNoInteractions(cognitoService);
|
||||
}
|
||||
@@ -203,6 +204,7 @@ class CognitoCustomDomainFilterTest {
|
||||
when(request.getMethod()).thenReturn(method);
|
||||
UriInfo uriInfo = mock(UriInfo.class);
|
||||
when(uriInfo.getRequestUri()).thenReturn(URI.create(uri));
|
||||
when(uriInfo.getPath()).thenReturn(URI.create(uri).getPath());
|
||||
when(request.getUriInfo()).thenReturn(uriInfo);
|
||||
when(request.getHeaderString("Host")).thenReturn(hostHeader);
|
||||
return request;
|
||||
|
||||
@@ -508,6 +508,7 @@ class S3VirtualHostFilterTest {
|
||||
new S3VirtualHostFilter().filter(ctx);
|
||||
|
||||
verify(ctx, never()).setRequestUri(any(URI.class));
|
||||
verify(uriInfo, never()).getRequestUri();
|
||||
}
|
||||
|
||||
// --- Other services' virtual-host schemes must not be swallowed as dotted buckets ---
|
||||
|
||||
Reference in new issue
Block a user