Upgraded HttpCore to version 5.3-alpha1

This commit is contained in:
Oleg Kalnichevski 2023-12-18 12:40:50 +01:00
parent f2ea21bea9
commit 20bd815e74
11 changed files with 28 additions and 27 deletions

View File

@ -235,7 +235,7 @@ public abstract class TestContentCodings {
* Create a load of workers which will access the resource. Half will use the default * Create a load of workers which will access the resource. Half will use the default
* gzip behaviour; half will require identity entity. * gzip behaviour; half will require identity entity.
*/ */
final int clients = 100; final int clients = 10;
connManager.setMaxTotal(clients); connManager.setMaxTotal(clients);

View File

@ -50,8 +50,8 @@ public class TestMalformedServerResponse {
static class BrokenServerConnection extends DefaultBHttpServerConnection { static class BrokenServerConnection extends DefaultBHttpServerConnection {
public BrokenServerConnection(final Http1Config h1Config) { public BrokenServerConnection(final String scheme, final Http1Config h1Config) {
super(null, h1Config); super(scheme, h1Config);
} }
@Override @Override
@ -77,7 +77,7 @@ public class TestMalformedServerResponse {
@Override @Override
public DefaultBHttpServerConnection createConnection(final Socket socket) throws IOException { 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); conn.bind(socket);
return conn; return conn;
} }

View File

@ -51,7 +51,7 @@ public class TestEntityBuilder {
Assertions.assertNotNull(entity); Assertions.assertNotNull(entity);
Assertions.assertNotNull(entity.getContent()); Assertions.assertNotNull(entity.getContent());
Assertions.assertNotNull(entity.getContentType()); Assertions.assertNotNull(entity.getContentType());
Assertions.assertEquals("text/plain; charset=ISO-8859-1", entity.getContentType()); Assertions.assertEquals("text/plain; charset=UTF-8", entity.getContentType());
} }
@Test @Test
@ -119,7 +119,7 @@ public class TestEntityBuilder {
final HttpEntity entity = EntityBuilder.create().setText("stuff").gzipCompressed().build(); final HttpEntity entity = EntityBuilder.create().setText("stuff").gzipCompressed().build();
Assertions.assertNotNull(entity); Assertions.assertNotNull(entity);
Assertions.assertNotNull(entity.getContentType()); 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.assertNotNull(entity.getContentEncoding());
Assertions.assertEquals("gzip", entity.getContentEncoding()); Assertions.assertEquals("gzip", entity.getContentEncoding());
} }

View File

@ -51,7 +51,7 @@ public class TestFormBodyPartBuilder {
Assertions.assertNotNull(header); Assertions.assertNotNull(header);
assertFields(Arrays.asList( assertFields(Arrays.asList(
new MimeField("Content-Disposition", "form-data; name=\"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")),
header.getFields()); header.getFields());
} }
@ -70,7 +70,7 @@ public class TestFormBodyPartBuilder {
Assertions.assertNotNull(header1); Assertions.assertNotNull(header1);
assertFields(Arrays.asList( assertFields(Arrays.asList(
new MimeField("Content-Disposition", "form-data; name=\"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()); header1.getFields());
final FileBody fileBody = new FileBody(new File("/path/stuff.bin"), ContentType.DEFAULT_BINARY); final FileBody fileBody = new FileBody(new File("/path/stuff.bin"), ContentType.DEFAULT_BINARY);
final FormBodyPart bodyPart2 = builder final FormBodyPart bodyPart2 = builder
@ -114,7 +114,7 @@ public class TestFormBodyPartBuilder {
new MimeField("header3", "blah"), new MimeField("header3", "blah"),
new MimeField("header3", "blah"), new MimeField("header3", "blah"),
new MimeField("Content-Disposition", "form-data; name=\"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()); header1.getFields());
final FormBodyPart bodyPart2 = builder final FormBodyPart bodyPart2 = builder
@ -130,7 +130,7 @@ public class TestFormBodyPartBuilder {
new MimeField("header1", "blah"), new MimeField("header1", "blah"),
new MimeField("header2", "yada"), new MimeField("header2", "yada"),
new MimeField("Content-Disposition", "form-data; name=\"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")),
header2.getFields()); header2.getFields());
final FormBodyPart bodyPart3 = builder final FormBodyPart bodyPart3 = builder

View File

@ -41,7 +41,7 @@ public class TestMultipartContentBody {
final StringBody b1 = new StringBody("text", ContentType.DEFAULT_TEXT); final StringBody b1 = new StringBody("text", ContentType.DEFAULT_TEXT);
Assertions.assertEquals(4, b1.getContentLength()); Assertions.assertEquals(4, b1.getContentLength());
Assertions.assertEquals("ISO-8859-1", b1.getCharset()); Assertions.assertEquals("UTF-8", b1.getCharset());
Assertions.assertNull(b1.getFilename()); Assertions.assertNull(b1.getFilename());
Assertions.assertEquals("text/plain", b1.getMimeType()); Assertions.assertEquals("text/plain", b1.getMimeType());

View File

@ -156,7 +156,7 @@ public class TestMultipartEntityBuilder {
out.close(); out.close();
Assertions.assertEquals("--xxxxxxxxxxxxxxxxxxxxxxxx\r\n" + Assertions.assertEquals("--xxxxxxxxxxxxxxxxxxxxxxxx\r\n" +
"Content-Disposition: multipart/form-data; name=\"test\"; filename=\"hello world\"\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" + "\r\n" +
helloWorld + "\r\n" + helloWorld + "\r\n" +
"--xxxxxxxxxxxxxxxxxxxxxxxx--\r\n", out.toString(StandardCharsets.US_ASCII.name())); "--xxxxxxxxxxxxxxxxxxxxxxxx--\r\n", out.toString(StandardCharsets.US_ASCII.name()));

View File

@ -60,7 +60,7 @@ public class TestMultipartForm {
final FormBodyPart p2 = FormBodyPartBuilder.create( final FormBodyPart p2 = FormBodyPartBuilder.create(
"field2", "field2",
new StringBody("that stuff", ContentType.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 FormBodyPart p3 = FormBodyPartBuilder.create( final FormBodyPart p3 = FormBodyPartBuilder.create(
"field3", "field3",
new StringBody("all kind of stuff", ContentType.DEFAULT_TEXT)).build(); new StringBody("all kind of stuff", ContentType.DEFAULT_TEXT)).build();
@ -74,17 +74,17 @@ public class TestMultipartForm {
final String expected = final String expected =
"--foo\r\n" + "--foo\r\n" +
"Content-Disposition: form-data; name=\"field1\"\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" + "\r\n" +
"this stuff\r\n" + "this stuff\r\n" +
"--foo\r\n" + "--foo\r\n" +
"Content-Disposition: form-data; name=\"field2\"\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" + "\r\n" +
"that stuff\r\n" + "that stuff\r\n" +
"--foo\r\n" + "--foo\r\n" +
"Content-Disposition: form-data; name=\"field3\"\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" + "\r\n" +
"all kind of stuff\r\n" + "all kind of stuff\r\n" +
"--foo--\r\n"; "--foo--\r\n";
@ -111,7 +111,7 @@ public class TestMultipartForm {
final String expected = final String expected =
"--foo\r\n" + "--foo\r\n" +
"Content-Disposition: form-data; name=\"field1\"\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" + "\r\n" +
"this stuff\r\n" + "this stuff\r\n" +
"--foo\r\n" + "--foo\r\n" +

View File

@ -58,7 +58,7 @@ public class TestMultipartMixed {
new StringBody("this stuff", ContentType.DEFAULT_TEXT)).build(); new StringBody("this stuff", ContentType.DEFAULT_TEXT)).build();
final MultipartPart p2 = MultipartPartBuilder.create( final MultipartPart p2 = MultipartPartBuilder.create(
new StringBody("that stuff", ContentType.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( final MultipartPart p3 = MultipartPartBuilder.create(
new StringBody("all kind of stuff", ContentType.DEFAULT_TEXT)).build(); new StringBody("all kind of stuff", ContentType.DEFAULT_TEXT)).build();
final HttpStrictMultipart multipart = new HttpStrictMultipart(null, "foo", final HttpStrictMultipart multipart = new HttpStrictMultipart(null, "foo",
@ -70,15 +70,15 @@ public class TestMultipartMixed {
final String expected = final String expected =
"--foo\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" + "\r\n" +
"this stuff\r\n" + "this stuff\r\n" +
"--foo\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" + "\r\n" +
"that stuff\r\n" + "that stuff\r\n" +
"--foo\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" + "\r\n" +
"all kind of stuff\r\n" + "all kind of stuff\r\n" +
"--foo--\r\n"; "--foo--\r\n";
@ -102,7 +102,7 @@ public class TestMultipartMixed {
final String expected = final String expected =
"--foo\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" + "\r\n" +
"this stuff\r\n" + "this stuff\r\n" +
"--foo\r\n" + "--foo\r\n" +

View File

@ -49,7 +49,7 @@ public class TestMultipartPartBuilder {
final Header header = part.getHeader(); final Header header = part.getHeader();
Assertions.assertNotNull(header); Assertions.assertNotNull(header);
assertFields(Collections.singletonList( assertFields(Collections.singletonList(
new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), new MimeField("Content-Type", "text/plain; charset=UTF-8")),
header.getFields()); header.getFields());
} }
@ -65,7 +65,7 @@ public class TestMultipartPartBuilder {
final Header header1 = part1.getHeader(); final Header header1 = part1.getHeader();
Assertions.assertNotNull(header1); Assertions.assertNotNull(header1);
assertFields(Collections.singletonList( assertFields(Collections.singletonList(
new MimeField("Content-Type", "text/plain; charset=ISO-8859-1")), new MimeField("Content-Type", "text/plain; charset=UTF-8")),
header1.getFields()); header1.getFields());
final FileBody fileBody = new FileBody(new File("/path/stuff.bin"), ContentType.DEFAULT_BINARY); final FileBody fileBody = new FileBody(new File("/path/stuff.bin"), ContentType.DEFAULT_BINARY);
final MultipartPart part2 = builder 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("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()); header1.getFields());
final MultipartPart part2 = builder final MultipartPart part2 = builder
@ -120,7 +120,7 @@ public class TestMultipartPartBuilder {
assertFields(Arrays.asList( assertFields(Arrays.asList(
new MimeField("header1", "blah"), new MimeField("header1", "blah"),
new MimeField("header2", "yada"), 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()); header2.getFields());
final MultipartPart part3 = builder final MultipartPart part3 = builder

View File

@ -145,6 +145,7 @@ public class TestURIUtils {
Assertions.assertEquals(new HttpHost("localhost",8080), Assertions.assertEquals(new HttpHost("localhost",8080),
URIUtils.extractHost(new URI("http://user:pass@localhost:8080/abcd"))); URIUtils.extractHost(new URI("http://user:pass@localhost:8080/abcd")));
Assertions.assertEquals(new HttpHost("local_host",8080), Assertions.assertEquals(new HttpHost("local_host",8080),
URIUtils.extractHost(new URI("http://user:pass@local_host:8080/abcd"))); URIUtils.extractHost(new URI("http://user:pass@local_host:8080/abcd")));

View File

@ -62,7 +62,7 @@
<properties> <properties>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<httpcore.version>5.2.2</httpcore.version> <httpcore.version>5.3-alpha1</httpcore.version>
<log4j.version>2.22.0</log4j.version> <log4j.version>2.22.0</log4j.version>
<brotli.version>0.1.2</brotli.version> <brotli.version>0.1.2</brotli.version>
<conscrypt.version>2.5.2</conscrypt.version> <conscrypt.version>2.5.2</conscrypt.version>