From e6a7fe8a0cc6c1f4324b6078435ab6578746f6cf Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sat, 6 Feb 2021 17:36:24 +0100 Subject: [PATCH] Request message copy optimization --- .../java/org/apache/hc/client5/http/impl/RequestCopier.java | 6 +++--- .../hc/client5/http/impl/classic/ClassicRequestCopier.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java index bb80d9fbd..0c90fbc89 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/RequestCopier.java @@ -46,13 +46,13 @@ public final class RequestCopier implements MessageCopier { if (original == 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()); for (final Iterator
it = original.headerIterator(); it.hasNext(); ) { copy.addHeader(it.next()); } - copy.setScheme(original.getScheme()); - copy.setAuthority(original.getAuthority()); return copy; } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java index 21e2db336..8621d1c0d 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ClassicRequestCopier.java @@ -47,13 +47,13 @@ public final class ClassicRequestCopier implements MessageCopier it = original.headerIterator(); it.hasNext(); ) { copy.addHeader(it.next()); } - copy.setScheme(original.getScheme()); - copy.setAuthority(original.getAuthority()); copy.setEntity(original.getEntity()); return copy; }