Re: [Mojolicious] Intermittent 400's using Mojo::UserAgent

2017-03-10 Thread Stefan Adams
On Fri, Mar 10, 2017 at 6:59 PM, Sebastian Riedel  wrote:

> MOJO_USERAGENT_DEBUG=1


Is it due to the random ordering of the headers?  It's successful when
Authorization: Basic with it's improper \n is the last of the headers...?

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Intermittent 400's using Mojo::UserAgent

2017-03-10 Thread Sebastian Riedel
MOJO_USERAGENT_DEBUG=1

-- 
Sebastian Riedel
http://mojolicio.us
http://github.com/kraih
http://twitter.com/kraih

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Intermittent 400's using Mojo::UserAgent

2017-03-10 Thread Todd
In case it wasn't clear from above:

client sample above -> apache ---> mojolicious app 

where the apache is configured as a reverse proxy to the mojolicious app.
The apache server also provided the authentication check.

the apache stanza that configures this setup:


ServerName myservername

ProxyPreserveHost   On
ProxyPass   /   http://localhost:3000/ keepalive=On retry=0
ProxyPassReverse/   http://localhost:3000/

-snip- 


-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Intermittent 400's using Mojo::UserAgent

2017-03-10 Thread Todd
Hi,

Writing a client for a REST api that I created.  The client works 
approximately half the time.  Here's a simple version that can recreate the 
problem:

#!/usr/bin/env perl

use v5.18;
use strict;
use warnings;
use Mojo::UserAgent;
use MIME::Base64;
use Data::Dumper;

my $ua   = Mojo::UserAgent->new();
my $user = "scot-alerts";
my $pass = "";
my $auth = "Basic ".encode_base64($user.":".$pass);

$ua->on( start => sub {
my $ua = shift;
my $tx = shift;
$tx->req->headers->header(
'Authorization' => $auth
);
});

my $results = {};
for my $i (1..100) {

my $tx = $ua->get(
'https://myservername/myapp/api/v2/event/1' => {Accept => '*/*' }
);

my $code = $tx->res->code;
$results->{$code}++;

}
say Dumper($results);

Three runs of the above yield:
perl simple.pl
$VAR1 = {
  '200' => 49,
  '400' => 51
};
perl simple.pl
$VAR1 = {
  '200' => 50,
  '400' => 50
};
perl simple.pl
$VAR1 = {
  '400' => 55,
  '200' => 45
};

I'm not sure if the problem is with Apache Config or Client.  Web browser 
access to https://myservername/scot/api/v2/event/1 never fails.
I do see the following in the apache2 error log:

AH02031: Hostname myservername provided via SNI, but no hostname provided 
in HTTP request

I've tried adding the "Host" header (set to myservername) when I set the 
"Authorization" header, but that didn't change anything.

System is Ubuntu 14.04, Apache/2.4.7 (Ubuntu), Perl 5.18.2, up to date 
Mojo::UserAgent  (cpanm claims it is up to date anyway)

Any ideas what I'm doing wrong?  Thanks!
Todd



-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Problem with implementing custom command in Mojolicious::Lite app

2017-03-10 Thread Luc Didry
vendredi 10 mars 2017, 03:48:27 CET Pavel Serikov wrote:
> Hello everyone,
> 
> I'm trying to implement custom command 
> 
>  
> in my app  like described in cookbook 
> 
> .
> 
> Custom namespace is loaded, however command doesn't work:
> 
> pavel@pavel-Inspiron-3542:/projects/bom$ socialbom cmd1
> Unknown command "cmd1", maybe you need to install it?
> Compilation failed in require at /usr/local/bin/socialbom line 14,  
> line 1.
> 
> What am I doing wrong?
> 
> 

Just a guess : in
https://github.com/pavelsr/SocialBOM/blob/master/lib/App/SocialBOM.pm#L197, you
should put
push @{app->commands->namespaces}, 'App::SocialBOM::Command';
instead of
push @{app->commands->namespaces}, 'App::SocialBOM::Command::cmd1';
-- 
Luc
https://fiat-tux.fr/
https://luc.frama.io/
Internet n'est pas compliqué, Internet est ce que vous en faites.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Problem with implementing custom command in Mojolicious::Lite app

2017-03-10 Thread Pavel Serikov
Hello everyone,

I'm trying to implement custom command 

 
in my app  like described in cookbook 

.

Custom namespace is loaded, however command doesn't work:

pavel@pavel-Inspiron-3542:/projects/bom$ socialbom cmd1
Unknown command "cmd1", maybe you need to install it?
Compilation failed in require at /usr/local/bin/socialbom line 14,  
line 1.

What am I doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.