한글도메인 사용시 자바스크립트 isSameHost() 함수가 오작동하는 것을 고침#2264
Merged
1 commit merged intoJun 4, 2018
Merged
Conversation
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
한글도메인 사용시 동일한 도메인을 두 가지 이상의 형태로 표현할 수 있습니다. 이것 때문에 isSameHost() 함수가 동일한 도메인 여부를 제대로 판단하지 못합니다. URI.js에서 제공하는 normalizeHostname() 함수를 사용하여 punycode로 통일한 후 비교하도록 수정합니다.
불필요하게 포트가 붙은 주소도 정확하게 비교하도록 하기 위해 normalizePort() 함수도 추가합니다.
사실 URI.js에서 제공하는 normalize() 함수 하나만 호출하면 모두 정규화시켜 주지만, 쿼리스트링이나 fragment 등 불필요한 부분을 처리하느라 자원이 낭비되므로 꼭 필요한 3가지(hostname, port, pathname)만 정규화하도록 했습니다.
참고: rhymix/rhymix#1037 thanks to @misol