httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@liege.ICS.UCI.EDU>
Subject Re: HTTP/1.1 changes
Date Wed, 14 Aug 1996 06:18:36 GMT
More questions/comments on the changes.

>   Index: mod_cgi.c
>   ===================================================================
>...
>     int cgi_handler (request_rec *r)
>     {
>   !     int retval, nph;
>         char *argv0;
>         FILE *script_out, *script_in;
>         char argsbuffer[HUGE_STRING_LEN];
>         int is_included = !strcmp (r->protocol, "INCLUDED");
>     
>         struct cgi_child_stuff cld;
>     
>   +     if (r->method_number == M_OPTIONS) {
>   +         /* 99 out of 100 CGI scripts, this is all they support */
>   +         r->allowed |= (1 << M_GET);
>   +         r->allowed |= (1 << M_POST);
>   + 	return DECLINED;
>   +     }
>   + 

Ummm, does this do what I think it does and prevent any CGI script
from handling OPTIONS?  If so, I'll delete it real soon now.
A CGI script that doesn't check the incoming method is broken
(and yes, I do realize that means many, if not most, CGI scripts are
broken).  None of my CGI scripts are broken.

If we want to encapsulate broken CGI scripts, then we should create
a new module just for that purpose, e.g.  mod_stupid_cgi (or maybe
the opposite mod_smart_cgi, which would also not need to kill the script
on a HEAD requests and other ugly hacks that are in mod_cgi).

>...
>   Index: mod_negotiation.c
>   ===================================================================
>   ***************
>   *** 1016,1021 ****
>   --- 1016,1046 ----
>         return best;
>     }
>     
>   + char *set_vary (pool *p, negotiation_state *neg)
>   + {
>   +     var_rec *var_recs = (var_rec*)neg->avail_vars->elts;
>   +     int i, accept_encoding = 0;
>   +     int accept_language = 0;
>   +     char *enc, *lang;
>   + 
>   +     /* Go through each variant and check for an encoding
>   +      * or language (we always set "Accept", so no need to check).
>   +      */
>   + 
>   +     for (i = 0; i < neg->avail_vars->nelts; ++i) {
>   +         enc = var_recs[i].content_encoding;
>   + 	lang = var_recs[i].content_language;
>   + 
>   +         if (!accept_encoding && !(!enc || !strcmp(enc, "")))
>   + 	    accept_encoding = 1;
>   + 	if (!accept_language && !(!lang || !strcmp(lang, "")))
>   + 	    accept_language = 1;
>   +     }
>   + 
>   +     return pstrcat(p, "Accept", accept_encoding ? ", Accept-Encoding" : "",
>   + 		   accept_language ? ", Accept-Language" : "", NULL);
>   + }
>   + 

I don't understand why we always set "Accept" -- wouldn't this code
be called if they only varied by language?  Also, what does this code
do if all variants use a single language, but vary by other things?

.....Roy

Mime
View raw message