Request message copy optimization

This commit is contained in:
Oleg Kalnichevski 2021-02-06 17:36:24 +01:00
parent 17fce4112c
commit e6a7fe8a0c
2 changed files with 6 additions and 6 deletions

View File

@ -46,13 +46,13 @@ public final class RequestCopier implements MessageCopier<HttpRequest> {
if (original == null) { if (original == null) {
return null; return null;
} }
final BasicHttpRequest copy = new BasicHttpRequest(original.getMethod(), original.getPath()); final BasicHttpRequest copy = new BasicHttpRequest(original.getMethod(), null, original.getPath());
copy.setScheme(original.getScheme());
copy.setAuthority(original.getAuthority());
copy.setVersion(original.getVersion()); copy.setVersion(original.getVersion());
for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) { for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) {
copy.addHeader(it.next()); copy.addHeader(it.next());
} }
copy.setScheme(original.getScheme());
copy.setAuthority(original.getAuthority());
return copy; return copy;
} }

View File

@ -47,13 +47,13 @@ public final class ClassicRequestCopier implements MessageCopier<ClassicHttpRequ
if (original == null) { if (original == null) {
return null; return null;
} }
final BasicClassicHttpRequest copy = new BasicClassicHttpRequest(original.getMethod(), original.getPath()); final BasicClassicHttpRequest copy = new BasicClassicHttpRequest(original.getMethod(), null, original.getPath());
copy.setScheme(original.getScheme());
copy.setAuthority(original.getAuthority());
copy.setVersion(original.getVersion()); copy.setVersion(original.getVersion());
for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) { for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) {
copy.addHeader(it.next()); copy.addHeader(it.next());
} }
copy.setScheme(original.getScheme());
copy.setAuthority(original.getAuthority());
copy.setEntity(original.getEntity()); copy.setEntity(original.getEntity());
return copy; return copy;
} }