Commit 801ef0af authored by Geoff Simmons's avatar Geoff Simmons

Prototype v0.5.2: Forward-porting v0.4.1 (Bugfix for URI-encoding)

parent 4530cb69
...@@ -202,6 +202,7 @@ use threads; ...@@ -202,6 +202,7 @@ use threads;
use threads::shared; use threads::shared;
use LWP::UserAgent; use LWP::UserAgent;
use LWP::ConnCache; use LWP::ConnCache;
use HTTP::Request;
use HTTP::Status qw(RC_NO_CONTENT RC_INTERNAL_SERVER_ERROR); use HTTP::Status qw(RC_NO_CONTENT RC_INTERNAL_SERVER_ERROR);
use Net::STOMP::Client; use Net::STOMP::Client;
use Net::STOMP::Client::Error; use Net::STOMP::Client::Error;
...@@ -211,7 +212,7 @@ use Getopt::Std; ...@@ -211,7 +212,7 @@ use Getopt::Std;
use Pod::Usage; use Pod::Usage;
$Getopt::Std::STANDARD_HELP_VERSION = 1; $Getopt::Std::STANDARD_HELP_VERSION = 1;
$main::VERSION = "0.5.1"; $main::VERSION = "0.5.2";
sub HELP_MESSAGE { sub HELP_MESSAGE {
pod2usage(-exit => 0, -verbose => 1); pod2usage(-exit => 0, -verbose => 1);
...@@ -356,6 +357,7 @@ use constant { ...@@ -356,6 +357,7 @@ use constant {
}; };
my @logtag = ("DEBUG", "NOTICE", "WARN", "ERROR", "FATAL"); my @logtag = ("DEBUG", "NOTICE", "WARN", "ERROR", "FATAL");
use constant { ctPost => 'application/x-www-form-urlencoded' };
my $PIDFH = new FileHandle ">".$config{'pid.file'}; my $PIDFH = new FileHandle ">".$config{'pid.file'};
unless (defined $PIDFH) { unless (defined $PIDFH) {
...@@ -454,7 +456,13 @@ sub submitHTTP { ...@@ -454,7 +456,13 @@ sub submitHTTP {
my ($connect, $data) = @_; my ($connect, $data) = @_;
my $ua = $connect->{ua}; my $ua = $connect->{ua};
my $resp = $ua->post($connect->{url}, Content => $data); my $req = HTTP::Request->new(POST => $connect->{url},
['Content_Type' => ctPost,
'Content_Length' => length($data),
],
$data);
logg(DEBUG, "Prepared request: ", $req->as_string);
my $resp = $ua->request($req);
if ($resp->code != RC_NO_CONTENT) { if ($resp->code != RC_NO_CONTENT) {
logg(ERROR, "Processor error: ", $resp->status_line()); logg(ERROR, "Processor error: ", $resp->status_line());
} }
...@@ -597,13 +605,6 @@ sub run_varnishlog { ...@@ -597,13 +605,6 @@ sub run_varnishlog {
my $data = join('&', @{$record{$tid}{data}}); my $data = join('&', @{$record{$tid}{data}});
$records++; $records++;
logg(DEBUG, "$records complete records found"); logg(DEBUG, "$records complete records found");
#if ($PROCLOGFH) {
# print $PROCLOGFH
# '[', scalar(localtime), "] $data\n";
#}
#submitHTTP({url => $config{'http.url'}, ua => $ua},
# $data);
#submitMQ({queue => 'track', mq => $mq}, $data);
&{$connect{submit}}(\%connect, $data); &{$connect{submit}}(\%connect, $data);
logg(DEBUG, logg(DEBUG,
'DATA: ', join('&', @{$record{$tid}{data}})); 'DATA: ', join('&', @{$record{$tid}{data}}));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment