Created
June 14, 2014 10:07
-
-
Save qknight/0f05f2cd9fbca102f838 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $curl = WWW::Curl::Easy->new; | |
#system("$Nix::Config::curl --fail --location --insecure --connect-timeout $curlConnectTimeout '$url' $decompressor | $Nix::Config::binDir/nix-store --restore $destPath"); | |
#$curl->setopt(CURLOPT_HEADER, 1); | |
#$curl->setopt(CURLOPT_URL, 'https://raw.githubusercontent.com/qknight/nix-build-hack/master/www_curl_easy.pl'); | |
$curl->setopt(CURLOPT_URL, $url); | |
$curl->setopt(CURLOPT_NOPROGRESS, 0); | |
$curl->setopt(CURLOPT_FAILONERROR, 0); | |
$curl->setopt(CURLOPT_FOLLOWLOCATION, 1); | |
$curl->setopt(CURLOPT_SSL_VERIFYHOST, 0); | |
$curl->setopt(CURLOPT_CONNECTTIMEOUT, $curlConnectTimeout); | |
$curl->setopt(CURLOPT_CAINFO, $caBundle) if defined $caBundle; | |
$curl->setopt(CURLOPT_USERAGENT, "Nix/$Nix::Config::version"); | |
$curl->setopt(CURLOPT_PROGRESSFUNCTION, sub { | |
my ( $easy, $dltotal, $dlnow, $ultotal, $ulnow, $uservar ) = @_; | |
print STDERR join(' ', @_[1..4]), "\n"; | |
return 0; | |
} | |
); | |
my $string; | |
my $fh1; | |
open($fh1, "> /tmp/bar123"); | |
#open($fh1, ">>", \$string); | |
$curl->setopt(CURLOPT_WRITEDATA, $fh1); | |
# Starts the actual request | |
my $retcode = $curl->perform; | |
print STDERR "===========================================================\n\n\n"; | |
print STDERR " URL = '".$url."'"; | |
# Looking at the results... | |
my $ret = 0; | |
if ($retcode == 0) { | |
#close $fh1; | |
print STDERR "Transfer went ok\n"; | |
my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE); | |
my $wh; | |
system("/nix/store/xdswdgz11w9lm9n9bzb6spl7dj45s2x2-coreutils-8.21/bin/rm /tmp/bar"); | |
open($wh, "> /tmp/bar"); | |
#open($wh, "| $decompressor | $Nix::Config::binDir/nix-store --restore $destPath"); |
Author
qknight
commented
Jun 14, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment