Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
URL Root (or prefix)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  15 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
s@bykov.odessa.ua  
View profile  
 More options Nov 8 2011, 1:40 pm
From: "s...@bykov.odessa.ua" <s...@bykov.odessa.ua>
Date: Tue, 08 Nov 2011 20:40:46 +0200
Local: Tues, Nov 8 2011 1:40 pm
Subject: URL Root (or prefix)
Hello. I have a little question
Mojolicious works as CGI script (using apache mod rewrite in .htaccess)

$self->redirect_to('/someurl');
generates:
/cgi-bin/script/myapp/someurl

Is it possible to genarete correct redirections to '/someurl' instead of
'/cgi-bin/...'?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Ukolov  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 7:51 am
From: Anton Ukolov <sugar.61...@gmail.com>
Date: Thu, 17 Nov 2011 15:51:26 +0300
Local: Thurs, Nov 17 2011 7:51 am
Subject: Re: [Mojolicious] URL Root (or prefix)

Hello.

hmm... I had similar problem, but with FCGI
This solved my problem:
$self->hook( before_dispatch => sub {
    my $self = shift;
    $self->req->url->base( Mojo::URL->new(q{http://your-domain.com/}) );

});

Try to put it to 'startup' method.

2011/11/8 s...@bykov.odessa.ua <s...@bykov.odessa.ua>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Oetiker  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 7:58 am
From: Tobias Oetiker <t...@oetiker.ch>
Date: Thu, 17 Nov 2011 13:58:41 +0100 (CET)
Local: Thurs, Nov 17 2011 7:58 am
Subject: Re: [Mojolicious] URL Root (or prefix)
Anton,

I use the following variant (and does not require the website to be
hardcoded).

    $self->hook( before_dispatch => sub {
         my $self = shift;
         my $uri = $self->req->env->{SCRIPT_URI};
         $self->req->url->base(Mojo::URL->new($uri)) if $uri;
    });

cheers
tobi

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch t...@oetiker.ch ++41 62 775 9902 / sb: -9900

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Ukolov  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 8:36 am
From: Anton Ukolov <uko...@tochkak.ru>
Date: Thu, 17 Nov 2011 16:36:48 +0300
Local: Thurs, Nov 17 2011 8:36 am
Subject: Re: [Mojolicious] URL Root (or prefix)

Yes, you are right, i gave variant that can be improved.
I prefer to move $uri to the config file.

2011/11/17 Tobias Oetiker <t...@oetiker.ch>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sri  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 8:51 am
From: sri <kra...@googlemail.com>
Date: Thu, 17 Nov 2011 05:51:08 -0800 (PST)
Local: Thurs, Nov 17 2011 8:51 am
Subject: Re: URL Root (or prefix)
Hmm, i don't quite get why so many of you hack the request URL, do we
have to review our CGI environment tests?

https://github.com/kraih/mojo/blob/master/t/mojo/request_cgi.t

--
sebastian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Oetiker  
View profile  
 More options Nov 17 2011, 9:03 am
From: Tobias Oetiker <t...@oetiker.ch>
Date: Thu, 17 Nov 2011 15:03:40 +0100 (CET)
Local: Thurs, Nov 17 2011 9:03 am
Subject: Re: [Mojolicious] Re: URL Root (or prefix)
Hi Sri,

Today sri wrote:
> Hmm, i don't quite get why so many of you hack the request URL, do we
> have to review our CGI environment tests?

> https://github.com/kraih/mojo/blob/master/t/mojo/request_cgi.t

We sad CGI/FCGI people like to hide the name of our script from the
user. Makeing the appropriate URLs work is quite simple using
mod_rewrite in apache.

 RewriteEngine On
 RewriteBase /~oetiker/extopus
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule (.*) ep.fcgi/$1 [L]

But since you are using SCRIPT_NAME in Mojo/Message/Request.pm
to figure out the base url, you are calling our bluff, and if Mojo
is asked to create an url the name of the script pops back up.

mod_rewrite provieds a SCRIPT_URI environment contains a
"sanitized" version of that information, so that the name of the
script remains hidden.

obviously SCRIPT_URI may not exist, so one has to tread carefully
here ...

cheers
tobi

> --
> sebastian

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch t...@oetiker.ch ++41 62 775 9902 / sb: -9900

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sebastian Riedel  
View profile  
 More options Nov 17 2011, 9:44 am
From: Sebastian Riedel <kra...@googlemail.com>
Date: Thu, 17 Nov 2011 15:44:44 +0100
Local: Thurs, Nov 17 2011 9:44 am
Subject: Re: [Mojolicious] Re: URL Root (or prefix)

> mod_rewrite provieds a SCRIPT_URI environment contains a
> "sanitized" version of that information, so that the name of the
> script remains hidden.

> obviously SCRIPT_URI may not exist, so one has to tread carefully
> here ...

I wonder if these mod_rewrite tests are incorrect, they were provided by a third party and i just made them pass.

  https://github.com/kraih/mojo/blob/master/t/mojo/request_cgi.t#L439

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Oetiker  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 10:07 am
From: Tobias Oetiker <t...@oetiker.ch>
Date: Thu, 17 Nov 2011 16:07:33 +0100 (CET)
Local: Thurs, Nov 17 2011 10:07 am
Subject: Re: [Mojolicious] Re: URL Root (or prefix)
Hi Sebastian,

he is not looking at SCRIPT_URI which is realy central in this
matter as far as I see it, since it points to the 'script' and does
not include PATH_INFO ... whereas REQUEST_URI includes PATH_INFO
... (one could be built from the other, though).

if Mojo made any use of SCRIPT_URI that is ...

cheers
tobi

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch t...@oetiker.ch ++41 62 775 9902 / sb: -9900


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sebastian Riedel  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 10:17 am
From: Sebastian Riedel <kra...@googlemail.com>
Date: Thu, 17 Nov 2011 16:17:39 +0100
Local: Thurs, Nov 17 2011 10:17 am
Subject: Re: [Mojolicious] Re: URL Root (or prefix)

> he is not looking at SCRIPT_URI which is realy central in this
> matter as far as I see it, since it points to the 'script' and does
> not include PATH_INFO ... whereas REQUEST_URI includes PATH_INFO
> ... (one could be built from the other, though).

> if Mojo made any use of SCRIPT_URI that is ...

The question is if the current behavior is right or wrong.
I would accept patches if it was proven to be wrong.

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Oetiker  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 10:25 am
From: Tobias Oetiker <t...@oetiker.ch>
Date: Thu, 17 Nov 2011 16:25:29 +0100 (CET)
Local: Thurs, Nov 17 2011 10:25 am
Subject: Re: [Mojolicious] Re: URL Root (or prefix)
Hi Sebastian,

Today Sebastian Riedel wrote:
> > he is not looking at SCRIPT_URI which is realy central in this
> > matter as far as I see it, since it points to the 'script' and does
> > not include PATH_INFO ... whereas REQUEST_URI includes PATH_INFO
> > ... (one could be built from the other, though).

> > if Mojo made any use of SCRIPT_URI that is ...

> The question is if the current behavior is right or wrong.
> I would accept patches if it was proven to be wrong.

In the absence of SCRIPT_URI I would say the behaviour is correct.
If SCRIPT_URI is present, then there is room for improvement, as
Mojo is actually exposing internal information of the web server
(the name of the script) where this could be prevented.

but a proof ... difficult :-)

cheers
tobi


--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch t...@oetiker.ch ++41 62 775 9902 / sb: -9900

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sebastian Riedel  
View profile   Translate to Translated (View Original)
 More options Nov 17 2011, 11:00 am
From: Sebastian Riedel <kra...@googlemail.com>
Date: Thu, 17 Nov 2011 17:00:02 +0100
Local: Thurs, Nov 17 2011 11:00 am
Subject: Re: [Mojolicious] Re: URL Root (or prefix)

> In the absence of SCRIPT_URI I would say the behaviour is correct.
> If SCRIPT_URI is present, then there is room for improvement, as
> Mojo is actually exposing internal information of the web server
> (the name of the script) where this could be prevented.

> but a proof ... difficult :-)

Ok, then they are at least incomplete, i'll remove them for now.

  https://github.com/kraih/mojo/commit/7f7c382b7196db23bd432a99c574cbac...

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Testing Mojolicious::Lite apps" by John Stoffel
John Stoffel  
View profile  
 More options Apr 26 2012, 3:14 pm
From: "John Stoffel" <j...@stoffel.org>
Date: Thu, 26 Apr 2012 15:14:27 -0400
Local: Thurs, Apr 26 2012 3:14 pm
Subject: Testing Mojolicious::Lite apps

Hi all,

I've read the page on howto test Mojolicious::Lite apps, but I'm
obviously missing something when I read:

  https://github.com/kraih/mojo/wiki/Testing

and the example of testing a Mojolicious::Lite app.  It's not clear if
this is a completely seperate script which needs to be run, or if it's
a fragment to be put into @@ t/test.pl in the __DATA__ section.

I even found the following blog entry, which looks good, but doesn't
answer the question either.

  http://blogs.perl.org/users/tempire/2012/02/mojolicious-full-and-lite...

It boils down to 1) do I include the tests into my Mojolicious::Lite
app foo.pl file or do I need to keep the tests seperate?  

