Send the 'real' (static) response for events. Don't compress responses for now, apparently this is somehow subtly broken and the client is rejecting very large responses that we've compressed

This commit is contained in:
skogaby 2019-01-14 15:28:28 -06:00
parent 25244e2fe5
commit 9185ba7967
2 changed files with 8 additions and 12 deletions

View File

@ -110,8 +110,9 @@ public abstract class BaseRequestHandler {
respBytes = BinaryXmlUtils.xmlToBinary(respBytes);
}
// TODO: FIX THIS SHIT
// compress if needed
final String compressionScheme = request.headers(COMPRESSION_HEADER);
/*final String compressionScheme = request.headers(COMPRESSION_HEADER);
if (!StringUtils.isBlank(compressionScheme) &&
compressionScheme.equals(LZ77_COMPRESSION)) {
@ -119,7 +120,10 @@ public abstract class BaseRequestHandler {
response.header(COMPRESSION_HEADER, LZ77_COMPRESSION);
} else {
response.header(COMPRESSION_HEADER, "none");
}
}*/
// TODO: For some reason this is breaking on very large responses (i.e. events). Fix later, leave uncompressed for now.
response.header(COMPRESSION_HEADER, "none");
// encrypt if needed
final String encryptionKey = request.headers(CRYPT_KEY_HEADER);

View File

@ -65,16 +65,8 @@ public class PlayerDataRequestHandler extends BaseRequestHandler {
*/
private Object handleEventsRequest(final Request request, final Response response) {
if (this.getSanitizedModel(request.attribute("model")).equals("mdx_2018042300")) {
// TODO: This is almost *definitely* not supposed to be a static response. That being
// said, loading the file directly and sending it isn't working out, so I need
// to recreate the events response via code, unfortunately. In the meantime,
// send an empty response...
final KXmlBuilder respBuilder = KXmlBuilder.create("response")
.e("playerdata")
.s32("result", 0).up()
.bool("is_new", false);
return this.sendResponse(request, response, respBuilder);
// TODO: This is almost *definitely* not supposed to be a static response
return this.sendStaticResponse(request, response, "static_responses/mdx_2018042300/events.xml");
} else {
throw new UnsupportedRequestException();
}