Yes, but to be clear, "over and over" really means "once per user session, 
if and only if the user starts at an http URL", not "once per request".

Regarding your original point, note that URL() generates neither "http" nor 
"https" URLs by default -- it generates relative URLs that start with "/". 
So, if you are on an http page, the browser will end up requesting an http 
URL. If you want to override this for a given link, you can do so by 
specifying the "scheme" argument to URL(). What else do you suggest?

If you want to be able to write a mix of http and https URLs but don't want 
to keep specifying the "scheme" argument, then use functools.partial to 
create your own special functions with the value of that argument set to 
"http" and "https".

Anthony

On Friday, May 23, 2014 10:25:37 AM UTC-4, Richard wrote:
>
> You don't follow my reflexion... I just say that if there were no relative 
> URL and the behaviour you describe... 60 ms over and over could have been a 
> great improvement...
>
> Thanks again for you answer Niphold.
>
> Richard
>
>
> On Fri, May 23, 2014 at 4:27 AM, Niphlod <niph...@gmail.com> wrote:
>
>> Again...... it's not over and over.......... it happens the only first 
>> request that comes in pointing to anything http(ish). Second, third, etc 
>> will point to https already.
>>
>>
>> On Thursday, May 22, 2014 3:08:01 PM UTC+2, Richard wrote:
>>
>>> Yeah you are right, I forget about relative URL, since I was trying to 
>>> create a link for an email sent by the app...
>>>
>>> Thanks for clarifying.
>>>
>>> 60 ms over and over could have been a great improvement overall if there 
>>> was no relative url though.
>>>
>>> :)
>>>
>>> Richard
>>>
>>>
>>> On Wed, May 21, 2014 at 4:35 PM, Niphlod <nip...@gmail.com> wrote:
>>>
>>>> URL() generates relative links by default. No http or https.......plain 
>>>> /app/controller/function links.
>>>> that being said, URL has scheme and host parameters that can generate 
>>>> absolute links.
>>>>
>>>> Back to the "performance" side. Usually the "redirection" from http to 
>>>> https is required at the very first access to the website, and is handled 
>>>> directly by the webserver that is usually in front of web2py. 
>>>> It takes generally 40 to 60 ms. 
>>>> If your app uses relative links always, once you get to the https 
>>>> "main" page, all links will point to https, without you worrying to pass 
>>>> host and scheme all the time (that can surely hurt your "page weight" on 
>>>> average, in addition to your tipings skills.) 
>>>> Just to put things in perspective, this means that you're worrying over 
>>>> 60 ms in the whole user experience of your app (even in a supersimple 
>>>> website, users should stay there at least a minute in the app ?!?). 
>>>>
>>>> You'd better waste sleep hours on something else :-P 
>>>>
>>>> BTW: it's all here http://web2py.com/books/default/chapter/29/04/the-
>>>> core#URL
>>>>
>>>>
>>>> On Wednesday, May 21, 2014 9:53:07 PM UTC+2, Richard wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I am searching a way to make URL() return an address with HTTP"S" 
>>>>> instead of plain HTTP. I didn't find a way to do that...
>>>>>
>>>>> There is :
>>>>>
>>>>> request.is_https
>>>>> request.requires_https()
>>>>>
>>>>> But they seem to be for preventing access to plain HTTP.
>>>>>
>>>>> So, that mean that URL() always redirect to HTTP and never to HTTPS... 
>>>>> That may reduce performance, I had read long time ago that reducing 
>>>>> redirection is "rule number 1" for improving loading speed...
>>>>>
>>>>> Maybe it could be a good idea to add a flag that let generate URL() 
>>>>> with HTTPS instead of only HTTP??
>>>>>
>>>>> Richard
>>>>>
>>>>>   -- 
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to web2py+un...@googlegroups.com.
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to