1 / 14

Introdução Protocolo orientado à mensagem (paradigma Pedido/Resposta) Utiliza o protocolo TCP

Introdução Protocolo orientado à mensagem (paradigma Pedido/Resposta) Utiliza o protocolo TCP Porto 80 (por omissão) Principal Protocolo utilizado na WEB Prevê o uso de Proxys HTTP 0.9 HTTP 1.0 ( http://www.fe.up.pt/~jvv/net/rfc1945.txt )

andie
Download Presentation

Introdução Protocolo orientado à mensagem (paradigma Pedido/Resposta) Utiliza o protocolo TCP

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. Introdução Protocolo orientado à mensagem (paradigma Pedido/Resposta) Utiliza o protocolo TCP Porto 80 (por omissão) Principal Protocolo utilizado na WEB Prevê o uso de Proxys HTTP 0.9 HTTP 1.0 (http://www.fe.up.pt/~jvv/net/rfc1945.txt) HTTP 1.1 (http://www.fe.up.pt/~jvv/net/rfc2068.txt) Isidro Vila Verde (jvv@fe.up.pt)

  2. HTTP 0.9 Formato das Mensagens HTTP-message = Simple-Request | Simple-Response Pedidos Simple-Request = “GET” SP Request-URI CRLF Request-URI = absoluteURI | abs_path absoluteURI = scheme ":" *( uchar | reserved ) abs_path = "/" rel_path Respostas Simple-Response = [Entity-Body] Entity-Body = *OCTET Exemplo Establecimento da ligação ao servidor Telnet alf.fe.up.pt 80 Pedido GET /lixo.tmp Resposta <HTML><HEAD> <TITLE>404 File Not Found</TITLE> </HEAD><BODY> <H1>File Not Found</H1> The requested URL /lixo.tmp was not found on this server.<P> </BODY></HTML> Nota: O formato Absolute-URI só é usado com proxys Isidro Vila Verde (jvv@fe.up.pt)

  3. HTTP 1.0 Formato das Mensagens HTTP-message = Simple-Request | Simple-Response | Full-Request | Full -Response Pedidos Full-Request = Request-Line *( General-Header | Request-Header | Entity-Header ) CRLF [ Entity-Body ] Request-Line = Method SP Request-URI SP HTTP-Version CRLF Method = "GET” | "HEAD” | "POST” | extension-method Respostas Full-Response = Status-Line *( General-Header | Response-Header | Entity-Header ) CRLF [ Entity-Body ] Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF Status-Code = "200" ; OK | "400" ; Bad Request | "404" ; Not Found Isidro Vila Verde (jvv@fe.up.pt)

  4. HTTP 1.0 Exemplo 1 (acesso directo) Establecimento da ligação directa ao servidor Telnet www.inescn.pt 80 Pedido GET /index.html HTTP/1.0 Resposta HTTP/1.0 200 Document follows Date: Fri, 03 Apr 1998 15:13:48 GMT Server: NCSA/1.5 Content-type: text/html <HTML> … </BODY> </HTML> Isidro Vila Verde (jvv@fe.up.pt)

  5. HTTP 1.0 Exemplo 2 (acesso via proxy) Establecimento da ligação ao proxy Telnet alf.fe.up.pt 8080 Pedido GET http://www.inescn.pt/index.html HTTP/1.0 Resposta HTTP/1.0 200 Document follows Date: Fri, 03 Apr 1998 15:34:07 GMT Server: NCSA/1.5 Content-type: text/html <HTML> … </HTML> Isidro Vila Verde (jvv@fe.up.pt)

  6. HTTP 1.1 Formato das Mensagens HTTP-message = Request | Response Pedidos Request = Request-Line *( General-Header | Request-Header | Entity-Header ) CRLF [ message-body ] Request-Line = Method SP Request-URI SP HTTP-Version CRLF Method = "GET” | ”OPTIONS” | ”TRACE” | "HEAD” | ”DELETE” | ”PUT” | "POST” | extension-method Request-URI = “*” | absoluteURI | abs_path Respostas Response = Status-Line *( General-Header | Response-Header | Entity-Header ) CRLF [ Entity-Body ] Isidro Vila Verde (jvv@fe.up.pt)

  7. HTTP 1.1 Alguns Headers Host Request-Header (obrigatório) Especifica o Host e o Porto Sintaxe: “Host” “:” host [“:” port] Exemplo: Host: www.fe.up.pt Content-Length Entity-Header Indica em decimal o tamanho em bytes do Entity-body Sintaxe: Content-Length = "Content-Length" ":" 1*DIGIT Exemplo: Content-Length: 1024 Content-type Entity-Header Define os tipo de mensagem Sintaxe: Content-Type = "Content-Type" ":" media-type Exemplo: Content-Type: image/gif If-Modified-Since Request-Header Usado com o método GET O documento só é transferido se tiver sido alterado depois da data especificada Em caso negativo é retornado o código 304 (not modified) Sintaxe: If-Modified-Since = "If-Modified-Since" ":" HTTP-date Exemplo: If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT Isidro Vila Verde (jvv@fe.up.pt)

  8. HTTP 1.1 Alguns Headers (cont…) Location Response-Header Usado para redirecionar os clientes para a nova localização do documento Sintaxe: Location = "Location" ":" absoluteURI Exemplo: Location: http://www.fe.up.pt/~jvv/net/rfc2068.txt Exemplos Exemplo 1 (Header Host) Establecimento da ligação Telnet www.fe.up.pt 80 Pedido GET / HTTP/1.1 Host: www.fe.up.pt Resposta HTTP/1.1 200 OK Date: Thu, 23 Apr 1998 09:49:52 GMT Server: Apache/1.2.1 Last-Modified: Sun, 29 Mar 1998 18:04:41 GMT ETag: "8-992-351e8d39" Content-Length: 2450 Accept-Ranges: bytes Content-Type: text/html <html> …. </html> Isidro Vila Verde (jvv@fe.up.pt)

  9. HTTP 1.1 Exemplos (cont…) Exemplo 2 (Método OPTIONS) Establecimento da ligação Telnet www.fe.up.pt 80 Pedido OPTIONS * HTTP/1.1 Host:www.fe.up.pt Resposta HTTP/1.1 200 OK Date: Thu, 23 Apr 1998 10:28:26 GMT Server: Apache/1.2.1 Content-Length: 0 Allow: GET, HEAD, OPTIONS, TRACE Isidro Vila Verde (jvv@fe.up.pt)

  10. HTTP 1.1 Exemplos (cont…) Exemplo 3 (Método TRACE) Establecimento da ligação Telnet alf.fe.up.pt 8080 Pedido TRACE http://www.napri.sk/ HTTP/1.1 Host: www.napri.sk Resposta HTTP/1.1 200 OK Date: Thu, 23 Apr 1998 12:56:11 GMT Server: Apache/1.2.3 Connection: close Content-Type: message/http TRACE / HTTP/1.0 Host: www.napri.sk Cache-control: Max-age=259200 Via: 1.1 www.fe.up.pt:8080 (Squid/1.1.8), 1.0 www.up.pt:8080 (Squid/1.1.10), 1.0 proxy.porto.rccn.net:3128 (Squid/1.1.10) X-Forwarded-For: 193.136.28.15, 193.136.28.15, 193.136.51.8 Isidro Vila Verde (jvv@fe.up.pt)

  11. HTTP 1.1 Exemplos (cont…) Exemplo 4 (Header If-Modified-Since) Establecimento da ligação Telnet www.fe.up.pt 80 Pedido GET / HTTP/1.1 Host: www.fe.up.pt If-Modified-Since: Sun, 29 Mar 1998 00:00:00 GMT Resposta HTTP/1.1 200 OK Date: Thu, 23 Apr 1998 09:55:21 GMT Server: Apache/1.2.1 Last-Modified: Sun, 29 Mar 1998 18:04:41 GMT ETag: "8-992-351e8d39" Content-Length: 2450 Accept-Ranges: bytes Content-Type: text/html <html> …. </html> Isidro Vila Verde (jvv@fe.up.pt)

  12. HTTP 1.1 Exemplos (cont…) Exemplo 5 (Header If-Modified-Since) Establecimento da ligação Telnet www.fe.up.pt 80 Pedido GET / HTTP/1.1 Host: www.fe.up.pt If-Modified-Since: Sun, 29 Mar 1998 20:00:00 GMT Resposta HTTP/1.1 304 Not Modified Date: Thu, 23 Apr 1998 09:59:33 GMT Server: Apache/1.2.1 ETag: "8-992-351e8d39" Isidro Vila Verde (jvv@fe.up.pt)

  13. HTTP 1.1 Exemplos (cont…) Exemplo 6 (Header Location) Establecimento da ligação Telnet www.virgilio.it 80 Pedido GET / HTTP/1.1 Host:www.virgilio.it Resposta HTTP/1.1 302 Moved Temporarily Server: Netscape-Enterprise/3.0F Date: Thu, 23 Apr 1998 12:51:29 GMT Location: http://www.virgilio.it/home/index.html Connection: close Isidro Vila Verde (jvv@fe.up.pt)

  14. Exemplo 7 (pipelinig) Establecimento da ligação Telnet www.fe.up.pt 80 Pedido GET / HTTP/1.1 Host: www.fe.up.pt GET /feupwww/img/back2.jpg HTTP/1.1 Host: www.fe.up.pt Resposta HTTP/1.1 200 OK Date: Thu, 23 Apr 1998 10:10:56 GMT Server: Apache/1.2.1 Last-Modified: Sun, 29 Mar 1998 18:04:41 GMT ETag: "8-992-351e8d39" Content-Length: 2450 Accept-Ranges: bytes Content-Type: text/html <html>…</html> HTTP/1.1 200 OK Date: Thu, 23 Apr 1998 10:10:56 GMT Server: Apache/1.2.1 Last-Modified: Mon, 25 Nov 1996 17:29:04 GMT ETag: "5a09a-68b-3299d760" Content-Length: 1675 Accept-Ranges: bytes Content-Type: image/jpeg JFIF··4Photoshop 3.08BIMí¶áH¶áH8BIM8BIM' Isidro Vila Verde (jvv@fe.up.pt)

More Related