This is what I thought "could" have been done and was wondering why it has not?

It would make sens that this type of utility function would come in very handy;

Today many sites use a mix of http and https; while I know that web2py could not force out of a particular scheme the links could at least be written so that you can switch between the two rather easily;

for example on login; you would probably always want that using https




On 2/8/11 3:59 PM, Jonathan Lundell wrote:
On Feb 8, 2011, at 12:24 PM, David J. wrote:
Thanks Jonathan;

This works too;
Good.

This *could* be an option to URL, since it has internal access to request. 
Suppose we added arguments URL(..., secure=None, host=None).

This case would mean the current behavior. Secure could be True or False for 
https/http. Host could be a string.

Specifying just a host would mean: use scheme from request.env.

Specifying just secure True/False would mean: use host from request.env.

The host&  scheme would be prepended after all rewriting.

Thanks;


On 2/8/11 3:11 PM, Jonathan Lundell wrote:
On Feb 8, 2011, at 11:41 AM, David J. wrote:
Well than maybe someone could inform them; ;)

It would be useful; My current work around is to make the whole site secure 
cringe;
If you know that the host info is valid, you could write:

        'https://%s%s' % (request.env.http_host, URL("function"))

web2py has no guarantee of knowing the host name; that depends on how it's 
deployed (consider the case of a proxy).

On 2/8/11 2:36 PM, Massimo Di Pierro wrote:
Because the URL function does not know the "https://example.com";. Only
the web server knows it.

We do have a URL(,sign=....) option to digitally sign URLs.

On Feb 8, 12:58 pm, "David J."<[email protected]>    wrote:
I was wondering why URL does not include a secure flag?

I think it should be able to set "secure" url's

For example if you do URL("function",secure=True)

We generate a complete URL

https://example.com/welcome/default/function




Reply via email to