fix query paramater encoding in RequestBuilder, update to Gradle 5.1, update to Netty 4.1.33

This commit is contained in:
Jörg Prante 2019-02-05 16:11:25 +01:00
parent 42c147cec1
commit 3d683d0b83
8 changed files with 21 additions and 11 deletions

View file

@ -2,7 +2,7 @@ import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
plugins {
id "com.github.spotbugs" version "1.6.5"
id "com.github.spotbugs" version "1.6.9"
id "org.sonarqube" version "2.6.1"
id "io.codearte.nexus-staging" version "0.11.0"
id "org.xbib.gradle.plugin.asciidoctor" version "1.5.6.0.1"

View file

@ -1,11 +1,11 @@
group = org.xbib
name = netty-http
version = 4.1.32.0
version = 4.1.33.0
netty.version = 4.1.32.Final
netty.version = 4.1.33.Final
tcnative.version = 2.0.20.Final
bouncycastle.version = 1.60
xbib-net-url.version = 1.1.3
xbib-net-url.version = 1.2.1
alpnagent.version = 2.0.9
# tests /docs
@ -14,3 +14,5 @@ conscrypt.version = 1.0.1
jackson.version = 2.8.11.1
wagon.version = 3.0.0
asciidoclet.version = 1.5.4
org.gradle.warning.mode=all

Binary file not shown.

View file

@ -1,6 +1,6 @@
#Tue Nov 13 10:38:26 CET 2018
#Tue Feb 05 16:02:21 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip

2
gradlew vendored
View file

@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

2
gradlew.bat vendored
View file

@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

View file

@ -14,13 +14,14 @@ import io.netty.handler.codec.http.QueryStringEncoder;
import io.netty.handler.codec.http.cookie.Cookie;
import io.netty.handler.codec.http2.HttpConversionUtil;
import io.netty.util.AsciiString;
import org.xbib.net.PercentEncoder;
import org.xbib.net.PercentEncoders;
import org.xbib.net.QueryParameters;
import org.xbib.net.URL;
import org.xbib.net.URLSyntaxException;
import org.xbib.netty.http.client.retry.BackOff;
import org.xbib.netty.http.common.HttpAddress;
import java.net.MalformedURLException;
import java.net.URI;
import java.nio.charset.MalformedInputException;
import java.nio.charset.StandardCharsets;
@ -62,6 +63,8 @@ public class RequestBuilder {
private final Collection<Cookie> cookies;
private final PercentEncoder encoder;
private HttpMethod httpMethod;
private HttpHeaders headers;
@ -106,6 +109,7 @@ public class RequestBuilder {
headers = new DefaultHttpHeaders();
removeHeaders = new ArrayList<>();
cookies = new HashSet<>();
encoder = PercentEncoders.getQueryEncoder(StandardCharsets.UTF_8);
queryParameters = new QueryParameters();
}
@ -185,7 +189,11 @@ public class RequestBuilder {
public RequestBuilder addParameter(String name, String value) {
if (queryParameters != null) {
queryParameters.add(name, value);
try {
queryParameters.add(name, encoder.encode(value));
} catch (MalformedInputException | UnmappableCharacterException e) {
throw new IllegalArgumentException(e);
}
}
return this;
}

View file

@ -51,7 +51,7 @@ public class XbibTest extends TestBase {
try {
return httpClient.execute(Request.post()
.url("http://google.de")
.addParameter("query", content)
.addParameter("query", content.substring(0, 15))
.build(), httpResponseStringFunction);
} catch (IOException e) {
logger.log(Level.WARNING, e.getMessage(), e);