HTTP	  Jussi	  Pohjolainen	  
HTTP	  network	  protocol	  •  HTTP	  is	  a	  network	  protocol	  of	  the	  Web	  •  Hypertext	  Transfer	  Protocol	  ...
Structure	  of	  HTTP	  •  Consists	  of	  request	  and	  response	  •  Format	      –    an	  iniPal	  line,	      –    ...
IniPal	  Request	  Line	  •  IniPal	  line	  is	  different	  for	  the	  request	  than	     response.	  	  •  Request	  l...
IniPal	  Response	  Line	  •  The	  iniPal	  response	  line,	  called	  the	  status	  line	  •  Typical	  status	  lines...
Header	  Lines	  •  Header	  lines	  provide	  informaPon	  about	  the	  request	     and	  response	      –  Header-­‐na...
Message	  Body	  •  Message	  body	  contains	  the	  resource	  •  Usually	  the	  message	  body	  includes	  header	   ...
Sample	  Exchange	  KK605406LS-2:~ pohjus$ telnet www.jmarshall.com 80Trying 192.220.73.220...Connected to www.jmarshall.c...
POST	  Method	  POST /path/script.cgi HTTP/1.0From: myname@email.comUser-Agent: Some-toolContent-Type: application/x-www-f...
Exercise	  1.  Use	  telnet	  to	  make	  a	  connecPon	  to	  site,	  see	      response	  2.  Use	  some	  live	  hVp	  ...
Upcoming SlideShare
Loading in …5
×

About Http Connection

2,685
-1

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,685
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

About Http Connection

  1. 1. HTTP  Jussi  Pohjolainen  
  2. 2. HTTP  network  protocol  •  HTTP  is  a  network  protocol  of  the  Web  •  Hypertext  Transfer  Protocol   –  Delivers  resources  on  the  WWW   –  Usually  delivered  by  TCP/IP  •  HTTP  client  sends  a  request  to  HTTP  server   –  Default  port  is  80  •  Resource  can  be  a  file  or  dynamically   generated  query  result  (CGI,  PHP  …)  
  3. 3. Structure  of  HTTP  •  Consists  of  request  and  response  •  Format   –  an  iniPal  line,   –  zero  or  more  header  lines,   –  a  blank  line,   –  opPonal  message  body  (this  is  the  resource)  •  Example   –  <initial line, different for request and response> –  Header1: value1 –  Header2: value2 –  <optional message body>
  4. 4. IniPal  Request  Line  •  IniPal  line  is  different  for  the  request  than   response.    •  Request  line  has  three  parts   –  method  name,  local  path  to  resource,  version  of   hVp  •  Example   –  GET /path/to/file/index.html HTTP/1.0•  Method  name  can  be  GET,  POST  and  HEAD
  5. 5. IniPal  Response  Line  •  The  iniPal  response  line,  called  the  status  line  •  Typical  status  lines   –  HTTP/1.0  200  OK   –  HTTP/1.0  404  Not  Found  •  Status  code  (200,  404)  is  computer-­‐readable,  reason  phrase  is   human-­‐readable  •  Status  codes   –  1xx,  informaPon  message   –  2xx,  success   –  3xx,  redirect   –  4xx,  client  error   –  5xx,  server  error  •  See  all  status  codes   –  hVp://www.w3.org/Protocols/rfc2616/rfc2616-­‐sec10.html  
  6. 6. Header  Lines  •  Header  lines  provide  informaPon  about  the  request   and  response   –  Header-­‐name:  value  •  HTTP  1.0  provides  16  headers,  HTTP  1.1  46  headers  •  Client  should  tell  who  is  making  the  request   –  From:   –  User-­‐Agent:  •  Server  should  idenPfy   –  Server:   –  Last-­‐modified:      
  7. 7. Message  Body  •  Message  body  contains  the  resource  •  Usually  the  message  body  includes  header   lines   –  Content-­‐type:     •  MIME  type  of  the  resource,  for  example  text/html,   image/gif   –  Content-­‐length   •  bytes  
  8. 8. Sample  Exchange  KK605406LS-2:~ pohjus$ telnet www.jmarshall.com 80Trying 192.220.73.220...Connected to www.jmarshall.com.Escape character is ^].GET /index.html HTTP/1.0HTTP/1.1 200 OKDate: Mon, 18 Mar 2013 09:51:18 GMTServer: Apache/1.3.42 (Unix) mod_auth_tkt/2.1.0 FrontPage/5.0.2.2635 mod_ssl/2.8.31OpenSSL/0.9.8rLast-Modified: Mon, 04 Feb 2013 20:21:01 GMTETag: "1d697f5-9f3-5110182d"Accept-Ranges: bytesContent-Length: 2547Connection: closeContent-Type: text/html<html>
  9. 9. POST  Method  POST /path/script.cgi HTTP/1.0From: myname@email.comUser-Agent: Some-toolContent-Type: application/x-www-form-urlencodedContent-Length: 32name=jack&age=22
  10. 10. Exercise  1.  Use  telnet  to  make  a  connecPon  to  site,  see   response  2.  Use  some  live  hVp  extension  in  browser  to   see  hVp  informaPon  3.  Make  a  HTTP  GET  to   www.whaPsmybrowser.com.  Fake  your   "browser".  
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×