]>
Commit | Line | Data |
---|---|---|
757d2cad | 1 | <HTML> |
2 | <!-- SECTION: Getting Started --> | |
3 | <HEAD> | |
4 | <TITLE>Using CGI Programs</TITLE> | |
5 | </HEAD> | |
6 | <BODY> | |
7 | ||
8 | <P>CUPS has traditionally provided a dynamic web interface | |
9 | through dedicated CGI programs that are executed when users open | |
10 | special directories on the CUPS server. Each CGI performs | |
11 | administration, class, help, job, and printer functions as | |
12 | directed by the user, but the actual programs that are run and | |
13 | functions that are available are limited to those that were | |
14 | originally designed into the scheduler.</P> | |
15 | ||
16 | <P>Support is now available for CGI programs and specific | |
17 | scripting languages, currently Java, Perl, PHP, and Python. The | |
18 | interpreters for these languages are currently configured at | |
19 | compile time. Future versions may expand the interface to allow | |
20 | for generic support of scripting languages similar to the Apache | |
21 | "AddHandler" directive, but with external programs instead of | |
22 | modules.</P> | |
23 | ||
24 | <P>Table 1 shows the MIME media types that are reserved for the | |
25 | CGI support in CUPS. The names have been chosen to mirror those | |
26 | used by Apache:</P> | |
27 | ||
28 | <DIV CLASS="table"><TABLE SUMMARY="CGI MIME Media Types"> | |
29 | <CAPTION>Table 1: CGI MIME Media Types</CAPTION> | |
30 | <TR> | |
31 | <TH>MIME Media Type</TH> | |
32 | <TH>Description</TH> | |
33 | </TR> | |
34 | <TR> | |
35 | <TD>application/x-httpd-cgi</TD> | |
36 | <TD>CGI script/program</TD> | |
37 | </TR> | |
38 | <TR> | |
39 | <TD>application/x-httpd-java</TD> | |
40 | <TD>Java program</TD> | |
41 | </TR> | |
42 | <TR> | |
43 | <TD>application/x-httpd-perl</TD> | |
44 | <TD>Perl script</TD> | |
45 | </TR> | |
46 | <TR> | |
47 | <TD>application/x-httpd-php</TD> | |
48 | <TD>PHP script</TD> | |
49 | </TR> | |
50 | <TR> | |
51 | <TD>application/x-httpd-python</TD> | |
52 | <TD>Python script</TD> | |
53 | </TR> | |
54 | </TABLE></DIV> | |
55 | ||
56 | <H2><A NAME="CONFIG">Configuring the Server</A></H2> | |
57 | ||
58 | <P>In order to enable the corresponding type, you must create a | |
59 | new <VAR>/etc/cups/cgi.types</VAR> file which maps the filename | |
60 | extensions to the appropriate MIME type, for example:</P> | |
61 | ||
62 | <PRE CLASS="command"> | |
63 | application/x-httpd-cgi cgi | |
64 | application/x-httpd-java class | |
65 | application/x-httpd-perl pl | |
66 | application/x-httpd-php php | |
67 | application/x-httpd-python py | |
68 | </PRE> | |
69 | ||
70 | <P>CGI scripts/programs (application/x-httpd-cgi) also must have | |
71 | execution permissions to be treated as a CGI script or | |
72 | program.</P> | |
73 | ||
74 | <H2><A NAME="LIMITS">Limitations</A></H2> | |
75 | ||
76 | <P>CUPS implements most of the CGI/1.1 specification, with the | |
77 | following exceptions:</P> | |
78 | ||
79 | <UL> | |
80 | ||
81 | <LI>No PATH_INFO or PATH_TRANSLATED support</LI> | |
82 | ||
83 | <LI>Limited HTTP field support; only the Content-Length | |
84 | (CONTENT_LENGTH), Cookie (HTTP_COOKIE), and User-Agent | |
85 | (HTTP_USER_AGENT) fields are placed in environment | |
86 | variables at this time</LI> | |
87 | ||
88 | </UL> | |
89 | ||
90 | </BODY> | |
91 | </HTML> |