Skip to content

Commit 7fb5f75

Browse files
committed
fixed Multiple transfer-encoding=chunked in Rest Over Servlet
1 parent 255dee9 commit 7fb5f75

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

common/common-rest/src/main/java/org/apache/servicecomb/common/rest/filter/inner/ServerRestArgsFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static boolean isServerSendEvent(Response response) {
113113

114114
private static CompletableFuture<Void> writeServerSendEvent(Invocation invocation, Response response,
115115
ProduceProcessor produceProcessor, HttpServletResponseEx responseEx) {
116-
responseEx.setChunked(true);
116+
responseEx.setChunkedForEvent(true);
117117
refreshEventId(invocation.getRequestEx(), produceProcessor);
118118
CompletableFuture<Void> result = new CompletableFuture<>();
119119
Publisher<?> publisher = response.getResult();

foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/HttpServletResponseEx.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ default Flowable<Buffer> getFlowableBuffer() {
4848
}
4949

5050
void endResponse() throws IOException;
51+
52+
default void setChunkedForEvent(boolean chunked) {
53+
// not set header transfer-encoding=chunked in Rest Over Servlet, or will have Multiple in response.
54+
}
5155
}

foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/VertxServerResponseToHttpServletResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,9 @@ public CompletableFuture<Void> sendBuffer(Buffer buffer) {
153153
});
154154
return future;
155155
}
156+
157+
@Override
158+
public void setChunkedForEvent(boolean chunked) {
159+
serverResponse.setChunked(chunked);
160+
}
156161
}

0 commit comments

Comments
 (0)