Thanks,
John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Stoffel  
View profile  
 More options Apr 26 2012, 3:23 pm
From: "John Stoffel" <j...@stoffel.org>
Date: Thu, 26 Apr 2012 15:23:36 -0400
Local: Thurs, Apr 26 2012 3:23 pm
Subject: Re: [Mojolicious] Testing Mojolicious::Lite apps

Just to be nicer about it, this is what I'm trying to do:

   #!/usr/bin/perl -w

   use Mojolicious::Lite;

   get '/' => sub {
     my $self = shift;
     $self->render(text => 'Hello world!');
   };

   app->start;

   __DATA__;

   @@ t/test.pl
   use Test::More;
   use Test::Mojo;

   use FindBin;
   $ENV{MOJO_HOME} = "$FindBin::Bin/../";
   require "$ENV{MOJO_HOME}/test-tests.pl";

   my $t = Test::Mojo->new;
   $t->get_ok('/')
     ->status_is(200)
     ->text_like('html body' => qr/Hello world/);;
   done_testing;

but it just says:

   > perl test-tests.pl Test
   Can't find test directory.

so I'm doing something wrong, or not understanding how to make this
work properly.

Thanks,
John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Stoffel  
View profile  
 More options Apr 26 2012, 10:17 pm
From: "John Stoffel" <j...@stoffel.org>
Date: Thu, 26 Apr 2012 22:17:59 -0400
Local: Thurs, Apr 26 2012 10:17 pm
Subject: Re: [Mojolicious] Testing Mojolicious::Lite apps

