HTTP 웹 서버 1단계 - 구현 #32
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
오랜만에 온갖 해악을 저지른 코드를 짜보았습니다
HttpMessage의 구조
윈도우에서 8080 포트 사용중인 프로세스ID 찾는 명령
netstat -ano | grep 8080
set-cookie는 응답 200일 때 하는 것이지만, 302(redirect)일 때 set-cookie를 지원한다.
302(redirect)일 때, set-cookie를 해주는 이유는?
로그인 요청을 받은 뒤, 정상적인 아이디, 패스워드라서 응답으로 set-cookie와 redirect를 해주고 싶었지만, 200에서는 redirect 하는 방법을 찾기 못했다.
따라서 302에서 set-cookie하는 방법을 찾게 되었다.
다만, 200에서도 응답의 body에 이동하고자 하는 페이지를 담아주면 되지만, 이동한 page url은 표시되지 않고 그 전 페이지의 url이 주소표시줄에 남아있는다.
그리고 다음 요청부터는 남아있는 url을 기준으로 요청이 진행된다. (referer 관련 문제 같지만 확인하지 못했습니다)
깨달은 점