From 20bd815e74490f8f2e4803117e7e5365724e09ce Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Mon, 18 Dec 2023 12:40:50 +0100 Subject: [PATCH] Upgraded HttpCore to version 5.3-alpha1 --- .../hc/client5/testing/sync/TestContentCodings.java | 2 +- .../testing/sync/TestMalformedServerResponse.java | 6 +++--- .../hc/client5/http/entity/TestEntityBuilder.java | 4 ++-- .../http/entity/mime/TestFormBodyPartBuilder.java | 8 ++++---- .../http/entity/mime/TestMultipartContentBody.java | 2 +- .../http/entity/mime/TestMultipartEntityBuilder.java | 2 +- .../hc/client5/http/entity/mime/TestMultipartForm.java | 10 +++++----- .../client5/http/entity/mime/TestMultipartMixed.java | 10 +++++----- .../http/entity/mime/TestMultipartPartBuilder.java | 8 ++++---- .../org/apache/hc/client5/http/utils/TestURIUtils.java | 1 + pom.xml | 2 +- 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java index 6d99a84f9..211ce9b08 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java @@ -235,7 +235,7 @@ public abstract class TestContentCodings { * Create a load of workers which will access the resource. Half will use the default * gzip behaviour; half will require identity entity. */ - final int clients = 100; + final int clients = 10; connManager.setMaxTotal(clients); diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java index 508fecd5c..75fd4c027 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java @@ -50,8 +50,8 @@ public class TestMalformedServerResponse { static class BrokenServerConnection extends DefaultBHttpServerConnection { - public BrokenServerConnection(final Http1Config h1Config) { - super(null, h1Config); + public BrokenServerConnection(final String scheme, final Http1Config h1Config) { + super(scheme, h1Config); } @Override @@ -77,7 +77,7 @@ public class TestMalformedServerResponse { @Override public DefaultBHttpServerConnection createConnection(final Socket socket) throws IOException { - final BrokenServerConnection conn = new BrokenServerConnection(Http1Config.DEFAULT); + final BrokenServerConnection conn = new BrokenServerConnection("http", Http1Config.DEFAULT); conn.bind(socket); return conn; } diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java index ff1ca55fd..4f975dbaa 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java @@ -51,7 +51,7 @@ public class TestEntityBuilder { Assertions.assertNotNull(entity); Assertions.assertNotNull(entity.getContent()); Assertions.assertNotNull(entity.getContentType()); - Assertions.assertEquals("text/plain; charset=ISO-8859-1", entity.getContentType()); + Assertions.assertEquals("text/plain; charset=UTF-8", entity.getContentType()); } @Test @@ -119,7 +119,7 @@ public class TestEntityBuilder { final HttpEntity entity = EntityBuilder.create().setText("stuff").gzipCompressed().build(); Assertions.assertNotNull(entity); Assertions.assertNotNull(entity.getContentType()); - Assertions.assertEquals("text/plain; charset=ISO-8859-1", entity.getContentType()); + Assertions.assertEquals("text/plain; charset=UTF-8", entity.getContentType()); Assertions.assertNotNull(entity.getContentEncoding()); Assertions.assertEquals("gzip", entity.getContentEncoding()); } diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestFormBodyPartBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestFormBodyPartBuilder.java index c719347a5..5d5898fef 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestFormBodyPartBuilder.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestFormBodyPartBuilder.java @@ -51,7 +51,7 @@ public class TestFormBodyPartBuilder { Assertions.assertNotNull(header); assertFields(Arrays.asList( new MimeField("Content-Disposition", "form-data; name=\"blah\""), - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header.getFields()); } @@ -70,7 +70,7 @@ public class TestFormBodyPartBuilder { Assertions.assertNotNull(header1); assertFields(Arrays.asList( new MimeField("Content-Disposition", "form-data; name=\"blah\""), - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header1.getFields()); final FileBody fileBody = new FileBody(new File("/path/stuff.bin"), ContentType.DEFAULT_BINARY); final FormBodyPart bodyPart2 = builder @@ -114,7 +114,7 @@ public class TestFormBodyPartBuilder { new MimeField("header3", "blah"), new MimeField("header3", "blah"), new MimeField("Content-Disposition", "form-data; name=\"blah\""), - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header1.getFields()); final FormBodyPart bodyPart2 = builder @@ -130,7 +130,7 @@ public class TestFormBodyPartBuilder { new MimeField("header1", "blah"), new MimeField("header2", "yada"), new MimeField("Content-Disposition", "form-data; name=\"blah\""), - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header2.getFields()); final FormBodyPart bodyPart3 = builder diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartContentBody.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartContentBody.java index f05e56b89..5c07ae776 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartContentBody.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartContentBody.java @@ -41,7 +41,7 @@ public class TestMultipartContentBody { final StringBody b1 = new StringBody("text", ContentType.DEFAULT_TEXT); Assertions.assertEquals(4, b1.getContentLength()); - Assertions.assertEquals("ISO-8859-1", b1.getCharset()); + Assertions.assertEquals("UTF-8", b1.getCharset()); Assertions.assertNull(b1.getFilename()); Assertions.assertEquals("text/plain", b1.getMimeType()); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java index 963327193..6a55a821e 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java @@ -156,7 +156,7 @@ public class TestMultipartEntityBuilder { out.close(); Assertions.assertEquals("--xxxxxxxxxxxxxxxxxxxxxxxx\r\n" + "Content-Disposition: multipart/form-data; name=\"test\"; filename=\"hello world\"\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + helloWorld + "\r\n" + "--xxxxxxxxxxxxxxxxxxxxxxxx--\r\n", out.toString(StandardCharsets.US_ASCII.name())); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartForm.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartForm.java index d211f96f8..9df80b1c9 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartForm.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartForm.java @@ -60,7 +60,7 @@ public class TestMultipartForm { final FormBodyPart p2 = FormBodyPartBuilder.create( "field2", new StringBody("that stuff", ContentType.create( - ContentType.TEXT_PLAIN.getMimeType(), StandardCharsets.UTF_8))).build(); + ContentType.TEXT_PLAIN.getMimeType(), StandardCharsets.ISO_8859_1))).build(); final FormBodyPart p3 = FormBodyPartBuilder.create( "field3", new StringBody("all kind of stuff", ContentType.DEFAULT_TEXT)).build(); @@ -74,17 +74,17 @@ public class TestMultipartForm { final String expected = "--foo\r\n" + "Content-Disposition: form-data; name=\"field1\"\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + "this stuff\r\n" + "--foo\r\n" + "Content-Disposition: form-data; name=\"field2\"\r\n" + - "Content-Type: text/plain; charset=UTF-8\r\n" + + "Content-Type: text/plain; charset=ISO-8859-1\r\n" + "\r\n" + "that stuff\r\n" + "--foo\r\n" + "Content-Disposition: form-data; name=\"field3\"\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + "all kind of stuff\r\n" + "--foo--\r\n"; @@ -111,7 +111,7 @@ public class TestMultipartForm { final String expected = "--foo\r\n" + "Content-Disposition: form-data; name=\"field1\"\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + "this stuff\r\n" + "--foo\r\n" + diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartMixed.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartMixed.java index 77bd2c6a5..65faea0b5 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartMixed.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartMixed.java @@ -58,7 +58,7 @@ public class TestMultipartMixed { new StringBody("this stuff", ContentType.DEFAULT_TEXT)).build(); final MultipartPart p2 = MultipartPartBuilder.create( new StringBody("that stuff", ContentType.create( - ContentType.TEXT_PLAIN.getMimeType(), StandardCharsets.UTF_8))).build(); + ContentType.TEXT_PLAIN.getMimeType(), StandardCharsets.ISO_8859_1))).build(); final MultipartPart p3 = MultipartPartBuilder.create( new StringBody("all kind of stuff", ContentType.DEFAULT_TEXT)).build(); final HttpStrictMultipart multipart = new HttpStrictMultipart(null, "foo", @@ -70,15 +70,15 @@ public class TestMultipartMixed { final String expected = "--foo\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + "this stuff\r\n" + "--foo\r\n" + - "Content-Type: text/plain; charset=UTF-8\r\n" + + "Content-Type: text/plain; charset=ISO-8859-1\r\n" + "\r\n" + "that stuff\r\n" + "--foo\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + "all kind of stuff\r\n" + "--foo--\r\n"; @@ -102,7 +102,7 @@ public class TestMultipartMixed { final String expected = "--foo\r\n" + - "Content-Type: text/plain; charset=ISO-8859-1\r\n" + + "Content-Type: text/plain; charset=UTF-8\r\n" + "\r\n" + "this stuff\r\n" + "--foo\r\n" + diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartPartBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartPartBuilder.java index 5c7c66be3..0c1f01117 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartPartBuilder.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartPartBuilder.java @@ -49,7 +49,7 @@ public class TestMultipartPartBuilder { final Header header = part.getHeader(); Assertions.assertNotNull(header); assertFields(Collections.singletonList( - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header.getFields()); } @@ -65,7 +65,7 @@ public class TestMultipartPartBuilder { final Header header1 = part1.getHeader(); Assertions.assertNotNull(header1); assertFields(Collections.singletonList( - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header1.getFields()); final FileBody fileBody = new FileBody(new File("/path/stuff.bin"), ContentType.DEFAULT_BINARY); final MultipartPart part2 = builder @@ -105,7 +105,7 @@ public class TestMultipartPartBuilder { new MimeField("header3", "blah"), new MimeField("header3", "blah"), new MimeField("header3", "blah"), - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header1.getFields()); final MultipartPart part2 = builder @@ -120,7 +120,7 @@ public class TestMultipartPartBuilder { assertFields(Arrays.asList( new MimeField("header1", "blah"), new MimeField("header2", "yada"), - new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), + new MimeField("Content-Type", "text/plain; charset=UTF-8")), header2.getFields()); final MultipartPart part3 = builder diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java index 1efbbdd8a..ab4d839c9 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java @@ -145,6 +145,7 @@ public class TestURIUtils { Assertions.assertEquals(new HttpHost("localhost",8080), URIUtils.extractHost(new URI("http://user:pass@localhost:8080/abcd"))); + Assertions.assertEquals(new HttpHost("local_host",8080), URIUtils.extractHost(new URI("http://user:pass@local_host:8080/abcd"))); diff --git a/pom.xml b/pom.xml index e1b3a02c5..b5c21bea5 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 1.8 1.8 - 5.2.2 + 5.3-alpha1 2.22.0 0.1.2 2.5.2