소스 검색

ensure we only send one content-type and content-length header

tags/2.0.1
Jonathan Cobb 4 년 전
부모
커밋
813d84a9fb
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. +11
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/resources/ResourceUtil.java

+ 11
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/resources/ResourceUtil.java 파일 보기

@@ -70,7 +70,17 @@ public class ResourceUtil {
if (contentLength != null) builder = builder.header(CONTENT_LENGTH, contentLength);
if (headers != null) {
for (NameAndValue h : headers) {
builder = builder.header(h.getName(), h.getValue());
if (h.getName().equalsIgnoreCase(CONTENT_TYPE) && contentType != null) {
// we already added a Content-Type header, don't add a second one
if (log.isDebugEnabled()) log.debug("send: already added "+CONTENT_TYPE+" ("+contentType+"), not adding "+CONTENT_TYPE+" from headers: "+h.getValue());

} else if (h.getName().equalsIgnoreCase(CONTENT_LENGTH) && contentLength != null) {
// we already added a Content-Length header, don't add a second one
if (log.isDebugEnabled()) log.debug("send: already added "+CONTENT_LENGTH+" header ("+contentLength+"), not adding "+CONTENT_LENGTH+" from headers: "+h.getValue());

} else {
builder = builder.header(h.getName(), h.getValue());
}
}
}
return builder.build();


불러오는 중...
취소
저장