logo       

Re: PATCH: Using "plain" content for ->post method: msg#00034

Subject: Re: PATCH: Using "plain" content for ->post method
Slaven Rezic <srezic@xxxxxxxxxxx> writes:

> The attached patch adds the feature to use plain content (that is, no
> param-value pairs) for POST requests.

Since POST() already support plain content I instead applied the
following patch that tries to document this better and makes
$ua->post() not block this feature.  Your test suite addition was
applied with a little tweak. Thanks!

If you apply this patch to LWP::UserAgent you should be able to do
what you want with:

    my $res = $ua->post($soap_url,
        Content_Type => "text/xml;charset=UTF-8",
        SOAPAction   => "Something",
        Content      => $soap_request_string,
    );

Regards,
Gisle



--- lib/HTTP/Request/Common.pm  15 Nov 2004 14:52:37 -0000      1.26
+++ lib/HTTP/Request/Common.pm  14 Dec 2005 21:01:07 -0000
@@ -343,6 +343,12 @@ $ua->request(HEAD ...).
 
 Like GET() but the method in the request is "PUT".
 
+The content of the request can be specified using the "Content"
+pseudo-header.  This steals a bit of the header field namespace as
+there is no way to directly specify a header that is actually called
+"Content".  If you really need this you must update the request
+returned in a separate statement.
+
 =item POST $url
 
 =item POST $url, Header => Value,...
@@ -351,10 +357,16 @@ Like GET() but the method in the request
 
 =item POST $url, Header => Value,..., Content => $form_ref
 
-This works mostly like GET() with "POST" as the method, but this function
-also takes a second optional array or hash reference parameter
-($form_ref).  This argument can be used to pass key/value pairs for
-the form content.  By default we will initialize a request using the
+=item POST $url, Header => Value,..., Content => $content
+
+This works mostly like PUT() with "POST" as the method, but this
+function also takes a second optional array or hash reference
+parameter $form_ref.  As for PUT() the content can also be specified
+directly using the "Content" pseudo-header, and you may also provide
+the $form_ref this way.
+
+The $form_ref argument can be used to pass key/value pairs for the
+form content.  By default we will initialize a request using the
 C<application/x-www-form-urlencoded> content type.  This means that
 you can emulate a HTML E<lt>form> POSTing like this:
 
--- lib/LWP/UserAgent.pm        16 Sep 2004 09:28:22 -0000      2.33
+++ lib/LWP/UserAgent.pm        14 Dec 2005 21:01:08 -0000
@@ -423,7 +423,7 @@ sub get {
 sub post {
     require HTTP::Request::Common;
     my($self, @parameters) = @_;
-    my @suff = $self->_process_colonic_headers(\@parameters,2);
+    my @suff = $self->_process_colonic_headers(\@parameters, 
(ref($parameters[1]) ? 2 : 1));
     return $self->request( HTTP::Request::Common::POST( @parameters ), @suff );
 }
 



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe