슬라이드 제목 없음

Download Report

Transcript 슬라이드 제목 없음

제 22 장 HTTP
22.1 HTTP 트랜잭션
22.2 요청 메시지
22.3 응답 메시지
22.4 헤더
22.5 예제
22.6 요약
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
1
2.1 HTTP 트랜잭션
HTTP : 잘 알려진 포트 80으로 TCP 서비스
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
2
22.1 HTTP 트랜잭션
메시지 분류
Request : 요청 메시지(C  S)
Response : 응답 메시지(S  C)
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
3
22.2 요청 메시지
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
4
22.2 요청 메시지
요청 라인
요청종류 : 메소드(GET,HEAD,POST…)
자원(URL) : 프로토콜(FTP,HTTP,TELNET…)
HTTP 버전 : HTTP 1.1(1.0,0.9도 사용함)
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
5
22.2 요청 메시지
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
6
22.2 요청 메시지
메소드
클라이언트가 서버에게 발행하는 실제 명령 or 요청
메소드 종류
 GET
 클라이언트가 서버로부터 문자를 읽을 때
 문서검색, 응답 메시지의 본문에 문서내용 포함
 HEAD
 클라이언트가 문서에 대한 정보를 원할 때
 응답에 본문이 없음(GET과의 차이)
 POST
 클라이언트가 서버에게 정보를 제공시 사용
 예) 서버에게 입력을 보낼때 사용
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
7
22.2 요청 메시지
 PUT
 서버에 저장될 새 문서 or 교체문서를 제공시 사용
 요청된 문서에 포함, URL이 지정한 위치에 저장
 PATCH
 기존 파일의 변경사항 목록만을 포함
 COPY
 파일을 다른 위치로 복사시 사용
 원본 파일 위치는 요청라인(URL), 목적지 위치는 헤더에서
주어짐
 MOVE
 파일 이동시 사용
 원본 파일 위치는 요청라인(URL), 목적지 위치는 헤더에서
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
8
22.2 요청 메시지
 DELETE
 서버에서 문서 제거시 사용
 LINK
 다른 위치로의 링크나 링크 생성시 사용
 원본 파일 위치는 요청라인, 목적지 위치는 헤더에서 주어짐
 UNLINK
 LINK에 의해 생성된 링크 삭제시 사용
 OPTION
 클라이언트가 서버에게 사용 가능한 옵션 질의시 사용
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
9
22.3 응답 메시지
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
10
22.3 응답 메시지
상태라인
응답 메시지의 상태 정의
구성요소 : HTTP 버전,공백,상태코드,공백
상태문구
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
11
22.3 응답 메시지
 HTTP 버전 : HTTP 1.1(1.0, 0.9도 사용함)
 상태 코드
Code
Phrase
Description
Informational
100
Continue
The initial part of the request has been received and the
client may continue with is request
101
Switching
The server is complying with a client request to switch
protocols defined in the upgrade header
Success
200
OK
The request is successful
201
Created
A new URL is created
202
Accepted
The request is accepted, but it is not immediately acted
upon
204
No content
There is no content in the body
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
12
22.3 응답 메시지
Code
Phrase
Description
Redirection
301
Multiple choices
The requested URL refers to more than one resource
302
Moved permanently
The requested URL is no longer used by the server
304
Moved temporarily
The requested URL has moved temporarily
Client Error
400
Bad request
There is a syntax error in the request
401
Unauthorized
The request lacks proper authorization
403
Forbidden
Service is denied
404
Not found
The document is not found
405
Method not allowed
The method is not supported in this URL
406
Not acceptable
The format requested is not acceptable
Server Error
500
Internal server error
There is an error, such as a crash, in the server site
501
Not implement
The action requested act not be performed
503
Service unavailable
The service is temporarily unavailable, but may be
requested in the future
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
13
22.4 헤더
헤더
역할
 클라이언트와 서버 사이의 추가적인 정보 교환
형식
 헤더이름, 콜론, 공백, 헤더 값
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
14
22.4 헤더
헤더라인
 일반헤더(General headers)
 요청헤더(Request headers)
 응답헤더(Response headers)
 항목헤더(Entity headers)
요청 메시지 : 일반, 요청, 항목헤더만 포함
응답 메시지 : 일반, 응답, 항목헤더만 포함
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
15
22.4 헤더
헤더
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
16
22.4 헤더
일반헤더(General headers)
 메시지에 대한 일반적인 정보 제공
 요청과 응답 메시지에 존재
Description
Header
Cache-control
Specifies information about caching
Connection
Shows whether the connection should be closed or not
Date
Shows the current date
MIME-version
Shows the MIME version used
Upgrade
Specifies the preferred communication protocol
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
17
22.4 헤더
요청헤더(Request headers)
 클라이언트의 구성과 선호하는 문서 형식을 지정
Header
Description
Accept
Shows the media format the client can accept
Accept-charset
Shows the character set the client can handle
Accept-encoding
Shows the encoding scheme the client can handle
Accept-language
Shows the language the client can accept
Authorization
Shows what permissions the client has
From
Shows the e-mail address of the user
Host
Shows the host and port number of the client
If-modified-since
Send the document if newer than specified date
If-match
Send the document only if it matches given tag
If-non-match
Send the document only if it dose not matching given tag
If-range
Send only the portion of the document that is missing
If-unmodified-since
Send the document if not changed since specified date
Referrer
Specifies the URL of the linked document
User-agent
Identifies the client program
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
18
22.4 헤더
응답헤더(Response headers)
 서버의 구성과 요청에 대한 특별한 정보를 지정
 응답 메시지에만 존재
Header
Description
Accept-range
Shows if server accepts the range requested by client
Age
Shows the age of the document
Public
Shows the supported list of methods
Retry-after
Specifies the date after which the server is available
Server
Shows the server name and version number
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
19
22.4 헤더
항목헤더(Entity headers)
 문서의 본문에 대한 정보 제공
 대부분 응답 메시지에 존재, 일부 요청 메시지에도 존재
Header
Description
Allow
List valid method that can be used with a URL
Content-encoding
Specifies the encoding scheme
Content-language
Specifies the language
Content-length
Shows the length of the document
Content-range
Specifies the range of the document
Content-type
Specifies the media type
Etag
Gives an entity tag
Expires
Gives the date and time when contents may change
Last-modified
Gives the date and time of the last change
Location
Specifies the location of the created or moved document
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
20
22.5 예 제
예제 1
본문에 문서내용
포함(HEAD와의 차이)
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
21
22.5 예 제
예제 2
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
22
22.5 예 제
예제 3
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
23
22.6 요약
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
24