TIL40. HTTP : URI, URL and URN

ID์งฑ์žฌยท2021๋…„ 10์›” 15์ผ
0

HTTP

๋ชฉ๋ก ๋ณด๊ธฐ
3/17
post-thumbnail
post-custom-banner

๐Ÿ“Œ ์ด ํฌ์ŠคํŒ…์—์„œ๋Š” HTTP์˜ URI, URL, URN์— ๋Œ€ํ•œ ๊ฐœ๋…์„ ์ •๋ฆฌํ•˜์˜€์Šต๋‹ˆ๋‹ค.



1. URI, URL and URN

๐Ÿค” URI, URL and URN์€ ๋ฌด์—‡์ผ๊นŒ?

โœ”๏ธ URI๋Š” Uniform Resource Identifier(์ž์›์„ ์‹๋ณ„ํ•˜๋Š” ํ†ตํ•ฉ๋œ ๋ฐฉ๋ฒ•)์˜ ์•ฝ์ž๋กœ,, URL ๋˜๋Š” URN์€ ํฌํ•จํ•˜๊ฑฐ๋‚˜, ๋‘˜ ๋‹ค๋ฅผ ํฌํ•จํ•  ์ˆ˜๋„ ์žˆ๋Š” ํฌ๊ด„์  ๊ฐœ๋…์ž…๋‹ˆ๋‹ค. ์ฆ‰, ์–ด๋–ค ์ž์› ์ž์ฒด๋ฅผ ์‹๋ณ„ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋”ฐ๋ฅธ URL ๋˜๋Š” URN์œผ๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค.

โœ”๏ธ URL์€ Uniform Resource Locator์˜ ์•ฝ์ž๋กœ, ์šฐ๋ฆฌ๊ฐ€ ํ”ํžˆ ์•„๋Š” ๊ทธ URL์ž…๋‹ˆ๋‹ค. ์ฆ‰, ํ•œ ์ž์›์— ๋Œ€ํ•œ ๊ตฌ์ฒด์ ์ธ ์œ„์น˜์ž…๋‹ˆ๋‹ค. URL์€ "https://www.google.com"๊ณผ ๊ฐ™์ด ๋ฆฌ์†Œ์Šค๊ฐ€ ์ •ํ™•ํžˆ ์–ด๋””(Where)์— ์žˆ๊ณ  ์–ด๋–ป๊ฒŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ๋ถ„๋ช…ํžˆ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.

โœ”๏ธ URN์€ Uniform Resource Name์˜ ์•ฝ์ž๋กœ, ํ•ด๋‹น ์ž์›์ด ๋ฌด์—‡์ธ์ง€ ์œ ์ผํ•˜๊ฒŒ ์‹๋ณ„ํ•˜๋Š” ์ด๋ฆ„์ด๊ธฐ ๋•Œ๋ฌธ์— ์ž์›๊ฐ„์— ์ด๋ฆ„ ์ค‘๋ณต์ด ์—†์Šต๋‹ˆ๋‹ค. URL๊ณผ ๋น„๊ตํ•ด์„œ ์ดํ•ดํ•˜๋ฉด URN์€ What์„ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฐœ๋…์œผ๋กœ ๋„์„œ์˜ ISBN์ด๋‚˜ ์ฃผ๋ฏผ๋“ฑ๋ก๋ฒˆํ˜ธ์™€ ๊ฐ™์€ ๊ฒƒ์„ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

โœ”๏ธ ๋‹ค๋งŒ, URN๋งŒ์œผ๋กœ๋Š” ์‹ค์ œ ๋ฆฌ์†Œ์Šค๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ๋ณดํŽธํ™”๋˜์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ผ๋ฐ˜์ ์œผ๋กœ ์ž์›์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•ด URL์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

๐Ÿค” URL ๊ตฌ์กฐ๋Š” ์–ด๋–ป๊ฒŒ ๋˜์–ด์žˆ์„๊นŒ?

โœ”๏ธ scheme๋Š” ์ฃผ๋กœ ์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ ์ž์›์— ์ ‘๊ทผํ•  ๊ฒƒ์ธ๊ฐ€ํ•˜๋Š” ๊ทœ์•ฝ์ธ ํ”„๋กœํ† ์ฝœ์„ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋ฉฐ, http, https, ftp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
โœ”๏ธ host๋กœ๋Š” Domain๋ช… ๋˜๋Š” IP์ฃผ์†Œ๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
โœ”๏ธ port๋Š” http์˜ ๊ฒฝ์šฐ 80ํฌํŠธ, https์˜ ๊ฒฝ์šฐ 443 ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  RFC์— ๋”ฐ๋ฅด๋ฉด ์ƒ๋žต ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
โœ”๏ธ path๋Š” ํ•ด๋‹น ์ž์›์ด ์œ„์น˜ํ•œ ๊ตฌ์ฒด์ ์ธ ๊ฒฝ๋กœ์ด๊ณ , ๋””๋ ‰ํ† ๋ฆฌ ์ฒ˜๋Ÿผ ๊ณ„์ธต์  ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, 'google.com/accounts/111'์ด๋ผ๋ฉด, 'accounts/111'์ด path์ด๊ณ , accounts์— 111๋ฒˆ ๊ณ„์ •์„ ์‹๋ณ„ํ•˜๊ธฐ ์œ„ํ•œ ๋ชฉ์ ์ž„์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
โœ”๏ธ query parameters๋Š” key์™€ value์˜ ์Œ์œผ๋กœ ์ด๋ค„์ง€๋ฉด, ๋ฌผ์Œํ‘œ(?)๋กœ ์‹œ์ž‘๋˜๋Š” ๋ถ€๋ถ„์ด query parameters์˜ ์‹œ์ž‘์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ key์™€ value์˜ ์Œ์„ ์—ฌ๋Ÿฌ๊ฐœ query parameter๋กœ ์ „๋‹ฌํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” &๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. query, query string ๋“ฑ์œผ๋กœ๋„ ๋ถˆ๋ฆฝ๋‹ˆ๋‹ค.
โœ”๏ธ fragment๋Š” html์˜ ๋‚ด๋ถ€ ๋ถ๋งˆํฌ ๋“ฑ์— ์‚ฌ์šฉ๋˜๊ณ  ์„œ๋ฒ„์— ์ „์†กํ•˜๋Š” ์ •๋ณด๋Š” ์•„๋‹™๋‹ˆ๋‹ค.

profile
Keep Going, Keep Coding!
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€