Mailing List Archive

Quick Documentation Fix
On:
http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_out_
and
http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_err_headers_out_

it is suggested that the proper syntax for adding a header is:

$r->headers_out->add('Set-Cookie' => $cookie);

This howerver does not work. The example at:
http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_err_header_out_

has it right, with:

$r->headers_out->{'Pragma'} = "no-cache";

I suggest it be updated in the full API section.

Thanks!

-miles
__________________________________
Miles Crawford, Software Developer
Catalyst Research and Development
Educational Partnerships & Learning Technologies
University of Washington
206.616.3406
http://catalyst.washington.edu

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org
Re: Quick Documentation Fix [ In reply to ]
Miles Crawford wrote:
>
> On:
> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_out_
> and
> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_err_headers_out_
>
>
> it is suggested that the proper syntax for adding a header is:
>
> $r->headers_out->add('Set-Cookie' => $cookie);
>
> This howerver does not work.

of course it does. you can see from yourself in the mod_perl test suite:

t/response/TestAPI/err_headers_out.pm [21]:
$r->err_headers_out->add('X-err_headers_out' => "err_headers_out");

using the set() or add() interface is the preferred method, over the tied
interface shown below.

> The example at:
> http://perl.apache.org/docs/2.0/user/porting/compat.html#C__r_E_gt_err_header_out_
>
>
> has it right, with:
>
> $r->headers_out->{'Pragma'} = "no-cache";

this documentation is for the compat layer. I can't recall offhand whether
this syntax works without Apache2::compat or not.

but regardless, so you know, the first example adds to any existing
Set-Cookie outgoing headers, and only in the headers_out table, which will
not persist across REDIRECT responses (use err_headers_out for that). the
second example overwrites any existing Pragma headers in headers_out table.

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org
Re: Quick Documentation Fix [ In reply to ]
On Fri, 7 Apr 2006, Geoffrey Young wrote:

>
>
> Miles Crawford wrote:
>>
>> On:
>> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_out_
>> and
>> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_err_headers_out_
>>
>>
>> it is suggested that the proper syntax for adding a header is:
>>
>> $r->headers_out->add('Set-Cookie' => $cookie);
>>
>> This howerver does not work.
>
> of course it does. you can see from yourself in the mod_perl test suite:
>
> t/response/TestAPI/err_headers_out.pm [21]:
> $r->err_headers_out->add('X-err_headers_out' => "err_headers_out");


All of your responses have been about $r->err_headers_out, my trouble was with
$r->headers_out() which really, honestly didn't work. However, as stated
earlier in the thread that was a bug that's apparently been fixed.

>> $r->headers_out->{'Pragma'} = "no-cache";
>
> this documentation is for the compat layer. I can't recall offhand whether
> this syntax works without Apache2::compat or not.

Thanks - I must have missed the distinction between the 2.0 API docs and the
compatability layer docs.

-miles

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org
Re: Quick Documentation Fix [ In reply to ]
>>> it is suggested that the proper syntax for adding a header is:
>>>
>>> $r->headers_out->add('Set-Cookie' => $cookie);
>>>
>>> This howerver does not work.
>>
>>
>> of course it does. you can see from yourself in the mod_perl test suite:
>>
>> t/response/TestAPI/err_headers_out.pm [21]:
>> $r->err_headers_out->add('X-err_headers_out' => "err_headers_out");>
>
>
> All of your responses have been about $r->err_headers_out,

all?

> my trouble
> was with $r->headers_out() which really, honestly didn't work.

it's the same underlying mechanism - headers_out(), err_headers_out(),
headers_in(), and notes() all use the APR::Table API, so if one works the
others will as well, since they are indistinguishable at the API layer. but
you can check that same file for where it uses headers_out()->add() as well.

> However,
> as stated earlier in the thread that was a bug that's apparently been
> fixed.

there have been no fixes to that code in quite some time, nor can I find
some other thread where this is being discussed currently. but I'm glad to
hear that your problem has been magically fixed :)

>
>>> $r->headers_out->{'Pragma'} = "no-cache";
>>
>>
>> this documentation is for the compat layer. I can't recall offhand
>> whether
>> this syntax works without Apache2::compat or not.
>
>
> Thanks - I must have missed the distinction between the 2.0 API docs and
> the compatability layer docs.

no problem :)

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org
Re: Quick Documentation Fix [ In reply to ]
I responded to this using the wrong address yesterday - didn't get
posted.

On Apr 6, 2006, at 3:31 PM, Miles Crawford wrote:

>
> On:
> http://perl.apache.org/docs/2.0/api/Apache2/
> RequestRec.html#C_headers_out_
> and
> http://perl.apache.org/docs/2.0/api/Apache2/
> RequestRec.html#C_err_headers_out_
>
> it is suggested that the proper syntax for adding a header is:
>
> $r->headers_out->add('Set-Cookie' => $cookie);
>
> This howerver does not work. The example at:
> http://perl.apache.org/docs/2.0/user/porting/
> compat.html#C__r_E_gt_err_header_out_
>
> has it right, with:
>
> $r->headers_out->{'Pragma'} = "no-cache";
>
> I suggest it be updated in the full API section.

I think the headers_out is a bug, and i think it might have been
fixed in a recent version

But... In just about every version of MP2, this works:

$r->err_headers_out->add('Set-Cookie' => $cookie);

i could be wrong here , but i don't think you can set multiple
headers ( of the same kind ) using the direct method you described,
and I seem to remember that you can set multiple ones with add() as
shown above

--

addition - looking at my own emails, i think the headers_out issues
were a bug around 1.9x -> 2.05 (or whatever was around before the API
change). i think it was fixed in the first or second release right
after the API change.

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org