일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 2579
- 자바
- 11562
- 알고리즘
- 프로그래머스
- 단어변환
- 7699
- toCharArray()
- SWEA
- django
- 10580번
- 진수 int형으로
- 타겟넘버
- 특정인덱스바꾸기
- 타도
- 백양로브레이크
- git
- 프로젝트
- 백준
- startswith
- 시작
- 전화번호목록
- 객체정렬
- Java
- SSAFY
- 완주하지못한선수
- 그래프adt
- K번째수
- 명령어
- 스타일리쉬들여쓰기
- Today
- Total
합리적 낙관주의자
Http Request, Response 란? 본문
Http (HyperText Transfer Protocol)
Http Request, Http Response 는 Client, Server 가 데이터를 주고 받는 기본적인 통신 방식으로,
Client가 Server에 Request를 보내면, Server는 Client에 Response를 보내준다. 이 때 Request, Response 둘 다 특정한 포맷으로 해당되는 데이터를 갖고 있으며, 아스키로 인코딩된 텍스트 이다.
1. Http Request Format
1-1. 요청 라인 (Request Line)
Http Method URI Http version (ex. GET / HTTP/1.1)
1-2. 요청 헤더 (Request Header)
클라이언트와 요청에 대한 추가 정보를 담고 있으며, 각 Header는 Key: Value 형식
1-3. 빈 줄 (An Empty Line)
Header와 Body를 구분하기 위한 공백(CRLF)
1-4. 본문 (Optional Message Body)
요청 라인의 Method가 POST, PUT 에서 사용되며, 서버에 전송할 데이터
GET / HTTP/1.1
Host: www.a.com:8000
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7
2. Http Response Format
2-1. 상태 라인 (Response Line)
the HTTP version, a status code, and description of the status 로 구성 (ex. HTTP/1.0 200 OK)
2-2. 응답 헤더 (Response Hedaer)
응답에 대한 추가 정보를 담고 있으며, Request와 마찬가지로 Key: Value 형식으로 관리
2-3. 빈 줄 (An Empty Line)
Header와 Body를 구분하기 위한 공백(CRLF)
2-4. 메세지 본문 (Message Body)
성공 시, 실제로 Client가 요청한 Data/ 실패 시, 에러 이유에 대한 Data
(If the client's request is successful, the requested data is sent. This data may be a copy of a file, or the response from a CGI program. If the client's request could not be fulfilled, the data may be a human-readable explanation of why the server couldn't fulfill the request.)
HTTP/1.0 200 OK
Date: Wed Apr 23 17:31:47 KST 2025
Server: JHTTP 2.0
Content-length: 1440
Content-type: text/html
이미지 및 참고 출처: https://www.oreilly.com/openbook/webclient/ch03.html
'이상이 아닌 현실 💼 > Web 💻' 카테고리의 다른 글
프로그래머스 과제 테스트: API 서버 개발 (0) | 2025.05.16 |
---|---|
csv 파일을 엑셀 파일로 변환하기 (0) | 2025.04.17 |
[Error] VScode에서 java.lang.noclassdeffounderror 에러 (0) | 2020.11.10 |
[Error] Custom elements in iteration require 'v-bind:key' directives.eslint-plugin-vue (0) | 2020.10.22 |
[Backend] VScode에서 MySQL 연동 (0) | 2020.10.22 |