[νμ€ν] HTTP/1.1 intro / URL, TCP/IP
2023. 4. 18. 17:12γComputerScience/FullStackProgramming
Web Client and Servers
Basic components of the WWW
- INTERNET
- μ»΄ν¨ν°λ₯Ό μ μΌλ‘ μ°κ³ , μ κ³Ό μ μ μ°κ²°νλ©΄ μ»΄ν¨ν° λ€νΈμν¬κ° λλ€.
- μΈν°λ·(IP protocol)μΌλ‘ μ΄λ€μ μ°κ²°ν κ²
- WEB
- μΉ λΈλΌμ°μ νλ©΄μ μ±μ°κ³ μλ νλ©΄
- μΉ νμ΄μ§ - μΉ νμ΄μ§ κ° κ΄κ³ -> Web
- μ 보μ μ 보λ₯Ό μ°κ²°νλ κ²
- ν¨μ νΈμΆ κ³Όμ κ³Ό κ΅μ₯ν μ μ¬
- ν΄λΌμ΄μΈνΈκ° μ 보λ₯Ό 보λ΄λ©΄, httpκ° μλ΅μ μ€
- 물리νκ³Ό κ΄λ ¨λ μ°κ΅¬ μλ£λ€μ μ£Όκ³ λ°μ μ μλλ‘
- ν λ²λμ€λ¦¬
Resources
A resource is any kind of content source
- Static content
- File system
- MS word file, image file, Video Clip
- Full μμμ μͺΌκ°μ κ°μ Έμ€λ κ²
- μ€μκ° μ€νΈλ¦¬λ° μμλ, μ€μκ°μΌλ‘ μλ² νμΌ(static)μ 보λ΄λ κ²
- Dynamic content
- generated by SW program
- Live image, Trade Stocks, etc
- ν μκ°, λ΄ κ³μ’μ μκ³ λ₯Ό λ³΄κ³ μΆλ€
- ν΄λΉ μμ μ μλ²κ° 보λ΄μ€ μ 보λ₯Ό μ°Ύμμ μ£Όλ κ²
- URI (Uniform Resource Identifier)
- Server resource name
- Addresses of the Internet
- Uniquely identifying
- Locating information resource
- URL and URN
- Server resource name
- URI
- 컨μ
- μ΄λ μλ²(μ»΄ν¨ν°)μ μλ μ΄λ€ νμΌμ μ§μΉν μ μλ κ²
- κ·Έ μ»΄ν¨ν°μ μν κ·Έ νμΌ -> μ λν¬ ν΄μΌ ν¨
- URL - locator
- μΉ λΈλΌμ°μ κ° μμΌλ©΄, μ λν¬νκ² μ΄ μ»΄ν¨ν° μλμ νμΌμ μ§μΉνλ λͺ λͺ λ²
- locator -> μ λν¬ν μμΉλ₯Ό κΈ°λ°μΌλ‘ ν¨
- URN - name
- μ μΈκ³ λͺ¨λ νμΌμκ² (μμΉ μ λ³΄κ° μλ) μ λν¬ν μ΄λ¦μ μ§μ΄μ£Όμ
- μ΄λ¬ν κΈ°λ²μ νμ‘΄νμ§ μμ
- URLμ΄ μ΄μλ¨μ κ² - μ£Όμμ°½μ μ΄λ κ² λΆλ₯΄λ μ΄μ
- μ΄λ μ»΄ν¨ν°μ μ΄λ μμΉμ νμΌμ λ¬λΌ!
Transactions
Requests and Responses between HTTP Client/Server
- HTTP messages
- request
- response
< request >
- GET (λ©μλ)
리μμ€λ₯Ό μμ²νλ€
λ£¨νΈ directory λ°μ ~~ νμΌμ μ£ΌμΈμ
-> λ©μλμ URL
host -> μ μνλ μλ²μ μ£Όμλ λ£μ κ²
< response >
- νμΌμ΄ μκ³ , length
- λ€κ° μμ²ν getμ μ±κ³΅μ μΌλ‘ λλ¬μ΄
- 200 OK -> λ λ€ μλ―Έ(μ±κ³΅)λ₯Ό 보λ΄μ£Όλ κ²
- ν¨μμ λν 리ν΄κ°μ²λΌ λλ €μ€λ€
- HTTP νλ‘ν μ½λ‘ μλ΅νλ©°, λμ λ²μ μ 1.0μ΄μΌ
- HTTP methods
- supports several request commands
- server whar action to perform
- GET - κΈ°λ³Έμ μΈ λμ, get request - send named resource from the server to the client
- PUT - μ λ‘λ, μλ²μ 리μμ€λ₯Ό μ¬λ¦¬λ κ² - store data from client into a named server resource.
- DELETE - μλ²μ μλ 리μμ€λ₯Ό μ§μ°λ κ² - delete the named resource from a server
- POST - send client data into a server gateway application
- HEAD - send just the HTTP headers from the response for the named resource
- μ£Όκ³ λ°λκ² νμΌμ΄ μλ κ²½μ° -> 쑰건문 κ°μ url νμ
- νμΌμ μ£Όκ³ λ°λκ² μλλΌ, μ 보λ₯Ό μ£Όκ³ λ°λ κ² (κΈμ μΉκ³ enter)
- ν¨μ μ΄λ¦κ³Ό parameter μ£Όλ κ²κ³Ό μ μ¬ν μμ -> POST
- λ‘μ§μ΄ λ°μ μ²λ¦¬ν λ°μ΄ν°λ₯Ό 보λ΄λ κ²
- gateway, logic(dynamic μ²λ¦¬), DB(static μ μ₯) μ΄λ κ² 3κ°λ‘ ꡬμ±λ¨
Requests and Responses between HTTP Client/Server
- Status codes
- HTTP response contain status code
- Three - digit numeric code
- Explanatory textual "reason phrase"
- 200 - OK
- 302 - μλ²λ‘ μλλ°, λ³ΈμΈμ΄ μ§μ μ²λ¦¬νμ§ μκ³ , λ€λ₯Έ κ³³μΌλ‘ 보λ΄λ κ² ex) κ΅¬κΈ λ‘κ·ΈμΈ μ°½ μ₯μ₯
- 404 - not found - λ€κ° μμ²ν κ·Έ νμΌμ λμκ² μμ΄
- Web pages can consist of multiple objects
- κ΅μ₯ν λ§μ μλ²λ€μ΄ νλ©΄ 컨ν μΈ λ₯Ό ꡬμ±νλ κ²
- κ°λ°μ λꡬ -> λ€νΈμν¬ (reload)
Messages
Requests and Responses between HTTP Client/Server
- Request and Response
- No other kinds of HTTP Messages
- Line-oriented sequences of characters
- Easy for humans to read and write
- μλ²λ ν΄λΌμ΄μΈνΈκ° λ³΄λΈ μ‘°κ±΄ μμ²μ λ³΄κ³ , 쑰건μ λμμ ν μ μλ€.
- μμ΄ & νλμ€μ΄ μμ² -> λ νκΈλ§ μμ΄! λ±λ±
- mozilla foundation
firefox web browser
User agent - λ΄κ° μ§μνλ λΈλΌμ°μ λ₯Ό μλ €μ£Όλ κ² - www -> m
λͺ¨λ°μΌ λλ°μ΄μ€μ λ§λ νκ²½ (κΈ°μ’ μ νλ κ°λ₯! μ κΈ°νλ€) - κ²°κ΅μ μ΄ μμͺ½ user agentλ₯Ό κ³ λ €ν κ²
λͺ¨λ°μΌμμ PCλͺ¨λλ₯Ό λ³Ό μ μλ κ²λ λμΌν μ리
- Server - μ μλ €μ€ -> ν΄νΉ
- Last modified - μ΄ νμΌμ΄ μ΅μ’
μ μΌλ‘ μμ λ μκ°
μΊμ¬λ₯Ό μ¬μ©ν μ μλ μ΄μ !
μ±λ₯, μλ ν₯μ κ°λ₯
- 1) ν¬νΈ μ€μΊλ
ν¬νΈκ° μ΄λ Έλμ§ λ«νλμ§ νμΈνλ νλ‘κ·Έλ¨
OS λ¨κ³μ μ λμ€ λ¦¬λ μ€λ λλΆλΆ λ§€μ° μμ μ μ
λ¨μ μλ²λ₯Ό μ€μΊλνλ κ² μμ²΄λ‘ λΆλ² - 2) μΉ -> κ³μ λ²μ μ
application 보μ λ¬Έμ μ λ°μ
DB -> ν¨μΉ μλμμΌλ, κ·Έκ±Έ λ«μ μ μλ κ²
Connections
Transport layer under HTTP
TCP/IP
- Reliable Data Transfer (μ°κ²° μ€μ O)
- In Order Transfer
- Connection Oriented
- Bidirectional Byte Stream
- Flow control
- Congestion control
ν λ²λμ€ λ¦¬
error κ°μ μν©μ 볡μ‘νκ² κ³ λ €νκ³ μΆμ§ μμλ€
μμνκ² μ 보λ₯Ό 보λ΄κ³ , λ°λ κ²
μλ¬ κ²μΆ λ° λ³΅κ΅¬
μμ λ§μΆ°μ£Όκ³ , μ°κ²° μ€μ , flow control
λ°λΌμ http1.1μ νμ tcp/ipλ₯Ό κΉκ³ κ°λ€
- TCP/IPμ λ¨μ κ³ μ€λν
- 1) μ΄λ°μλ νμ λλ¦¬λ€ -> slow start
- 2) μ±λ₯μ 보μ₯ν μ μλ€.
- ν±λλ°ν΄ (νμ κ³ μμ, μΌμ ν data rateλ₯Ό μ μ§νλκ² λΆκ°λ₯)
- + human readable -> 200 OK -> λλΉ
- κ²°κ΅μ μ±λ₯μ΄ μ λμ¨κ² // μ§κΈμ 3κΉμ§
- TCPλ HTTP νλ¨μ κΉλ¦°λ€.
- μ’ μ’ HTTPS -> security
- μνΈν κΈ°λ₯μ΄ μΆκ°λ¨ (TLS, SSL)
- TPC : transport layer -> HTTP : Application layer
- μ νν HTTPκ° λμ§?
- Hyper Text Transfer Protocol
- HTML λ¬Έμλ₯Ό μ£Όκ³ λ°λ λ° μ°μ΄λ ν΅μ νλ‘ν μ½ (κ·μ½)
- ν΄λΌμ΄μΈνΈμ μλ² μ¬μ΄μ μμ²κ³Ό μλ΅μ λν νλ‘ν μ½
- Connections process
- TCP - connection oriented
μΈμ μ΄λ»κ² μ°κ²°λ κΉ? - URL νμ -> DNSλ₯Ό ν΅ν΄ IP μ£Όμ κ°μ Έμ΄
- HTTP 리νμ€νΈκ° λκ°κΈ° μ μ, μλλ°© μλ²μ TCP μ°κ²° μμ²μ λ¨Όμ ν¨
- μ΄ν HTTP GET request λ₯Ό 보λ΄κ³ , μλ΅μ λ°μ
- TCP μ°κ²°μ λλ κ³Όμ
- timer - μΌμ μκ° μ§λ¬λλ°, ν΄λΌμ΄μΈνΈ μμ² μμΌλ©΄
- 1. μλ² μΈ‘μμ μ°κ²°μ λκ±°λ
- 2. ν΄λΌμ΄μΈνΈκ° μ°κ²° ν΄μ μμ²
- μ¬μ©μκ° λλΌλ μ°κ²° μ§μ°μ΄λΌλ κ°λ μ΄ λ±μ₯!
- TCP - connection oriented
'ComputerScience > FullStackProgramming' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[νμ€ν] HTTP's streaming / Curl / SOA / Microservice (1) | 2023.04.19 |
---|---|
[νμ€ν] HTTP request methods / Proxy Cache (0) | 2023.04.18 |
[νμ€ν] ZMQ Pattern (0) | 2023.04.18 |
[νμ€ν] Zero message queue (ZMQ) (0) | 2023.04.17 |
[νμ€ν] Application Layer messaging protocol (0) | 2023.04.17 |