URI

Hye·2023년 2월 16일
0

URI

  • Uniform Resource Identifier

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

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

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

  • Name, Locator로 분류될 수 있음

URN

  • Uniform Resouce Name
  • Name : 리소스에 이름을 부여
    • 이름 : 변하지 않음
  • URN 이름만으로 실제 리소스를 찾을 수 있는 방법이 보편화되어 있지 않음

URL

  • Uniform Resource Locator
  • Locator : 리소스가 있는 위치를 지정
    • 위치 : 변할 수 있음

문법

scheme

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

ex.)
**https:**//www.google.com:443/search?q=hello&hl=ko
  • 주로 프로토콜 사용
  • 프로토콜
    • 어떤 방식으로 자원에 접근할 것인가를 정하는 약속
      • ex. http, https, ftp 등
  • http - 80, https - 443 포트를 주로 사용
    • 포트는 생략 가능
  • https는 http에 보안이 추가된 것 (HTTP Secure)

userinfo

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

ex.)
https://www.google.com:443/search?q=hello&hl=ko
  • URL에 사용자 정보를 포함해서 인증
  • 거의 사용하지 않음

host

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

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

  • 호스트명
  • 도메인명 또는 IP 주소를 직접 사용 가능

port

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

ex.)
https://www.google.com**:443**/search?q=hello&hl=ko
  • 접속 포트
  • 일반적으로 생략
    • 생략시 http는 80, https는 443

path

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

ex.)
https://www.google.com:443**/search**?q=hello&hl=ko
  • 리소스 경로
  • 계층적 구조

query

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

ex.)
https://www.google.com:443/search**?q=hello&hl=ko**
  • key=value 형태
  • ?로 시작, &로 추가 가능
    • ex.) keyA=valueA&keyB=valueB
  • query parameter, query string 등으로 부름

fragment

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

ex.)
https://www.google.com:443/search?q=hello&hl=ko**#hi**
  • html 내부 북마크 등에 사용
  • 서버에 전송하는 정보 X

참고자료
인프런, 김영한, 모든 개발자를 위한 HTTP 웹 기본 지식 강의

profile
공부중 📚

0개의 댓글