From 961f785060f749ed97b0516745cb9ad2fd2704cc Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 30 Sep 2016 09:22:29 +0200 Subject: refactor http servlet response processing to prohibit 'chunked' transfer encoding --- .../moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java | 5 ++++- .../at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java | 6 ++++-- .../moa/id/protocols/eidas/eIDASAuthenticationRequest.java | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'id/server/modules/moa-id-module-eIDAS/src/main') diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java index 30c206025..84b0078b3 100644 --- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java +++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java @@ -179,8 +179,11 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask { Logger.debug("Sending html content: " + writer.getBuffer().toString()); + + byte[] content = writer.getBuffer().toString().getBytes("UTF-8"); response.setContentType(MediaType.HTML_UTF_8.toString()); - response.getOutputStream().write(writer.getBuffer().toString().getBytes("UTF-8")); + response.setContentLength(content.length); + response.getOutputStream().write(content); revisionsLogger.logEvent(oaConfig, pendingReq, MOAIDEventConstants.AUTHPROCESS_PEPS_REQUESTED, diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java index 24134f1d9..779d898be 100644 --- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java +++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/EIDASProtocol.java @@ -316,9 +316,11 @@ public class EIDASProtocol extends AbstractAuthProtocolModulController { Logger.trace("Sending html content : " + new String(writer.getBuffer())); - response.getOutputStream().write(writer.getBuffer().toString().getBytes("UTF-8")); + byte[] content = writer.getBuffer().toString().getBytes("UTF-8"); response.setContentType(MediaType.TEXT_HTML.getType()); - + response.setContentLength(content.length); + response.getOutputStream().write(content); + return true; } catch (Exception e1 ) { diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/eIDASAuthenticationRequest.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/eIDASAuthenticationRequest.java index 9943cc5fb..ebd4e1e6d 100644 --- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/eIDASAuthenticationRequest.java +++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/eIDASAuthenticationRequest.java @@ -165,8 +165,11 @@ public class eIDASAuthenticationRequest implements IAction { Logger.trace("Sending html content : " + new String(writer.getBuffer())); - httpResp.getOutputStream().write(writer.getBuffer().toString().getBytes("UTF-8")); + byte[] content = writer.getBuffer().toString().getBytes("UTF-8"); httpResp.setContentType(MediaType.TEXT_HTML.getType()); + httpResp.setContentLength(content.length); + httpResp.getOutputStream().write(content); + } catch (Exception e) { Logger.error("Velocity error: " + e.getMessage()); -- cgit v1.2.3