Hi,

On Wed, Mar 2, 2011 at 3:55 PM, Florian Ragwitz <r...@debian.org> wrote:
> Pedro Melo <m...@simplicidade.org> writes:
>
>> On Wed, Mar 2, 2011 at 3:27 PM, Florian Ragwitz <r...@debian.org> wrote:
>>
>>> I'm not sure if this change of behaviour is something we should fix
>>> though. The engine knows that a request is secure by checking
>>> psgi.url_scheme, and applications can ask for that using
>>> $ctx->request->secure. Similarly, the request host was, is, and probably
>>> always will be available as $ctx->request->host.
>>
>> Right now I don't need https/secure, but I do need the host.
>>
>> At first I assumed that something like $ctx->request->host would be
>> available but its not:
>>
>> [error] Caught exception in E5::Sites::Gestao::View::HTML->process
>> "Can't locate object method "host" via package "Catalyst::Request"
>
> Sorry, I meant to say $ctx->request->uri->host

Ahs, cool, that works fine for me. Should have though of that.


>>> Did these changes actually cause your app to break? If so, what
>>> exactly does the code that broke look like?
>>
>> Yes, it did because the app switched template paths based on the
>> hostname used to access the app.
>>
>> The code I was using was:
>>
>> my $host = $c->request->headers->header('Host');
>> $host =~ s/:\d+$//;
>
> I guess pretty much every webserver will set a Host header, so we should
> probably do that as well in Plack::Test::MockHTTP, or at least in
> Catalyst::Test::local_request only for back-compat. I'll see what Plack
> upstream thinks about doing this in ::MockHTTP.

Cool. I'll be using $c->request->uri->host for now, although
$c->request->host as a shortcut would be nice :)

Bye,
-- 
Pedro Melo
http://www.simplicidade.org/
xmpp:m...@simplicidade.org
mailto:m...@simplicidade.org

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to