[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] concerns with new header_props


Cees, Mark, and I are in a conversation regarding changes to the
functionality of header_props() in version 3.2. Before I reply to Cees'
message, I wanted to forward it to the list to get your input.


Regarding the cookie functionality:  I would rather not fix problems
in
CGI.pm.  That said, how does CGI.pm handle this situation?  If I call
$query->header(-cookie=>{...}) multiple times does it aggregate your
cookies?  If not, than it's not a CGI-App problem -- it's a CGI.pm
problem.

The CGI.pm header() function is a onetime use function.  It doesn't
store the
headers, it will return the requested headers immediately including any
extra
required headers to make up a valid request.  This is not so much a
problem with
CGI.pm as it is more a design decision that made sense in a function
based module.


I agree with Cees here.
This is not a CGI.pm problem.
CGI::App should provide an interface for setting cookies one by one ( rather than all at once).
Cees gave some very good examples why that is useful.

The same goes for all the other headers.

header_props  - works as is

Keeping header_props unchanged sounds like a good idea in order not to break things.

header_add    - add a header of this type to the current list

I think adding "a header of this type to the current list" makes sense only for cookies. Passing a list (arrayref) to CGI->header does not work with other headers than cookies:

CGI::header(-expires => [1,2], -cookie => [1,2]);

results in

Set-Cookie: 1							<=== array ref working (two cookie headers)
Set-Cookie: 2
Expires: ARRAY(0x1a264a0)				<=== array ref not working
Date: Sun, 09 Nov 2003 12:54:25 GMT
Content-Type: text/html; charset=ISO-8859-1

so we could just call the function "add_cookie" (and it does not take a type anymore, just a list of cookies).

For maximum compatibility with the many tools people use, the cookies are passed in as plain strings (with their encoded value). This precludes us from eliminating duplicate cookies (with the same name) but if we remember the order in which the cookies are added, that should be okay (second cookie header wins over first header)


header_set    - replace the current header of this type

okay.



Just my two yen,

Thilo


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.