Skip Menu |

This queue is for tickets about the HTTP-DAV CPAN distribution.

Report information
The Basics
Id: 60457
Status: resolved
Worked: 2 hours (120 min)
Priority: 0/
Queue: HTTP-DAV

People
Owner: OPERA [...] cpan.org
Requestors: perl [...] lackhoff.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.41
Fixed in: (no value)



Subject: There should be a way to set your own header(s) in a (PUT) request
Currently there does not seem to be a way to set your own headers but this is necessary for some DAV based applications. E.g. the CalDAV server DAViCal requires a Content-Type: text/calendar; charset=utf-8 header in a PUT request but I would suggest a general solution that will work for other verbs as well. Perhaps a 'headers' attribute that accepts either a hash reference or a HTTP::Headers object or a HTTP::DAV::Headers object.
Subject: Re: [rt.cpan.org #60457] There should be a way to set your own header(s) in a (PUT) request
Date: Wed, 18 Aug 2010 08:38:29 -0700
To: "bug-HTTP-DAV [...] rt.cpan.org" <bug-HTTP-DAV [...] rt.cpan.org>, "perl [...] lackhoff.de" <perl [...] lackhoff.de>
From: Patrick Collins <pcollins1 [...] gmail.com>
Check http::dav documentation for the new method. You can pass in a custom useragent with custom headers (same as you would do with LWP). new(USERAGENT) Creates a new HTTP::DAV client $d = HTTP::DAV->new() The -useragent parameter expects an HTTP::DAV::UserAgent object. See the daveprogram for an advanced example of a custom UserAgent that interactively prompts the user for their username and password. Sent from my iPhone On Aug 18, 2010, at 1:40 AM, "Michael Lackhoff via RT" <bug-HTTP-DAV@rt.cpan.org> wrote: Show quoted text
> Wed Aug 18 04:40:44 2010: Request 60457 was acted upon. > Transaction: Ticket created by michaell > Queue: HTTP-DAV > Subject: There should be a way to set your own header(s) in a (PUT) request > Broken in: 0.41 > Severity: Normal > Owner: Nobody > Requestors: perl@lackhoff.de > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60457 > > > > Currently there does not seem to be a way to set your own headers but > this is necessary for some DAV based applications. > E.g. the CalDAV server DAViCal requires a > Content-Type: text/calendar; charset=utf-8 > header in a PUT request but I would suggest a general solution that will > work for other verbs as well. > Perhaps a 'headers' attribute that accepts either a hash reference or a > HTTP::Headers object or a HTTP::DAV::Headers object.
RT-Send-CC: pcollins1 [...] gmail.com
On Wed Aug 18 04:40:44 2010, michaell wrote: Show quoted text
> Currently there does not seem to be a way to set your own headers but > this is necessary for some DAV based applications. > E.g. the CalDAV server DAViCal requires a > Content-Type: text/calendar; charset=utf-8 > header in a PUT request but I would suggest a general solution that
will Show quoted text
> work for other verbs as well. > Perhaps a 'headers' attribute that accepts either a hash reference or
a Show quoted text
> HTTP::Headers object or a HTTP::DAV::Headers object.
Hi Michael, please attach your patch, even if it's hackish. It helps me to understand your use case. Thanks, -- Cosimo
From: alim [...] gmx.net
Show quoted text
> please attach your patch, even if it's hackish. > It helps me to understand your use case.
Sorry for the late reply. Here is my original patch: myself@u1004a:/usr/local/share/perl/5.10.1/HTTP/DAV# diff Comms.pm Comms.pm.org 174,176d173 < if ( $content && $content =~ /VCALENDAR/i ) { < $headers->header( "Content-Type", q(text/calendar; charset="utf-8") ); < } But what I am doing now and would like to do with a clean accessor, not messing with the Object-Hash: $self->dav->{_comms}->set_header( # dirty but there is no public interface yet! 'Content-Type' => q(text/calendar; charset="utf-8"), ); That is, I am using my own class which has a HTTP::DAV object and I am setting the header on its private _comms attribute.
RT-Send-CC: alim [...] gmx.net, pcollins1 [...] gmail.com
Should be fixed in HTTP::DAV 0.42, soon on CPAN. Now you can say: my $dav = HTTP::DAV->new( -headers => { "X-My-Header" => "my-value" }, ); or use a full HTTP::Headers object. Or you can also pass a "-headers" option in the HTTP::DAV::put() method. It would be nice if you could confirm it works for you. Thanks,
From: alim [...] gmx.net
Show quoted text
> It would be nice if you could confirm it works for you.
Many thanks, looks great! -Michael
Resolved.