web engineering
play

Web Engineering HTTP-message = Request | Response generic-message = - PowerPoint PPT Presentation

Structure of HTTP Messages Web Engineering HTTP-message = Request | Response generic-message = start-line *message-header Prof. Dr. Dr. h.c. mult. Gerhard Krger, Albrecht Schmidt CRLF [ message-body ] Universitt Karlsruhe start-line =


  1. Structure of HTTP Messages Web Engineering HTTP-message = Request | Response generic-message = start-line *message-header Prof. Dr. Dr. h.c. mult. Gerhard Krüger, Albrecht Schmidt CRLF [ message-body ] Universität Karlsruhe start-line = Request-Line | Status-Line Fakultät für Informatik message-header = field-name ":" [ field-value ] CRLF Institut für Telematik Wintersemester 1999/2000 Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 1 Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 3 General Header Fields general-header = Cache-Control | Connection | Date Web Engineering | Pragma | Transfer-Encoding | Upgrade | Via Chapter 2: Foundation - Identifiers and Protocols (cont.) Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 2 Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 4

  2. Request Response Request = Request-Line Response = Status-Line *(general-header | request-header | entity-header ) CRLF *(general-header | response-header | entity-header ) CRLF [ message-body ] [ message-body ] Request-Line = Method SP Request-URI SP HTTP-Version CRLF Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF Method = "OPTIONS" 1xx: Informational - Request received, continuing process � | "GET" 2xx: Success - The action was successfully received, � understood,and accepted | "HEAD" 3xx: Redirection - Further action must be taken in order to � | "POST" complete the request | "PUT" 4xx: Client Error - The request contains bad syntax or cannot � | "DELETE" be fulfilled | "TRACE" 5xx: Server Error - The server failed to fulfill an apparently � | extension-method valid request Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 5 Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 7 Request Header Fields Response Status Codes (selection) Developers can Status-Code = "100" ; Continue | "101" ; Switching Protocols request-header = Accept define response | "200" ; OK | Accept-Charset | Accept-Encoding | Accept-Language codes. They | "201" ; Created | Authorization must fit within | "202" ; Accepted | "203" ; Non-Authoritative Information | From one of the | "204" ; No Content | Host classes and | "300" ; Multiple Choices | If-Modified-Since | If-Match | If-None-Match they are treated | "301" ; Moved Permanently | "400" ; Bad Request | If-Range | If-Unmodified-Since (if unknown) as | "401" ; Unauthorized | Max-Forwards X00 | "402" ; Payment Required | Proxy-Authorization | "403" ; Forbidden | "404" ; Not Found | Range | "405" ; Method Not Allowed | Referer | "500" ; Internal Server Error | User-Agent | "501" ; Not Implemented Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 6 Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 8

  3. Response Header Felder HTTP/1.1, Request Methods I � GET response-header = Age � to requests a resource | Location | Proxy-Authenticate � HEAD | Public � to request the header of a resource | Retry-After � POST | Server | Vary � to submit a resource (e.g. parameters) | Warning � DELETE, PUT | WWW-Authenticate � file manipulation functions, similar to FTP � OPTIONS � to request information about the server and intermediary programs � TRACE � to request information about the route Prof. Dr. Dr. h.c. mult. GerhardKrüger, Albrecht Schmidt: Web Engineering, WS00/01 page 9 Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 11 Entity Header Fields HTTP/1.1, Request Methods II entity-header = Allow � safe methods = | Content-Base calls of these methods don‘t change data on the server = | Content-Encoding these methods do not have any side-effects | Content-Language � HEAD | Content-Length � GET (should be implemented this way!) | Content-Location | Content-MD5 Content-MD5 � idempotente Methods = | Content-Range a single call of these method has the same effect as Is not a security feature, it | Content-Type multiple calls to of these methods = | Etag is only a mechanism to side-effects of N > 0 identical requests is the same as for a | Expires track accidental change of single request. | Last-Modified the message body – � HEAD | extension-header because if the body can � PUT � DELETE be altered also the � GET (should be implemented this way!) Content-MD5 could be changed. Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 10 Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 12

  4. Conditional GET HTTP/1.1, GET Request � Syntax: � Syntax: GET <URI> <VERSION> GET <URI> <VERSION> <CONDITIONAL-HEADER>: <DATE> � Request resource named by the URI z.B. If-Modified-Since, If-Match, If-Range, etc. � static resource � dynamic resource � Example: � providing parameters GET http://www.apache.org/index.html HTTP/1.1 Host: www.apache.org � conditional GET If-Modified-Since: Fri, 29 Oct 1999 13:53:40 GMT � get the resource only under a certain condition � may reduce network traffic HTTP/1.0 304 Not Modified � partial GET Date: Thu, 28 Oct 1999 13:55:13 GMT Content-Type: text/html � Get only a certain part of the resource Expires: Fri, 29 Oct 1999 13:55:13 GMT � may reduce network traffic Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 13 Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 15 HTTP/1.1, GET Example Partial GET � Syntax: GET /index.html HTTP/1.1 GET <URI> <VERSION> Accept: */* Range: <RANGE> Accept-Language: en-us z.B. bytes=0-499 get the first 500 bytes of the resource Accept-Encoding: gzip, deflate bytes=-100 get the last 100 bytes of the resource User-Agent: Mozilla/4.0 (compatible; MSIE5.0; Windows NT) bytes=1500- get the resource starting from byte 1500 Host: www.teco.edu Connection: Keep-Alive � Beispiel: GET /Default. htm HTTP/1.1 HTTP/1.1 200 OK Host: www.microsoft.com Range: bytes=0-80 Date: Wed, 27 Oct 1999 14:13:43 GMT Server: Apache/1.2.1 Keep-Alive: timeout=10, max=100 HTTP/1.1 206 Partial content Connection: Keep-Alive Server: Microsoft-IIS/4.0 Transfer-Encoding: chunked Date: Thu, 28 Oct 1999 14:21:00 GMT Content-Type: text/html Content-Type: text/html Content-Length: 81 Content-Range: bytes 0 -80/19618 f78 <html><head> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso88 <title>Telecooperation Office (TecO)</title> ... Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 14 Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 16

  5. HTTP/1.1, HEAD Example II HTTP/1.1, HEAD Request GET / HTTP/1.0 Host: www.sun.com � Syntax: HEAD <URI> <VERSION> Accept: */* Accept-Language: en-us � request the header information of a resource User-Agent: Mozilla/4.0 (compatible; MSIE5.0; Windows NT) name by the URI HTTP/1.1 200 OK � serves the same header information as a GET Server: Netscape-Enterprise/3.6 request of the same resource Date: Fri, 03 Nov 2000 06:10:24 GMT Set-cookie: sessionid=TVOS0UYAAC00XAMTA1LU5YQ;path=/ � request of meta information Content-type: text/html Content-length: 13657 � used for Connection: close � checking links <!DOCTYPE HTML .... � checking whether or not it is required to transmit the <HTML... ... resource (e.g. compare time stamp or size) � may reduce network traffic GET serves the same headers as before HEAD Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 17 Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 19 HTTP/1.1, HEAD Example I HTTP/1.1, POST Request HEAD / HTTP/1.0 � Syntax: Host: www.sun.com POST <URI> <VERSION> Accept: */* Accept-Language: en-us <HEADER> User-Agent: Mozilla/4.0 (compatible; MSIE5.0; Windows NT) <CRLF> HTTP/1.1 200 OK <MESSAGE-BODY> Server: Netscape-Enterprise/3.6 Date: Fri, 03 Nov 2000 06:10:24 GMT Set-cookie: sessionid=TVOS0UYAAC00XAMTA1LU5YQ;path=/ � Supply data to a resource named in the URI Content-type: text/html Content-length: 13657 (see chapter on programming) Connection: close � return codes: � 200 OK � 204 No Content � 201 Created (location header) Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 18 Prof. Dr. Dr. h.c. mult. Gerhard Krüger , Albrecht Schmidt: Web Engineering, WS00/01 page 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend