HTTP

proxy vs. gateway

HTTP-Proxy

  • Sicherheit, da kein IP-Routing
  • Filter (whitelist, blacklist)
  • Cache
  • Agiert auf Applikationsebene

Gateway

  • Agiert auf Applikationsebene
  • Vermittelt zwischen unterschiedlichen Protokollen
  • Bsp.: SMTP/QuickMail, SIP/PSTN

url vs. urn

SEE rfc3305

Unterst├╝tzte Methoden

c1audio@ace1:/proc$ telnet amazon.com 80
Trying 72.21.214.128…
Connected to amazon.com.
Escape character is ‘^]’.
OPTIONS * / HTTP /1.1

HTTP/1.1 200 OK
Date: Thu, 12 Apr 2012 17:27:44 GMT
Server: Server
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 0
Connection: close
Content-Type: text/plain

Connection closed by foreign host.

Persistent connections / Option keep-alive

c1audio@ace1:/proc$ telnet students.vmk.zhdk.ch 80
Trying 195.176.254.159…
Connected to students.vmk.zhdk.ch.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: students.vmk.zhdk.ch
Connection: keep-alive

HTTP/1.1 200 OK
Date: Thu, 12 Apr 2012 17:10:26 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
Last-Modified: Mon, 17 Sep 2007 08:26:04 GMT
ETag: “1574825-155-43a508e2dbf00”
Accept-Ranges: bytes
Content-Length: 341
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html><head><title>ZHdK, Vertiefung Neue Medien</title>
<meta http-equiv=”Content-type” content=”text/html; charset=ISO-8859-1″>
</head>

<body>
Das hier ist students.vnm.zhdk.ch, der eigene Webserver der VNM-Studierenden.
</body></html>

GET / HTTP/1.1
Host: amtfueraufschwung.ch

HTTP/1.1 301 Moved Permanently
Date: Thu, 12 Apr 2012 17:10:34 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
X-Powered-By: PHP/5.2.6-1+lenny13
X-Pingback: http://www.amtfueraufschwung.ch/xmlrpc.php
Location: http://www.amtfueraufschwung.ch/
Content-Length: 0
Content-Type: text/html; charset=UTF-8

GET / HTTP/1.1
Host: www.amtfueraufschwung.ch

HTTP/1.1 200 OK
Date: Thu, 12 Apr 2012 17:11:03 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
X-Powered-By: PHP/5.2.6-1+lenny13
X-Pingback: http://www.amtfueraufschwung.ch/xmlrpc.php
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

20e1
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” dir=”ltr” xml:lang=”de-DE”>

</html>
0

Connection closed by foreign host.

POST vs. PUT

PUT addressiert eine Resource.

POST addressiert einen Prozessor.

Host Header Feld

aryaman.org has address 195.176.254.159
aryaman.org mail is handled by 10 smtp.zhdk.ch.

c1audio@ace1:~$ host amtfueraufschwung.ch
amtfueraufschwung.ch has address 195.176.254.159
amtfueraufschwung.ch mail is handled by 10 smtp.zhdk.ch.
c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: aryaman.org

HTTP/1.1 301 Moved Permanently
Date: Thu, 03 May 2012 12:02:39 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
X-Powered-By: PHP/5.2.6-1+lenny13
X-Pingback: http://students.vmk.zhdk.ch/~aryaman/xmlrpc.php
Location: http://www.aryaman.org/
Content-Length: 0
Content-Type: text/html; charset=UTF-8

Connection closed by foreign host.
c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: amtfueraufschwung.ch
HTTP/1.1 301 Moved Permanently
Date: Thu, 03 May 2012 12:03:16 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
X-Powered-By: PHP/5.2.6-1+lenny13
X-Pingback: http://www.amtfueraufschwung.ch/xmlrpc.php
Location: http://www.amtfueraufschwung.ch/
Content-Length: 0
Content-Type: text/html; charset=UTF-8

Connection closed by foreign host.

Request-URI

c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
GET /wp-admin HTTP/1.1
Host: amtfueraufschwung.ch
REQUEST-URI: abs_path

c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
GET http://aryaman.org/ HTTP/1.1
Host: amtfueraufschwung.ch
Request-URI: absoluteURI

HTTP/1.1 301 Moved Permanently
Date: Thu, 03 May 2012 12:41:08 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
X-Powered-By: PHP/5.2.6-1+lenny13
X-Pingback: http://students.vmk.zhdk.ch/~aryaman/xmlrpc.php
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified: Thu, 03 May 2012 12:41:45 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Location: http://amtfueraufschwung.chhttp/aryaman.org/
Content-Length: 0
Content-Type: text/html; charset=UTF-8

