Hypertext Transfer Protocol (HTTP)


Einleitung


HTTP Konzepte

HTTP spezifiziert die Syntax und Semantik von Anfragen und Antworten.

Ablauf einer Anfrage

www.uni-mannheim.de, localhost

Telnet-Verbindung an den Port 80

$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
User-Agent: Heinz Kredel
Host: localhost
Accept: */*

Antwort des Web-Servers

HTTP/1.1 200 OK
Date: Sat, 07 Nov 1998 20:53:21 GMT
Server: Apache/1.2.4 S.u.S.E./5.1
Last-Modified: Thu, 21 May 1998 19:19:48 GMT
ETag: "21047-44c-35647e54"
Content-Length: 1100
Accept-Ranges: bytes
Connection: close
Content-Type: text/html

<HTML>
...
</HTML>
Connection closed by foreign host.

Die Schritte der Anfrage im Detail

  1. TCP/IP-Verbindung (z.B. telnet) an einen verabredeten Port (default 80)

    erste Zeile: method-Kommando mit Parametern

    GET / HTTP/1.0
    
    
  2. folgende Zeilen: Informationen des Browsers (UA) an den Server, abgeschlossen durch eine Leerzeile.

    User-Agent: Heinz Kredel
    Host: localhost
    Accept: */*
    
    
  3. Abhägig von method folgen weitere Informationen.

    bei POST z.B. die Daten des Formulars, oder auch eine Datei.

Allgemein:

Method-Line
General-Header(s)
Request-Header(s)
Entity-Header(s)
CRLF
Entity-Body

Die Schritte der Antwort des Servers

  1. erste Zeile: Statuszeile über Erfolg oder Fehler

    HTTP/1.1 200 OK
    
  2. folgende Zeilen: Header-Informationen des Servers, abgeschlossen durch eine Leerzeile.

    Date: Sat, 07 Nov 1998 20:53:21 GMT
    Server: Apache/1.2.4 S.u.S.E./5.1
    Last-Modified: Thu, 21 May 1998 19:19:48 GMT
    ETag: "21047-44c-35647e54"
    Content-Length: 1100
    Accept-Ranges: bytes
    Connection: close
    Content-Type: text/html
    
    
  3. Abhägig von Content-Type folgen weitere Informationen.

    zum Beispiel bei text/html eine HTML-Datei, oder bei image/gif ein GIF-Bild.

Allgemein:

Status-Line
General-Header(s)
Response-Header(s)
Entity-Header(s)
CRLF
Entity-Body

Nach dem Abbau der Verbindung gibt es auf beiden Seiten keine Informationen mehr über den Partner.

Methoden

Statusmeldungen des Servers

HTTP Header

Allgemeine Header

Client Anfragen

Server Antworten

Cookies

Cookies

Inhaltsangaben

MIME-Types

Multipurpose Internet Mail Extensions

Typ/Subtyp Datei-Erweiterung Datei-Typ
application/pdf pdf Portable Document Format
von Adobe
application/ps eps, ps PostScript
application/x-tar tar "Tape-Archive"
audio/basic au, snd Audioformate
image/gif gif Graphikformat
image/tiff tiff, tif Graphikformat
text/html html, htm HTML Datei
text/plain txt reine ASCII Datei

Verbesserungen in HTTP 1.1

Persistente HTTP Verbindungen

Web-Server

Arbeitsweise

Apache Entwicklung

(Apache) Konfiguration

Ältere Versionen (wie NCSA):

Aktuelle Versionen:

Beispiel: httpd.conf und mime.types

Sicherheit

Ablauf:

  1. Zugriff auf geschützte Seite

  2. Server schickt Fehlermeldung 401 Unauthorized  und verlangt Authentifizierung

  3. Browser fragt mit Dialogbox nach den Informationen, z.B. Benutzer/Passwort

  4. Browser wiederholt die Anfrage nach der geschützten Seite, diesmal aber mit Authentifizierung

  5. falls OK, schickt der Server die Seite

Installation

Log-Files

httpd.error_log:

[Mon Dec 20 08:29:18 1999] [notice] Apache/1.3.6 (Unix)  (SuSE/Linux) configured -- resuming normal operations
[Mon Dec 20 08:29:18 1999] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Dec 21 00:24:23 1999] [notice] caught SIGTERM, shutting down
...
[Tue Dec 21 11:38:59 1999] [notice] Apache/1.3.6 (Unix)  (SuSE/Linux) configured -- resuming normal operations
[Tue Dec 21 11:38:59 1999] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

httpd.access_log:

127.0.0.1 - - [21/Dec/1999:20:39:33 +0100] "GET / HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:20:39:33 +0100] "GET /gif/gl.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:20:39:33 +0100] "GET /gif/apache_logo.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:20:39:33 +0100] "GET /gif/awlogo.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:20:39:33 +0100] "GET /gif/suse_150.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:20:39:33 +0100] "GET /gif/apache_pb.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:23:03:29 +0100] "GET /manual/ HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:23:03:29 +0100] "GET /manual/images/sub.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:23:03:29 +0100] "GET /manual/images/index.gif HTTP/1.0" 304 -
127.0.0.1 - - [21/Dec/1999:23:03:45 +0100] "GET /manual/install.html HTTP/1.0" 200 10455
127.0.0.1 - - [21/Dec/1999:23:04:13 +0100] "GET /manual/new_features_1_3.html HTTP/1.0" 200 33665

Auswertung der Log-Files

z.B. Webalizer


Ausblick


© Universität Mannheim, Rechenzentrum, 1998-2002.

Heinz Kredel
Last modified: Sun Mar 16 15:43:32 CET 2003