• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
About Http Connection
 

About Http Connection

on

  • 2,256 views

 

Statistics

Views

Total Views
2,256
Views on SlideShare
2,256
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    About Http Connection About Http Connection Presentation Transcript

    • HTTP  Jussi  Pohjolainen  
    • 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  …)  
    • 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>
    • 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
    • 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  
    • 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:      
    • 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  
    • 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>
    • 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
    • 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".