Systèmes de communication
HTTP, principales entêtes (3)
Ce document donne les entêtes principales de HTTP 1.0.
Requête | |
Request = Request-line (General-Header | Request-Header | Entity-Header) * CRLF [Entity-Body] |
Tous les HTTP-headers sont de la forme: Field-name ":" SP field-value CRLF |
Request-Line = Method SP Request-URI SP HTTP-Version CRLF | GET url HTTP/1.0 Avec GET, il n'y a pas d'Entity-Body; avec POST, l'Entity-Body contient les données. D'autres méthodes existent possibles (par exemple HEAD). |
General-Header = Date | Pragma | Date : Tue, 15 Nov 1994 08:12:31 GMT Pragma : no-cache La version 1.1 de HTTP (rfc 2068) ajoute un nombre important de General-Header: Connection : close |
Request-Header = Authorization | From | If-Modified-Since | Referer | User-Agent |
From : webmaster@w3.org |
Entity-Header = Allow | Content-Encoding | Content-Length | Content-Type | Expires | Last-Modified ... |
|
Réponses | |
Response = Status-Line (General-Header | Response-Header | Entity-Header) * CRLF [Entity-Body] |
|
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF | HTTP/1.0 200 OK
Il y a 5 familles de Status-Code : 1xx (information), 2xx (succès),
3xx (redirection), 4xx (erreur client), 5xx (erreur serveur). Exemples: |
Response-Header = Location | Server | WWW-Authenticate |
Location : http://... |
Exemple du serveur vers le client
HTTP/1.1 200 OK Date: Wed, 15 Sep 2004 09:46:53 GMT Server: Apache/1.3.29 (Darwin) PHP/4.3.2 Content-Location: index.html.en Vary: negotiate,accept-language,accept-charset TCN: choice Last-Modified: Wed, 18 Jul 2001 23:44:21 GMT ETag: "7593d-5b0-3b561f55;41480efe" Accept-Ranges: bytes Content-Length: 1456 Connection: close Content-Type: text/html Content-Language: en Expires: Wed, 15 Sep 2004 09:46:53 GMT <!DOCTYPE etc... |
Exemple du client vers le serveur (GET)
GET /cgi-bin/search?q=esnig HTTP/1.1 Date: Wed, 15 Sep 2004 09:46:50 GMT Host: www.abord-ch.org User-Agent: Mozilla 7.2 (linux) Content-Language: fr |
Exemple du client vers le serveur (POST)
POST /cgi-bin/search HTTP/1.1 Date: Wed, 15 Sep 2004 09:46:50 GMT Host: www.abord-ch.org User-Agent: Mozilla 7.2 (linux) Content-Type: application/x-www-url-encoded Content-Length: 7 Content-Language: fr q=esnig |
Références: http://www.cis.ohio-state.edu/htbin/rfc/rfc1945.htm