« Return to Thread: identify running under ssl?

Re: identify running under ssl?

by Claes Wikström :: Rate this Message:

Reply to Author | View in Thread

John 'fess' Fessenden wrote:
> I want to make urls that point back to the current yaws server, which  
> need to be https://  if the current request was made via ssl, but  
> http otherwise.

Common situation,

>
> what's the best way to identify if the current request was made via  
> ssl.  my current strategy is to match to check if Arg#clisock matches  
> { sslsocket, _ , _ };  is that the best way?
>
> any other tips on generating self referential urls?   I'm going with  
> the the host header if available or falling back to the config'd  
> server name.
>

There is a lot of explicit support for this. Sorry for not
not documenting it in yaws_api man page - should be done.

There are 4 functions in the yaws.erl module that
can be used for this.

Take a look at yaws.erl - and the 4 redirect_XXX() functions.
They all ought to go into yaws_api and take an #arg{} as parameter
instead.


/klacke

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@...
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

 « Return to Thread: identify running under ssl?