Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

HTTP::Message vs Content-Type: application/force-download

by firehat (Initiate)
on Aug 06, 2009 at 18:51 UTC ( #786539=perlquestion: print w/ replies, xml ) Need Help??
firehat has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I'm trying to access content identified as follows from an LWP POST:
    Content-Type: application/force-download
    Content-Disposition: attachment; filename= Results.txt
`$mess->content' returns nothing.
$mess = $ua->post('https://foobarbaz.com/servlet', Content_Type => 'form-data', Content => [ foo => 'a', bar => 'b', baz => 'c', attachment => [ undef, 'attachment', Content => $req ], ] );
What's the proper way to access the `application/force-download' content?

Much obliged!

Comment on HTTP::Message vs Content-Type: application/force-download
Download Code
Replies are listed 'Best First'.
Re: HTTP::Message vs Content-Type: application/force-download
by ikegami (Pope) on Aug 12, 2009 at 15:04 UTC
    application/octet-stream is the official type. application/force-download is not recognised by the browser, which means it gets treated as application/octet-stream. Might as well use application/octet-stream directly.
Re: HTTP::Message vs Content-Type: application/force-download
by Anonymous Monk on Aug 06, 2009 at 21:28 UTC
    `$mess->content' returns nothing.

    What does it contain?

    print $mess->dump;

    What's the proper way to access the `application/force-download' content?

    There is nothing special about application/force- download, simply follow SOP, do it in a browser, then try to replicate the headers (livehttpheaders).

      $mess->dump reports `(no content)'.

      Using cURL:
      HTTP/1.1 100 Continue
      
      HTTP/1.1 200 OK
      Date: Mon, 10 Aug 2009 13:37:02 GMT
      Server: Microsoft-IIS/6.0
      X-Powered-By: ASP.NET
      Server: WebSphere Application Server/6.0
      Content-Type: application/force-download
      Content-Disposition: attachment; filename= Results.txt
      Content-Length: 586
      Content-Language: en-US
      
      Expected Content Here...
      
      Using LWP:
      HTTP/1.1 200 OK
      Connection: close
      Date: Mon, 10 Aug 2009 13:39:02 GMT
      Server: Microsoft-IIS/6.0
      Server: WebSphere Application Server/6.0
      Content-Language: en-US
      X-Powered-By: ASP.NET
      
      (no content)
      
        It has to output a bit more than that
        $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return });

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://786539]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2015-07-08 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls