ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • HTTP Request Response structure
    Search: WebService WebService 2022. 8. 10. 12:06

    Http 구조, 요청과 응답 구조

     

    D28xx 정리중 https://infos.tistory.com/4659

     

    Http는 Client로 부터 Request가 있으면 Server로 부터 Response가 되는 요청과 응답의 관계로 동작한다.

    Http에서 CSS, Images, JavaScript 등이 필요하면 각각 개별로 Request와 Response의 짝을 이루는 절차를 거친다.

    2022.09.23 - Http Keep Alive

     

    HttpRequestEx

    일반적으로 GET으로 request를 보내면 아래 형태의 내용들이 서버로 넘어간다

    RequestLine

    GET /testpage/testoption/ HTTP/1.1

    Headers

    Host: testx1234.testserver.com
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Cookie: PHPSESSID=r2t5uvjq435r4q7ifasxtdjq120
    Pragma: no-cache
    Cache-Control: no-cache

     

     

    HttpRequestLine

    구성요소: method, path, protocol

    method: GET
    path: /testpage/testoption/
    protocol: HTTP/1.1

     

    HttpHeaders

    Name: Value
    Name과 Value의 짝 형태로 구성되어 있다.

     

    Accept : Client가 받을 수 있는 Contents
    Cookie : Cookie(쿠키);
    Content-Type : 메세지 바디 종류
    Content-Length : 메세지 바디 길이

     

    HttpResponseEx

    Status Line

    HTTP/1.x 200 OK

    HTTP Headers

    Transfer-Encoding: chunked
    Date: Sat, 28 Nov 2029 04:36:27 GMT
    Server: LiteSpeed
    Connection: close
    X-Powered-By: W3 Total Cache/0.8
    Pragma: public
    Expires: Sat, 28 Nov 2029 05:36:27 GMT
    Etag: "pub1259380237;gz"
    Cache-Control: max-age=3600, public
    Content-Type: text/html; charset=UTF-8
    Last-Modified: Sat, 28 Nov 2029 03:50:37 GMT
    X-Pingback: https://testx1234.testserver.com
    Content-Encoding: gzip
    Vary: Accept-Encoding, Cookie, User-Agent

    content

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title> my title </title>
    <!-- ... rest of the html ... -->

     

     

    HttpResponseState

     

    ResultCode

    1xx : 정보


    2xx : 성공
    200 : OK. 요청 성공
    201 : Created. 생성 요청 성공
    202 : Accepted. 요청 수락(처리 보장X)
    204 : 성공했으나 돌려줄게 없음

    3xx : redirection
    300 : Multiple choices. 여러 리소스에 대한 요청 결과 목록
    301,302,303 : Redirect. 리소스 위치가 변경된 상태
    304 : Not Modified. 리소스가 수정되지 않았음

    4xx : client 오류
    400 : Bad Request. 요청 오류
    401 : Unauthorized. 권한없음
    403 : Forbidden. 요청 거부
    404 : Not Found. 리소스가 없는 상태

    5xx : server 오류
    500 : Internal Server Error. 서버가 요청을 처리 못함
    501 : Not Implemented. 서버가 지원하지 않는 요청
    503 : Service Unavailable. 과부하 등으로 당장 서비스가 불가능한 상태



    HttpResponseHeader

    기본적으로 위의 HttpHeader와 같다

     

    Content-Type

    2020.07.13 - HTTP Content-type header values

    ( multipart/form-data (multipart form-data) boundary, text/plain, text/html, application/xml, application/json, image/png, image/jpg, audio/mp3, video/mp4 )

     

    'WebService' 카테고리의 다른 글

    Template Engine  (0) 2022.09.25
    Http Keep Alive  (0) 2022.09.23
    'Node Js' vs Python  (0) 2022.08.18
    Token(토큰)  (0) 2022.08.17
    multipart form-data 와 boundary  (0) 2022.08.08
    Firebase을 사용한 제품  (0) 2022.05.02
    HttpHeader Cookie(쿠키)  (0) 2021.10.26
    웹서버 개발  (0) 2021.06.26

    댓글