Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Set 'Accepts: text/*' header by default.

  • Loading branch information...
commit 8a891a52efe50a1806f16a848ede5e8d4769c3b6 1 parent 52d95b7
pmyteh pmyteh authored

Showing 1 changed file with 9 additions and 5 deletions. Show diff stats Hide diff stats

  1. +9 5 LIB_http.php
14 LIB_http.php
@@ -271,10 +271,11 @@ function http_header($target, $ref)
271 271 ***********************************************************************/
272 272 function http($target, $ref, $method, $data_array, $incl_head)
273 273 {
274   - # XXX TODO: Send Accept: header for text/*, run and test for 406 responses
275   - # on otherwise acceptable downloads.
276   - # XXX TODO: Send Range:bytes=0-99999 header, run and test for 206 and 416
277   - # responses.
  274 + # XXX TODO: Run and test for 406 responses on otherwise acceptable
  275 + # downloads, as a result of the Accepts: header. This may
  276 + # well have a neglible effect: I understand many servers
  277 + # ignore it.
  278 + # XXX TODO: Run and test for 206 and 416 responses from Range: header.
278 279 # XXX TODO: Setup callback on HEAD to cancel download if given a
279 280 # content-type we can't handle
280 281
@@ -334,7 +335,10 @@ function http($target, $ref, $method, $data_array, $incl_head)
334 335 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects
335 336 curl_setopt($ch, CURLOPT_MAXREDIRS, 4); // Limit redirections to four
336 337 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return in string
337   -
  338 + curl_setopt($ch,CURLOPT_HTTPHEADER,array('accept: text/*'); // Ask for text only
  339 + if ($fetchrangeonly == true)
  340 + curl_setopt($ch, CURLOPT_RANGE, "0-99999"); // Size limit
  341 +
338 342 # Create return array
339 343 $return_array['FILE'] = curl_exec($ch);
340 344 $return_array['STATUS'] = curl_getinfo($ch);

0 comments on commit 8a891a5

Please sign in to comment.
Something went wrong with that request. Please try again.