Page 1 of 1

https or not https

Posted: Wed Aug 01, 2007 9:03 pm
by Boris
I just discovered, that "my" sitemap-plugin does use https-Links all over the file if I edit entries via HTTPS.
I have turned on Hostname-Autosensing, because otherwise the CSS-file is not found and the admin-panel looks quite ugly.

Is there any way to circumvent this behaviour? I added a quick hack to my local copy, but it would be nice to have a cleaner solution, so that I don't have to fork my only plugin locally :-)

Re: https or not https

Posted: Sat Aug 04, 2007 12:54 pm
by garvinhicking
Hi!

Actually no - when you access your blog with a HTTPS URL, serendipity needs to change all $serendipity['baseURL'] references to HTTPS, thus making all variables point to https.

In your case I believe the really best way is to fetch the 'BaseURL' directive frmo the serendipity_config database table instead of using $serendipity['baseURL'] immediately.

Best regards,
Garvin

Posted: Sat Aug 04, 2007 1:42 pm
by Boris
Ok, I'll do it that way then. Thanks.


But I think there's one bug within the configuration, when I do these steps:

* Admin-Panel (opened with http or https) -> Path-configuration -> set url to "http://example.com/" -> save
* check in the mysql-table -> "http://example.com" -> ok
* Admin-Panel (opened with https) -> Path-configuration -> url is now https://example.com:443/ and would be saved if you don't change it.

It looks like the configuration uses $serendipity['baseURL'] too.

Posted: Sat Aug 04, 2007 1:57 pm
by Boris
:( Another issue: The plugin does not use $serendipity['baseURL'] directly that much, but functions like serendipity_archiveURL or serendipity_rewriteURL.

A good solution would be to do

Code: Select all

preg_replace("#^{$serendipity['baseURL']}#", fetch_baseURL_from_db_blackbox(), $url)
wouldn't it? I don't see any drawbacks with this one.

Posted: Sat Aug 04, 2007 2:45 pm
by garvinhicking
Hi!

Hm, you're right. This is pretty hard, because usually having 'baseURL' set as your current URL when autodetection is on is really the proper way to go. I don't really have any good idea about this right now.

Code: Select all

preg_replace("#^{$serendipity['baseURL']}#", fetch_baseURL_from_db_blackbox(), $url)
This would work, even though it's a bit "nasty" with those regexps. One alternative would be to use

Code: Select all

function blabla()
$old_url = $serendipity['baseURL'];
$serendipity['baseURL'] = fetch_from_db();
... do tasks...
$serendipity['baseURL'] = $old_url;
This way you wouldn't need to perform so many string replacements, because you change the global variable to what you currently "need"...?

REgards,
Garvin

Posted: Sat Aug 04, 2007 2:54 pm
by garvinhicking
Hi!

Hm, you're right. This is pretty hard, because usually having 'baseURL' set as your current URL when autodetection is on is really the proper way to go. I don't really have any good idea about this right now.

Code: Select all

preg_replace("#^{$serendipity['baseURL']}#", fetch_baseURL_from_db_blackbox(), $url)
This would work, even though it's a bit "nasty" with those regexps. One alternative would be to use

Code: Select all

function blabla()
$old_url = $serendipity['baseURL'];
$serendipity['baseURL'] = fetch_from_db();
... do tasks...
$serendipity['baseURL'] = $old_url;
This way you wouldn't need to perform so many string replacements, because you change the global variable to what you currently "need"...?

REgards,
Garvin

Posted: Sat Aug 04, 2007 4:54 pm
by Boris
I did it your way now.

This only leaves the issue described earlier.

Posted: Sat Aug 04, 2007 8:49 pm
by garvinhicking
Hi!

Yes, but if you change $serendipity['baseURL'] before you use serendipity_archiveURL and other functions, that issue is fixed as well?

Regards,
Garvin

Posted: Sun Aug 05, 2007 2:03 pm
by Boris
Sorry, that was the wrong link. :oops:

I did mean this issue in the configuration.

Posted: Mon Aug 06, 2007 11:05 am
by garvinhicking
Hi!

Yes, that's true, the admin will have to ensure that the right link is added there. Technically it would mean a fundamental change in the configuration routine to make it differently. It would be nice to do that somewhen in the future, but currrently it's not IMHO such a pressing issue :)

Best regards,
Garvin

Posted: Wed Aug 08, 2007 7:30 pm
by Boris
garvinhicking wrote:It would be nice to do that somewhen in the future, but currrently it's not IMHO such a pressing issue :)
I trust you, that you're right :-)

I rarely change my config, but if I do I'll forget to change it back. I guess a cronjob would be good for me.