Fix double-URL-encoding bug in LoadTestAction

This was inadvertently introduced in [] - the original code manually URL-encoded the XML, but the TaskOptions.param() method does that for you, so now we're double-URL-encoding the XML and as a result the actual /_dr/epptool invocation is failing with a syntax error (which was somewhat hard to diagnose, since it logs nothing and returns HTTP 200 in that case - to be fixed separately).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137321114
This commit is contained in:
nickfelt 2016-10-26 14:36:32 -07:00 committed by Ben McIlwain
parent 748dd34385
commit 1ac0832c79

View file

@ -22,7 +22,6 @@ import static com.google.common.collect.Lists.transform;
import static google.registry.security.XsrfTokenManager.X_CSRF_TOKEN;
import static google.registry.util.FormattingLogger.getLoggerForCallerClass;
import static google.registry.util.ResourceUtils.readResourceUtf8;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Arrays.asList;
import static org.joda.time.DateTimeZone.UTC;
@ -37,8 +36,6 @@ import google.registry.request.Parameter;
import google.registry.security.XsrfTokenManager;
import google.registry.util.FormattingLogger;
import google.registry.util.TaskEnqueuer;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@ -339,19 +336,11 @@ public class LoadTestAction implements Runnable {
.param("clientId", clientId)
.param("superuser", Boolean.FALSE.toString())
.param("dryRun", Boolean.FALSE.toString())
.param("xml", urlEncode(xmls.get(i))));
.param("xml", xmls.get(i)));
}
return tasks.build();
}
private String urlEncode(String xml) {
try {
return URLEncoder.encode(xml, UTF_8.toString());
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
private void enqueue(List<TaskOptions> tasks) {
List<List<TaskOptions>> chunks = partition(tasks, maxTasksPerAdd());
// Farm out tasks to multiple queues to work around queue qps quotas.