™N
âu¦9c       sÑ     d  Z   	 d Z  k Z  k Z  k Z  k Z  k Z  k Z  k Z  k	 Z	  d e	 i
 f d „  ƒ  YZ ª e Z ¬ d „  Z ¹ d „  Z Â e e i d „ Z Ç e d j o È e ƒ  n d S(	   sz   CGI-savvy HTTP Server.

This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.

s   0.3s   CGIHTTPRequestHandlerc      sM    d  Z     d „  Z , d „  Z 3 d „  Z J d d g Z L d „  Z RS(   s­   Complete HTTP server with GET, HEAD and POST commands.

    GET and HEAD also support running CGI scripts.

    The POST command is *only* implemented for CGI scripts.

    c    s>     % ' |  i ƒ  o ( |  i ƒ  n * |  i d d ƒ d S(   sR   Serve a POST request.

        This is only implemented for CGI scripts.

        iõ  s   Can only POST to CGI scriptsN(   s   selfs   is_cgis   run_cgis
   send_error(   s   selfs1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   do_POST  s   c    s>   , - . |  i ƒ  o / |  i ƒ  Sn 1 t i i |  ƒ Sd S(   s-   Version of send_head that support CGI scriptsN(   s   selfs   is_cgis   run_cgis   SimpleHTTPServers   SimpleHTTPRequestHandlers	   send_head(   s   selfs1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys	   send_head, s   c    s¢   3 ? A |  i } C x |  i d C ro } D t | ƒ } E | |  | j o | | p | | d j o) F | |  | | d f |  _ G d Sn q! WH d Sd S(   s§  test whether PATH corresponds to a CGI script.

        Return a tuple (dir, rest) if PATH requires running a
        CGI script, None if not.  Note that rest begins with a
        slash if it is not empty.

        The default implementation tests whether the path
        begins with one of the strings in the list
        self.cgi_directories (and the next character is a '/'
        or the end of the string).

        i    s   /i   N(   s   selfs   paths   cgi_directoriess   xs   lens   is   cgi_info(   s   selfs   paths   xs   is1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   is_cgi3 s    	1s   /cgi-bins   /htbinc    sx  L M N |  i \ } } O t i | d ƒ } P | d j o% Q | |  | | d f \ } } n
 S d } T t i | d ƒ } U | d j o! V | |  | | f \ } } n X | d f \ } } Y | d | } Z |  i | ƒ } [ t i i | ƒ o# \ |  i d d | ƒ ] d Sn ^ t i i | ƒ o# _ |  i d	 d
 | ƒ a d Sn b t | ƒ o# c |  i d	 d | ƒ e d Sn f t ƒ  } g |  i d d ƒ h |  i i ƒ  i t i ƒ  }	 j |	 d j oH l t i |	 d ƒ \ }	 }
 m |
 o n |  i d |
 ƒ n o d Sn q yt h  } u |  i ƒ  | d <v |  i i  | d <w d | d <x |  i! | d <y t" |  i i# ƒ | d <z |  i$ | d <{ t% i& | ƒ } | | | d <} |  i | ƒ | d <~ | | d < | o € | | d <n  |  i( ƒ  } ‚ | |  i* d j o ƒ | | d <n „ |  i* d | d <ˆ |  i+ i, t- j o ‰ |  i+ i. | d <n ‹ |  i+ i, | d <Œ |  i+ i/ d ƒ }  | o Ž | | d <n  g  }  xp |  i+ i2 d ƒ d  rW } ‘ | d  t i4 j o ’ | i5 t i6 | ƒ ƒ n ” | t i7 | d  d! ƒ } qÛW• t i8 | d! ƒ | d" <– |  i+ i/ d# ƒ } — | o ˜ | | d$ <n š t i: | d% d& ƒ } › y œ t i< | ƒ Wn  t i= j
 o
 ž n XŸ t i> |  i? i@ ƒ  d ƒ   t i> |  i i@ ƒ  d ƒ ¡ | G| G| GH¢ t iA | £ | | g ¤ | ƒ Wn6 ¥ ¦ |  i iB |  iC |  i* ƒ § t iD d' ƒ n Xd S((   s   Execute a CGI script.s   ?i    i   s    s   /i”  s   No such CGI script (%s)Ni“  s#   CGI script is not a plain file (%s)s!   CGI script is not executable (%s)iÈ   s   Script output followss   CGI script exit status x%xs   SERVER_SOFTWAREs   SERVER_NAMEs   CGI/1.1s   GATEWAY_INTERFACEs   SERVER_PROTOCOLs   SERVER_PORTs   REQUEST_METHODs	   PATH_INFOs   PATH_TRANSLATEDs   SCRIPT_NAMEs   QUERY_STRINGs   REMOTE_HOSTs   REMOTE_ADDRs   CONTENT_TYPEs   content-lengths   CONTENT_LENGTHs   accepti   s   ,s   HTTP_ACCEPTs
   user-agents   HTTP_USER_AGENTs   +s    i   (E   s   selfs   cgi_infos   dirs   rests   strings   rfinds   is   querys   finds   scripts
   scriptnames   translate_paths
   scriptfiles   oss   paths   existss
   send_errors   isfiles
   executables
   nobody_uids   nobodys   send_responses   wfiles   flushs   forks   pids   waitpids   stss	   log_errors   envs   version_strings   servers   server_names   protocol_versions   strs   server_ports   commands   urllibs   unquotes   uqrests   address_strings   hosts   client_addresss   headerss
   typeheaders   Nones   types	   getheaders   lengths   accepts   getallmatchingheaderss   lines
   whitespaces   appends   strips   splits
   joinfieldss   uas   replaces   decoded_querys   setuids   errors   dup2s   rfiles   filenos   execves   handle_errors   requests   _exit(   s   selfs   dirs   rests   is   querys   scripts
   scriptnames
   scriptfiles   nobodys   pids   stss   envs   uqrests   hosts   lengths   accepts   lines   uas   decoded_querys1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   run_cgiL sœ   %	!
	

	 	!
(   s   __doc__s   do_POSTs	   send_heads   is_cgis   cgi_directoriess   run_cgi(    s1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   CGIHTTPRequestHandler s   	c     s   ¬ ­ ® ¯ t  o ° t  Sn ± k }  ² y ³ |  i d ƒ d a  Wn> ´ |  i j
 o, µ d t t d „  |  i ƒ  ƒ ƒ a  n X¶ t  Sd S(   s$   Internal routine to get nobody's uids   nobodyi   i   c    s   µ |  d S(   Ni   (   s   x(   s   xs1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   <lambda>µ s    N(   s   nobodys   pwds   getpwnams   errors   maxs   maps   getpwall(   s   pwds1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys
   nobody_uid¬ s   
	*c    s[   ¹ º » y ¼ t  i |  ƒ } Wn  ½ t  i j
 o ¾ d Sn X¿ | d d @d j Sd S(   s   Test for executable file.i    iI   N(   s   oss   stats   paths   sts   error(   s   paths   sts1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys
   executable¹ s   c    s   Â Ä t  i |  | ƒ d  S(   N(   s   SimpleHTTPServers   tests   HandlerClasss   ServerClass(   s   HandlerClasss   ServerClasss1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   testÂ s   s   __main__N(   s   __doc__s   __version__s   oss   syss   times   sockets   strings   urllibs   BaseHTTPServers   SimpleHTTPServers   SimpleHTTPRequestHandlers   CGIHTTPRequestHandlers   Nones   nobodys
   nobody_uids
   executables
   HTTPServers   tests   __name__(    s1   /usr/lib/python1.5/site-packages/CGIHTTPServer.pys   ? s    									”		