Skip to content

Commit

Permalink
docs: getContentLength에 Content-Length 관련 TODO 주석 작성
Browse files Browse the repository at this point in the history
이슈도 작성함. #59
  • Loading branch information
Dae-Hwa committed Sep 16, 2021
1 parent c519e02 commit 2e92901
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/webserver/http/header/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public byte[] getBytes() {
protected abstract String getStatusLine();

public int getContentLength() {
/*
* TODO:Transfer-Encoding이 포함되면 Content-Length가 포함되지 않아야 한다고 함. 찾아보기
* A sender MUST NOT send a Content-Length header field in any message that contains a Transfer-Encoding header field.
* https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2
* 만약 이 경우 body 읽는 로직 바뀌어야 할 수 있음(현재는 Content-length에 따라서 읽도록 되어있음)
*/
return Integer.parseInt(attributes.getOrDefault("Content-Length", "0"));
}
}

0 comments on commit 2e92901

Please sign in to comment.