07_CGI - CSI 3540 Structures, techniques et normes du Web...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
CSI 3540 Structures, techniques et normes du Web Friday, January 29, 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Objectif: Introduction à la programmation côté serveur Introduction aux CGI Lectures: Common Gateway Interface 1.1 Programmation côté serveur : CGI Friday, January 29, 2010
Background image of page 2
Plan 1. Introduction 2. Présentation détaillée du protocole CGI 1. Exécution des CGIs 2.Passage de paramètres 3. Méthode Get 4. Méthode Post 3. Remarques Friday, January 29, 2010
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Côté client Les navigateurs modernes savent : Afficher des documents XHTML Interpréter les feuilles de styles ( CSS ) Exécuter des scripts ECMAScript Donner accès aux documents et leur structure à l’aide du DOM Friday, January 29, 2010
Background image of page 4
Côté client : programmation Par exemple, valider le format d’un numéro de téléphone, de carte de crédit, etc. Réduire la charge du réseau et/ou du serveur Construire/modifier les pages côté client Rendre l’utilisation de l’application plus agréable (Rich Internet Application) Friday, January 29, 2010
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Côté serveur Jusqu’à maintenant, les pages servies étaient préexistantes et donc statiques Friday, January 29, 2010
Background image of page 6
Côté serveur : programmation Nous abordons maintenant la génération de pages dynamiques par le serveur Exemple : engins de recherche tels que Google 1993, C ommon G ateway I nterface ( CGI ) 1997, Sun Microsystems Java Servlet 2004, RFC 3875 (CGI 1.1) Friday, January 29, 2010
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Common Gateway Interface Serveur W eb (HTTP) Internet Application CGI Client Serveur Friday, January 29, 2010
Background image of page 8
Common Gateway Interface (CGI 1.1) Le serveur HTTP est configuré afin de reconnaître les URLs d’application externes, par exemple, /cgi-bin/ Définit le passage de paramètres entre un serveur HTTP et une application externe Très général , n’impose pas ou peu de restrictions quant au choix du langage de programmation Friday, January 29, 2010
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Configuration (Apache) /etc/httpd/httpd.conf : ... LoadModule cgi_module libexec/httpd/mod_cgi.so AddModule mod_cgi.c ... ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/" ... <Directory "/Library/WebServer/CGI-Executables"> AllowOverride None Options None Order allow,deny Allow from all </Directory> ... AddHandler cgi-script .cgi ... Friday, January 29, 2010
Background image of page 10
CGI : sans paramètre Il suffit de configurer le serveur Concevoir un programme exécutable produisant, sur la sortie standard ( standard i/o ), le corps du message CGI réponse (un en-tête, une ligne blanche, suivie du corps du message, typiquement un document XHTML) Friday, January 29, 2010
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#include <stdlib.h> #include <stdio.h> #include <time.h> int main( int argc, char * argv[] ) { size_t maxsize = 256; char buffer [ maxsize ]; time_t t; struct tm *timeptr; t = time( NULL ); timeptr = localtime( &t ); strftime( buffer , maxsize, "%k h %M", timeptr ); printf( "Content-type: text/html\n" ); printf( "\n" ); printf( "<!DOCTYPE html\n" ); printf( " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" );
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/07/2010 for the course CSI ITI1520 taught by Professor Marcelturcotte during the Spring '10 term at University of Ottawa.

Page1 / 48

07_CGI - CSI 3540 Structures, techniques et normes du Web...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online