>>>>> "John" == John Stoffel <j...@stoffel.org> writes:

John>    __DATA__;

John>    @@ t/test.pl

Duh, I'm a moron.  I needs to be:

     @@ t/test.t

duh duh duh...  At least now it runs a test, even though I'm still
failing.  Baby steps... baby steps.  :]

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Stoffel  
View profile  
 More options Apr 27 2012, 9:32 am
From: "John Stoffel" <j...@stoffel.org>
Date: Fri, 27 Apr 2012 09:32:27 -0400
Local: Fri, Apr 27 2012 9:32 am
Subject: Re: [Mojolicious] Testing Mojolicious::Lite apps

>>>>> "John" == John Stoffel <j...@stoffel.org> writes:
>>>>> "John" == John Stoffel <j...@stoffel.org> writes:

John> __DATA__;

John> @@ t/test.pl

John> Duh, I'm a moron.  I needs to be:

John>      @@ t/test.t

John> duh duh duh...  At least now it runs a test, even though I'm still
John> failing.  Baby steps... baby steps.  :]

And I'm still a moron.  I had a t/test.t file still around in the same
directory as my test ::Lite app.  So it looks like while I can include
static files into Mojolicious::Lite apps, I can't include the test
stuff.  

That's ok I guess, I was just trying to get a clarification on how to
do tests properly, since I should move in that direction.

It's been pretty silent here, I must be very boring to read.  *grin*

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »