Hi, I am trying to migrate the following mod perl 1 code to mod perl 2 for a range request:

$r->headers_out->set('Accept-Ranges' => 'bytes'); my $range_request = $r->set_byterange; unless ((my $status = $r->meets_conditions) == OK) { return $status; } if ($range_request) { while( my($offset, $length) = $r->each_byterange) { seek $fh, $offset, 0; $r->send_fd($fh, $length); #TO DO: migrate to mod2 }

Reading up the documentation for mod perl 2: The functions $r->set_byterange and $r->each_byterange aren't in the Apache 2.0 API, and therefore don't exist in mod_perl 2.0. The byterange serving functionality is now implemented in the ap_byterange_filter, which is a part of the core http module, meaning that it's automatically taking care of serving the requested ranges off the normal complete response. There is no need to configure it. It's executed only if the appropriate request headers are set. These headers aren't listed here, since there are several combinations of them, including the older ones which are still supported. For a complete info on these see modules/http/http_protocol.c. sendfile accepts the following arguments: $filename $offset $length Is there a sequence of headers I am suppose to send out for it to interpret it as 206 partial download request? Thanks a bunch for any replies!


In reply to mod2 equivalence for ($r->set_byterange and each_byterange) by gcw

Title:
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, details, 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, summary, 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.