1 / 24

Understanding HTTP Transactions and Messages

Learn about HTTP transactions, request and response messages, headers, and examples. Discover different HTTP methods and status codes.

Télécharger la présentation

Understanding HTTP Transactions and Messages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 제 22 장 HTTP 22.1 HTTP 트랜잭션 22.2 요청 메시지 22.3 응답 메시지 22.4 헤더 22.5 예제 22.6 요약

  2. 2.1 HTTP 트랜잭션 • HTTP : 잘 알려진 포트 80으로 TCP 서비스

  3. 22.1 HTTP 트랜잭션 • 메시지 분류 • Request : 요청 메시지(C  S) • Response : 응답 메시지(S  C)

  4. 22.2 요청 메시지

  5. 22.2 요청 메시지 • 요청 라인 • 요청종류 : 메소드(GET,HEAD,POST…) • 자원(URL) : 프로토콜(FTP,HTTP,TELNET…) • HTTP 버전 : HTTP 1.1(1.0,0.9도 사용함)

  6. 22.2 요청 메시지

  7. 22.2 요청 메시지 • 메소드 • 클라이언트가 서버에게 발행하는 실제 명령 or 요청 • 메소드 종류 • GET • 클라이언트가 서버로부터 문자를 읽을 때 • 문서검색, 응답 메시지의 본문에 문서내용 포함 • HEAD • 클라이언트가 문서에 대한 정보를 원할 때 • 응답에 본문이 없음(GET과의 차이) • POST • 클라이언트가 서버에게 정보를 제공시 사용 • 예) 서버에게 입력을 보낼때 사용

  8. 22.2 요청 메시지 • PUT • 서버에 저장될 새 문서 or 교체문서를 제공시 사용 • 요청된 문서에 포함, URL이 지정한 위치에 저장 • PATCH • 기존 파일의 변경사항 목록만을 포함 • COPY • 파일을 다른 위치로 복사시 사용 • 원본 파일 위치는 요청라인(URL), 목적지 위치는 헤더에서 주어짐 • MOVE • 파일 이동시 사용 • 원본 파일 위치는 요청라인(URL), 목적지 위치는 헤더에서

  9. 22.2 요청 메시지 • DELETE • 서버에서 문서 제거시 사용 • LINK • 다른 위치로의 링크나 링크 생성시 사용 • 원본 파일 위치는 요청라인, 목적지 위치는 헤더에서 주어짐 • UNLINK • LINK에 의해 생성된 링크 삭제시 사용 • OPTION • 클라이언트가 서버에게 사용 가능한 옵션 질의시 사용

  10. 22.3 응답 메시지

  11. 22.3 응답 메시지 • 상태라인 • 응답 메시지의 상태 정의 • 구성요소 : HTTP 버전,공백,상태코드,공백 상태문구

  12. 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

  13. 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

  14. 22.4 헤더 • 헤더 • 역할 • 클라이언트와 서버 사이의 추가적인 정보 교환 • 형식 • 헤더이름, 콜론, 공백, 헤더 값

  15. 22.4 헤더 • 헤더라인 • 일반헤더(General headers) • 요청헤더(Request headers) • 응답헤더(Response headers) • 항목헤더(Entity headers) • 요청 메시지 : 일반, 요청, 항목헤더만포함 • 응답 메시지 : 일반, 응답, 항목헤더만 포함

  16. 22.4 헤더 • 헤더

  17. Description 22.4 헤더 • 일반헤더(General headers) • 메시지에 대한 일반적인 정보 제공 • 요청과 응답 메시지에 존재 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

  18. 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 22.4 헤더 • 요청헤더(Request headers) • 클라이언트의 구성과 선호하는 문서 형식을 지정

  19. Description 22.4 헤더 • 응답헤더(Response headers) • 서버의 구성과 요청에 대한 특별한 정보를 지정 • 응답 메시지에만 존재 Header 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

  20. 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

  21. 22.5 예 제 • 예제 1 본문에 문서내용 포함(HEAD와의 차이)

  22. 22.5 예 제 • 예제 2

  23. 22.5 예 제 • 예제 3

  24. 22.6 요약

More Related