Connection closed by foreign host.

Trace / Ping

c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
TRACE * HTTP/1.1
Host: aryaman.org

HTTP/1.1 200 OK
Date: Thu, 03 May 2012 12:32:07 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
Transfer-Encoding: chunked
Content-Type: message/http

27
TRACE * HTTP/1.1
Host: aryaman.org
0

Case sensitivity

Jon Postel: Be liberal in what you accept, be conservaative in what you send.

Jon Postel. License: Photo by Irene Fertik, USC News Service. Copyright 1994, USC. Permission granted for free use and distribution, conditioned upon inclusion of the above attribution and copyright notice.

c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
GET / HTTP/1.1
hOST: aryaman.ch

Felder in falscher Gross-/Kleinschreibung werden ignoriert.

 

c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
GET / HTTP/1.1
HOSt: aryaman.org

HTTP/1.1 301 Moved Permanently
Date: Thu, 03 May 2012 12:43:44 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
X-Powered-By: PHP/5.2.6-1+lenny13
X-Pingback: http://students.vmk.zhdk.ch/~aryaman/xmlrpc.php
Location: http://www.aryaman.org/
Content-Length: 0
Content-Type: text/html; charset=UTF-8

Connection closed by foreign host.
c1audio@ace1:~$ telnet 195.176.254.159 80
Trying 195.176.254.159…
Connected to 195.176.254.159.
Escape character is ‘^]’.
get / HTTP/1.1
Host: aryaman.org

HTTP/1.1 403 Forbidden
Date: Thu, 03 May 2012 12:44:47 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
Content-Length: 347
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don’t have permission to access /
on this server.</p>
<hr>
<address>Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 Server at aryaman.org Port 80</address>
</body></html>
Connection closed by foreign host.

safe and idenpotent

safe methods have no side effect. After a request the system is in the same state: GET / HEAD / OPTIONS / TRACE

Multiple identical idempotent requests should have the same effect as a sinngle request. f(f(x)) = f(x)

Caching

c1audio@ace1:~$ telnet zahw.ch 80
Trying 188.40.130.135…
Connected to zahw.ch.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: zahw.ch

HTTP/1.1 200 OK
Date: Thu, 03 May 2012 14:53:19 GMT
Server: Apache/2.2.16 (Debian)
Last-Modified: Tue, 27 Oct 2009 17:52:43 GMT
ETag: “1c009-2d-476ee585370c0”
Accept-Ranges: bytes
Content-Length: 45
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8

<html><body><h1>It works!</h1></body></html>

Connection closed by foreign host.c1audio@ace1:~$ telnet zahw.ch 80

Trying 188.40.130.135…
Connected to zahw.ch.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: zahw.ch
If-Modified-Since: Tue, 27 Oct 2009 17:52:43 GMT

HTTP/1.1 304 Not Modified
Date: Thu, 03 May 2012 14:54:48 GMT
Server: Apache/2.2.16 (Debian)
ETag: “1c009-2d-476ee585370c0”
Vary: Accept-Encoding

Connection closed by foreign host.
c1audio@ace1:~$ telnet zahw.ch 80
Trying 188.40.130.135…
Connected to zahw.ch.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: zahw.ch
If-None-Match: 1c009-2d-476ee585370c0

HTTP/1.1 200 OK
Date: Thu, 03 May 2012 14:55:37 GMT
Server: Apache/2.2.16 (Debian)
Last-Modified: Tue, 27 Oct 2009 17:52:43 GMT
ETag: “1c009-2d-476ee585370c0”
Accept-Ranges: bytes
Content-Length: 45
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8

<html><body><h1>It works!</h1></body></html>
Connection closed by foreign host.
c1audio@ace1:~$ telnet zahw.ch 80
Trying 188.40.130.135…
Connected to zahw.ch.
Escape character is ‘^]’.
GET / HTTP/1.1
Host: zahw.ch
If-None-Match: “1c009-2d-476ee585370c0”

HTTP/1.1 304 Not Modified
Date: Thu, 03 May 2012 14:56:41 GMT
Server: Apache/2.2.16 (Debian)
ETag: “1c009-2d-476ee585370c0”
Vary: Accept-Encoding

Connection closed by foreign host.

 

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.