[Mojolicious] Re: What's the proper way to retrieve the client's IP address?

2014-07-23 Thread Юрий Корик
What's the right way to retrieve the client's IP address? 

Create helper:

$self-renderer-add_helper(ip = sub {
  my $self = shift;
  my $for  = $self-req-headers-header('X-Forwarded-For');
  return $for  $for !~ /unknown/i ? $for : undef || 
$self-req-headers-header('X-Real-IP') || $self-tx-{remote_address};
});




-- 
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: What's the proper way to retrieve the client's IP address?

2014-07-23 Thread Jan Henning Thorsen
If you have set up the reverse proxy correct, you can just do 
$c-remote_address;

No idea why you want to look into the tx hash. You should always use the 
methods.

Look here: (there's also cookbooks for other servers on that page)
https://metacpan.org/pod/distribution/Mojolicious/lib/Mojolicious/Guides/Cookbook.pod#Nginx
https://metacpan.org/pod/Mojo::Transaction#remote_address

Also remember to set the MOJO_REVERSE_PROXY=1 environmnt variable as I said 
earlier in this thread.
https://metacpan.org/pod/Mojo::Server#reverse_proxy
https://metacpan.org/pod/Mojo::Server::Hypnotoad#proxy


On Wednesday, July 23, 2014 1:17:54 PM UTC+2, Юрий Корик wrote:

 What's the right way to retrieve the client's IP address? 

 Create helper:

 $self-renderer-add_helper(ip = sub {
   my $self = shift;
   my $for  = $self-req-headers-header('X-Forwarded-For');
   return $for  $for !~ /unknown/i ? $for : undef || 
 $self-req-headers-header('X-Real-IP') || $self-tx-{remote_address};
 });




-- 
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Wishlist thread (second edition)

2014-07-23 Thread sri


 my $tx = ...-res-forms( name = 'login' ) 
 -submit({ user = 'me', password = '12345'});


We are currently considering the addition of a Mojo::DOM::val method (like 
in jQuery, but with support for entire forms) as a first step.

http://pastie.org/9414616

--
sebastian

-- 
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] What's the proper way to retrieve the client's IP address?

2014-07-23 Thread Alexander Karelas

That worked. Thank you.

- Alex


On 07/14/2014 01:02 PM, Jan Henning Thorsen wrote:
Try setting { hypntoad = { proxy = 1, listen = [...] } in the 
config file, if you are using hypnotoad, or set the 
MOJO_REVERSE_PROXY=1 environment variable in other cases. Support for 
the environment variable was added in Mojolicious 5.11.


This will allow retrieving the IP address using $self-tx-remote_address


--
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Wishlist thread (second edition)

2014-07-23 Thread sri


 We are currently considering the addition of a Mojo::DOM::val method (like 
 in jQuery, but with support for entire forms) as a first step.


A more complete patch is now available in a branch, chances of it getting 
applied are currently 50:50, due to some problems with handling buttons.

https://github.com/kraih/mojo/compare/val

Feedback welcome!

--
sebastian

-- 
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.