httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: multiple Set-Cookies (was Re: require-client functionality)
Date Tue, 07 May 1996 20:04:19 GMT
David King wrote:
> 
> 
> On Tue, 7 May 1996, Ben Laurie wrote:
> [bunch of stuff removed]
> > > 
> > > Nonshowstopper bugs:
> > > 
> > > 6) Multiple cookies sent *to* clients by CGI scripts do not appear to work.
> > >    I will look further into this.
> > 
> > Is this a consequence of merging the headers (a vague bell is ringing here)?
> > 
> 
> I've looked at this a little at my site.  It is indeed due to the merging of
> headers.  According to the HTTP/1.1 spec which discusses cookies multiple
> Set-Cookie headers are allowed but that the headers may be merged into a 
> single line by some intermediary.  However Netscape 2.0x does not appear to 
> accept merged Set-Cookies.
> 
> What the CGI developers here who noticed the problem have done is place the
> Set-Cookie in META-EQUIV tags in their HTML as a stopgap measure.  
> 
> A simple but really ugly hack that I have done is create a new function
> table_append which just adds the (key, value) pair to the end of the table
> and only use this function when grabbing the CGI headers.  This means that
> a lookup of key on the CGI output will only return the first match of key
> which I felt was a reasonable tradeoff for the time being.
> 
> I have enclosed my patch below in case you want to incorporate it (although
> I can understand why you wouldn't).

I'd be considerably happier about the patch if it checked for the cookie header
and only did a table_append in that case.

Cheers,

Ben.

> 
> Later,
> -David
> ----
>  David King, Boston University Distributed Systems Programmer at large
>  dsmk@bu.edu
>  (617) 353-8250 
> 
> Simple but ugly patch (to 1.1b1):
> ---------------------------------
> ===================================================================
> RCS file: RCS/alloc.c,v
> retrieving revision 1.1
> diff -r1.1 alloc.c
> 588a589,604
> > /******
> >  * This simple append is designed for the scan_script_headers routine
> >  * and it enables multiple versions of the same header on output.  I
> >  * kept this data structure a table so that keyed lookups are still
> >  * possible (although you will only get the first key that matches).
> >  * -dsmk 4/26/96
> >  ***************/
> > void table_append (table *t, char *key, char *val)
> > {
> >     table_entry *elts = (table_entry *)t->elts;
> > 
> >     elts = (table_entry *)push_array(t);
> >     elts->key = pstrdup (t->pool, key);
> >     elts->val = pstrdup (t->pool, val);
> > }
> > 
> ===================================================================
> RCS file: RCS/alloc.h,v
> retrieving revision 1.1
> diff -r1.1 alloc.h
> 148a149
> > void table_append (table *, char *name, char *val);
> ===================================================================
> RCS file: RCS/util_script.c,v
> retrieving revision 1.1
> diff -r1.1 util_script.c
> 306c306
> < 	    table_merge (r->err_headers_out, w, l);
> ---
> > 	    table_append (r->err_headers_out, w, l);
> 
> 

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message