Network

[Network] URI, URL, URN

큐범 2022. 9. 11. 01:43

URI, URL, URN

URI는 로케이터(locator), 이름(name) 또는 둘다 추가로 분류 될 수 있다.

https://www.ietf.org/rfc/rfc3986.txt - 1.1.3. URI, URL, and URN

URI: 리소스의 식별

URL: 리소스의 위치

URN: 리소스의 이름

 

URI

Uniform: 리소스 식별하는 통일된 방식

Resource: 자원, URI로 식별할 수 있는 모든 것(제한 없음)

Identifier: 다른 항목과 구분하는데 필요한 정보

 

URL, URN

URL - Locator: 리소스가 있는 위치를 지정한다.

URN - Name: 리소스에 이름을 부여한다.

위치는 변할 수 있지만, 이름은 변하지 않는다.

URN 이름만으로 실제 리소스를 찾을 수 있는 방법이 보편화 되지 않는다.

 

URL분석

https://www.google.com/search?q=hello&hl=ko 

 

URL 

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko

 

프로토콜(https)

호스트명(www.google.com)

포트 번호(443)

패스(/search)

쿼리 파라미터(q=hello&hl=ko)

 

URL - scheme

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko

- 주로 프로토콜을 사용한다.

- 프로토콜은 어떤 방식으로 자원에 접근할 것인가 하는 약속 규칙이다. 예를들어, Http, Https, ftp 등이 있다.

- http는 80포트, https는 443포트를 주로 사용하고 포트는 생략이 가능하다.

- https는 http에 보안 추가한 것이다.

 

URL-userinfo

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko

- URL에 사용자 정보를 포함해서 인증하는 방식이다.

 

URL-host

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko

- 호스트명으로 도메인명 또는 IP 주소를 직접 사용가능하다.

 

URL-PORT

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko 

- 접속 포트로 일반적으로 생략하며 생략시에는 http는 80, https는 443을 넣는다.

 

URL-path

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko 

- 리소스 경로(path), 계층적 구조

- 예를들어 /home/file1.jpg.      /members/100.     /items/iphone12.

 

URL-query

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://www.google.com:443/search?q=hello&hl=ko 

- key = value형태로 ?로 시작해서 &로 추가 가능하다. Ex)keyA=valueA&keyB=valueB

- query parameter, query string 등으로 불린다. 웹서버에 제공하는 파라미터, 문자 형태이다.

 

URL-fragment

scheme://[userinfo@]host[:port][/path][?query][#fragment]

https://docs.spring.io/spring-boot/docs/current/reference/html#getting-started.html#getting-started-introducing-spring-boot

- html 내부 북마크 등에 사용되며 서버에 전송하는 정보가 아니다.

 

Reference.

 

모든 개발자를 위한 HTTP 웹 기본 지식 - 인프런 | 강의

실무에 꼭 필요한 HTTP 핵심 기능과 올바른 HTTP API 설계 방법을 학습합니다., - 강의 소개 | 인프런...

www.inflearn.com