Date post: | 27-Dec-2015 |
Category: |
Documents |
Upload: | barbara-mccarthy |
View: | 214 times |
Download: | 0 times |
1HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
Chapter 24
HypertextTransfer Protocol
(HTTP)
2HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
CONTENTSCONTENTS
• HTTP TRANSACTION• REQUEST MESSAGE• RESPONSE MESSAGE• HEADER• EXAMPLES• SOME OTHER FEATURES
3HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
HTTP uses the services of HTTP uses the services of TCP on well-known port 80.TCP on well-known port 80.
4HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
HTTPTRANSACTION
24.124.1
5HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
24.1 HTTP 24.1 HTTP 트랜잭션트랜잭션
HTTP 트랜잭션
6HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.1 HTTP 4.1 HTTP 트랜잭션트랜잭션
메시지 종류Request : 요청 메시지 (C S)Response : 응답 메시지 (S C)
7HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
24.224.2
REQUESTMESSAGE
8HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.2 4.2 요청 메시지요청 메시지
9HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.2 4.2 요청 메시지요청 메시지
요청 라인요청종류 : 메소드 (GET,HEAD,POST…)
자원 (URL) : 프로토콜 (FTP,HTTP,TELNET…)HTTP 버전 : HTTP 1.1(1.0,0.9 도 사용함 )
10HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.2 4.2 요청 메시지요청 메시지
URL
11HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.2 4.2 요청 메시지요청 메시지
메소드클라이언트가 서버에게 발행하는 실제 명령 or 요청메소드 종류
GET 클라이언트가 서버로부터 문자를 읽을 때 문서검색 , 응답 메시지의 본문에 문서내용 포함
HEAD 클라이언트가 문서에 대한 정보를 원할 때 응답에 본문이 없음 (GET 과의 차이 )
POST 클라이언트가 서버에게 정보를 제공시 사용 예 ) 서버에게 입력을 보낼때 사용
12HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.2 4.2 요청 메시지요청 메시지 PUT
서버에 저장될 새 문서 or 교체문서를 제공시 사용 요청된 문서에 포함 , URL 이 지정한 위치에 저장
PATCH
기존 파일의 변경사항 목록만을 포함
COPY
파일을 다른 위치로 복사시 사용
원본 파일 위치는 요청라인 (URL), 목적지 위치는 헤더에서 주어짐
MOVE
파일 이동시 사용 원본 파일 위치는 요청라인 (URL), 목적지 위치는 헤더에서
13HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.2 4.2 요청 메시지요청 메시지
DELETE
서버에서 문서 제거시 사용
LINK
다른 위치로의 링크나 링크 생성시 사용
원본 파일 위치는 요청라인 , 목적지 위치는 헤더에서
주어짐
UNLINK
LINK 에 의해 생성된 링크 삭제시 사용
OPTION
클라이언트가 서버에게 사용 가능한 옵션 질의시 사용
14HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
RESPONSEMESSAGE
24.324.3
15HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.3 4.3 응답 메시지응답 메시지
16HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.3 4.3 응답 메시지응답 메시지
상태라인응답 메시지의 상태 정의구성요소 : HTTP 버전 , 공백 , 상태코드 , 공백
상태문구
Status code: Same format as FTP responses (three digits)
17HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.3 4.3 응답 메시지응답 메시지
HTTP 버전 : HTTP 1.1(1.0, 0.9 도 사용함 )
상태 코드
There is no content in the bodyNo content204
The request is accepted, but it is not immediately acted upon
Accepted202
A new URL is createdCreated201
The request is successfulOK200
Success
The server is complying with a client request to switch protocols defined in the upgrade header
Switching101
The initial part of the request has been received and the client may continue with is request
Continue100
Informational
DescriptionPhraseCode
18HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.3 4.3 응답 메시지응답 메시지
The format requested is not acceptableNot acceptable406
The method is not supported in this URLMethod not allowed405
Server Error
There is an error, such as a crash, in the server siteInternal server error500
The requested URL is no longer used by the serverMoved permanently302
The request lacks proper authorizationUnauthorized401
Service is deniedForbidden403
The service is temporarily unavailable, but may be requested in the future
Service unavailable503
The action requested act not be performedNot implement501
The document is not foundNot found404
There is a syntax error in the requestBad request400
Client Error
The requested URL has moved temporarilyMoved temporarily304
The requested URL refers to more than one resourceMultiple choices301
Redirection
DescriptionPhraseCode
19HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
HEADER
24.424.4
20HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더
헤더
역할
클라이언트와 서버 사이의 추가적인 정보 교환
형식
헤더이름 , 콜론 , 공백 , 헤더 값
21HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더
헤더라인
일반헤더 (General headers)
요청헤더 (Request headers)
응답헤더 (Response headers)
항목헤더 (Entity headers)
요청 메시지 : 일반 , 요청 , 항목헤더만 포함
응답 메시지 : 일반 , 응답 , 항목헤더만 포함
22HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더
헤더
23HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더
일반헤더 (General headers)
메시지에 대한 일반적인 정보 제공
요청과 응답 메시지에 존재
Specifies the preferred communication protocol Upgrade
Shows the MIME version used MIME-version
Shows the current date Date
Shows whether the connection should be closed or not Connection
Specifies information about caching Cache-control
Header Description
24HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더요청헤더 (Request headers)
클라이언트의 구성과 선호하는 문서 형식을 지정
Shows the host and port number of the client
Specifies the URL of the linked documentReferrer
Send only the portion of the document that is missingIf-range
Send the document if not changed since specified dateIf-unmodified-since
Identifies the client programUser-agent
Send the document only if it dose not matching given tagIf-non-match
Send the document only if it matches given tagIf-match
Send the document if newer than specified dateIf-modified-since
Host
Shows the e-mail address of the userFrom
Shows what permissions the client hasAuthorization
Shows the language the client can acceptAccept-language
Shows the encoding scheme the client can handleAccept-encoding
Shows the character set the client can handleAccept-charset
Shows the media format the client can acceptAccept
Description Header
25HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더
응답헤더 (Response headers)
서버의 구성과 요청에 대한 특별한 정보를 지정
응답 메시지에만 존재
Shows the server name and version number Server
Specifies the date after which the server is available Retry-after
Shows the supported list of methods Public
Shows the age of the document Age
Shows if server accepts the range requested by client Accept-range
Header Description
26HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.4 4.4 헤더헤더항목헤더 (Entity headers)
문서의 본문에 대한 정보 제공 대부분 응답 메시지에 존재 , 일부 요청 메시지에도 존재
Specifies the location of the created or moved documentLocation
Gives the date and time of the last changeLast-modified
Gives the date and time when contents may changeExpires
Gives an entity tagEtag
Specifies the media typeContent-type
Specifies the range of the documentContent-range
Shows the length of the documentContent-length
Specifies the languageContent-language
Specifies the encoding schemeContent-encoding
List valid method that can be used with a URLAllow
DescriptionHeader
27HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
EXAMPLES
24.524.5
28HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.5 4.5 예제예제
Example 1Example 1
This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1.
29HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.5 4.5 예제예제 예제 1
30HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.5 4.5 예제예제
Example 2Example 2
This example retrieves information about a document. We use the HEAD method to retrieve information about an HTML document (see Chapter 25)
31HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.5 4.5 예제예제 예제 2
32HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.5 4.5 예제예제
Example 3Example 3
In this example, the client wants to send input data to the server. We use the POST method.
33HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.5 4.5 예제예제 예제 3
34HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
SOME OTHER FEATURES
24.624.6
35HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.6 4.6 몇 가지 다른 특징들몇 가지 다른 특징들
HTTP version 1.1 HTTP version 1.1 specifies a persistent specifies a persistent connection by default.connection by default.
36HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr
224.6 4.6 몇 가지 다른 특징들몇 가지 다른 특징들 Persistent Connection
서버는 응답을 전송한 후에 차후의 요청을 위해 연결을 열어놓은 상태 유지
클라이언트 요청이나 timeout 인 경우 닫을 수 있다 .
Proxy Server최신 요청에 대한 응답들의 복사물을 가지고 있는
컴퓨터 (cache)