diff -r d024bf1f4eab -r f827f3c50dcf extras/breakpad_upload_crash --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extras/breakpad_upload_crash Sun Feb 21 22:32:27 2016 +0100 @@ -0,0 +1,40 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Mojo::UserAgent; +use Mojo::Util qw/slurp dumper/; +use File::Basename; +use v5.10; + +my $ua = Mojo::UserAgent->new; + +my $url = shift @ARGV; + +foreach my $extra(@ARGV) { + + my ($filename, $dirs, $suffix) = fileparse($extra, ".extra"); + + my $hash = { upload_file_minidump => { file => "$dirs$filename.dmp" } }; + + open(my $fh, "<", $extra); + foreach my $l(<$fh>) { + my ($k, $v) = split('=', $l, 2); + chomp $k; + chomp $v; + $hash->{$k} = $v; + } + close $fh; + + my $tx = $ua->post($url => form => $hash); + if(my $res = $tx->success) { + say $res->body; + } else { + my $err = $tx->error; + if($err->{code}) { + warn "$err->{code} response for $extra: $err->{message}\n" . dumper $hash; + } else { + warn "Connection error: $err->{message}"; + } + } +}