Http GET / POST 방식 요청

null·2022년 10월 3일
0

JAVA_Bitcamp

목록 보기
5/10

Http GET 방식 요청

  • Request Line:
    /app/auth/login?email=user1@test.com&password111&saveEmail=on Http/1.1

  • General header: 요청 / 읍답 모두 붙일 수 있는 헤더

cache-control: no- cache
connection: keep- alive
  • Request-header
Accept: text/html ~
Accept-Encoding: gzip, deflate, br
Host: localHost888 // 요청을 받는 서버 주소
User-Agent: Mozilla/5.0~ // 요청을 보내는 브라우저 정보
  • GET요청은 message-body가 없다

  • entity-header가 없다

  • URL에 데이터를 붙여 보낸다 : QueryString 형태로 데이터를 URL에 포함 보낸다

  • 장점
    - 콘텐트 조회 시 적절
    ex. 내가 보낸 유튜브 URL로 유튜브 메인페이지가 아닌 해당 콘텐츠 바로 접속 가능

  • 단점:
    - text만 가능 (binary 보내기 힘듬)
    - 주소창에 노출 (/login?email=user1@test.com&password111&...)
    - 웹 브라우저는 URL을 캐시에 저장 ( 보안 매우 취약)

Http POST 방식 요청

  • Request Line: /app/auth/login Http/1.1

  • General header: 요청 / 읍답 모두 붙일 수 있는 헤더

cache-control: no- cache
connection: keep- alive
  • Request-header
Accept: text/html ~
Accept-Encoding: gzip, deflate, br
Host: localHost888 // 요청을 받는 서버 주소
User-Agent: Mozilla/5.0~ // 요청을 보내는 브라우저 정보
  • entity-header : message-body로 보내는 데이터에 대한 정보 / POST요청 시 추가
Content-Length:
Content-Type:application/x-www-form-url
...
  • message-body
email=user1@test.com&password=1111&saveEmail=on
  • 장점
    - message-body영역에 붙여서 발생
    - 보내는 데이터의 크기에 제약 없어 binary 데이터를 보낼수 있음
    - URL에 데이터가 포함되지 않기 때문에 직접 노출되는 것 방지
    - 웹 브라우저가 캐시하지 않는다 (보안 유리)

0개의 댓글