Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I was going to suggest using AnyEvent::HTTP but a streaming request/PUT/POST/upload isn't supported ... I think it needs to register a on_body easily

Here is my clumsy attempt which kinda seems to work , two requests are made, but I've not verified that the body/content is sent to the 2nd one -- and it hangs

#!/usr/bin/perl -- use strict; use warnings; use AnyEvent::HTTP; use AnyEvent; AnyEvent->idle( cb => sub { print "\nidling @_\n" } ); my $cv = AnyEvent->condvar( cb => sub { warn "done"; } ); http_get ## schedule/cue up an event "http://localhost/test2", want_body_handle => 1, sub { warn "get one @_\n"; $cv->begin; #~ my ($handle, $hdr) = @_; my( $readFrom, $hdr ) = @_; $readFrom->on_eof( sub { $readFrom->destroy } ); my %headers = ( cookie => $hdr->{'set-cookie'}, ## for my server since s +ame length => $hdr->{"content-length"}, type => $hdr->{"content-type"}, ); my $just_this_once = 0; http_post "http://localhost/test2?whatchyagot", undef, # NO BODY headers => \%headers, want_body_handle => 1, sub { return if $just_this_once; $just_this_once++; $cv->begin; warn "what is this @_\n"; my( $writeTo, $hdr ) = @_; $readFrom->on_read( sub { my $data = delete $_[0]{rbuf}; $writeTo->push_write( $data ); return; } ); return; }; return; }; $cv->end; ## MainLoop/run the program (do the get_ing and post_ing ) print '$cv->recv ', $cv->recv, "\n"; __END__ get one AnyEvent::Handle=HASH(0xd0ef24) HASH(0xbcc254) what is this AnyEvent::Handle=HASH(0xc0058c) HASH(0x9ef42c) Terminating on signal SIGINT(2)

In reply to Re: Stream file from one HTTP server to another with HTTP GET and PUT requests (can't use AnyEvent::HTTP) by Anonymous Monk
in thread Stream file from one HTTP server to another with HTTP GET and PUT requests by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (4)
    As of 2018-05-21 11:42 GMT
    Find Nodes?
      Voting Booth?