From: David ‘Bombe’ Roden Date: Mon, 21 Mar 2011 15:34:13 +0000 (+0100) Subject: Encode ampersand (“&”) and equals signs (“=”) in URL. X-Git-Tag: 0.5.2^2~3^2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4063955ca29367290922c49234f88cb7591a849f;p=Sone.git Encode ampersand (“&”) and equals signs (“=”) in URL. --- diff --git a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index a6a87df..a04873d 100644 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@ -213,12 +213,12 @@ public class SoneTemplatePage extends TemplatePage { StringBuilder requestParameters = new StringBuilder(); for (String parameterName : httpRequest.getParameterNames()) { if (requestParameters.length() > 0) { - requestParameters.append('&'); + requestParameters.append("%26"); } String[] parameterValues = httpRequest.getMultipleParam(parameterName); for (String parameterValue : parameterValues) { try { - requestParameters.append(URLEncoder.encode(parameterName, "UTF-8")).append('=').append(URLEncoder.encode(parameterValue, "UTF-8")); + requestParameters.append(URLEncoder.encode(parameterName, "UTF-8")).append("%3d").append(URLEncoder.encode(parameterValue, "UTF-8")); } catch (UnsupportedEncodingException uee1) { /* A JVM without UTF-8? I don’t think so. */ }