Erlang Mailing Lists

Author Message

<  Yaws mailing list  ~  Host in #redir_self

Guest
Posted: Wed Dec 30, 2009 8:18 am Reply with quote
Guest
I'm curious why #redir_self.host returns a "host:port" value instead
of just host. Is there an easy way of getting just the host?

(It seems that "host:port" is already available via #headers.host.)

How is this?

diff --git a/src/yaws_api.erl b/src/yaws_api.erl
index 8dbf6eb..fd863ef 100644
--- a/src/yaws_api.erl
+++ b/src/yaws_api.erl
@@ -1952,7 +1952,11 @@ redirect_self(A) ->
{Port2, [$:|integer_to_list(Port2)]}
end,
H = A#arg.headers,
- Host = yaws:redirect_host(get(sc), H#headers.host),
+ Host = case string:tokens(yaws:redirect_host(get(sc),
+ H#headers.host), ":") of
+ [H0, _] -> H0;
+ [H1] -> H1
+ end,
{Scheme, SchemeStr} =
case {SC#sconf.ssl,SC#sconf.rmethod} of
{_, Method} when is_list(Method) ->

Andrei

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
Guest
Posted: Mon Jan 11, 2010 9:01 pm Reply with quote
Guest
Andrei Soroker wrote:
> I'm curious why #redir_self.host returns a "host:port" value instead
> of just host. Is there an easy way of getting just the host?
>
> (It seems that "host:port" is already available via #headers.host.)
>
> How is this?

This certainly looks like a bug - I don't like this type of
patches since it probably breaks peoples code - but in this case
it's obvious that this behaviour is not what was desired
initially - I'll apply and push your patch.

Thanks


/klacke

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum