|
Baylys Just practicing to pass the Turing test. |
||||||||||||||||||
|
URL Encoding in ManilaThere's a systematic error in how urls are handled in Frontier/mainresponder/Manila. It only affects Mac servers where the urls contain special characters. RFC 1738 (which defines URLs) specify that urls must be url encoded form of the iso8859-1 encoded (latin-1) url. See this page for a discussion. Manila mostly doesn't consider this issue; manilaFixer scripts and macros do, especially the sitemenu macro. Until now they were not handling the issue correctly either. One sign of this was that urls with these characters displayed oddly in Mozilla. Fixing it is quite a job, but needs to be done as Manila acts inconsistently in some cases. Here's what I did to resolve this issue A) In manilaSuite.sitestructure.buildPathsTable, change the line local (path = currentPath + pathName) to
local (path);
case sys.OS() { «02/05/23, 18:10:40 by DAB
"MacOS" {
path = currentPath + string.urlencode(string.macToLatin(pathName))};
"Win95";
"WinNT" {
path = currentPath + string.urlencode(pathName)}}
B) A similar change is needed in manilaFixer.utilities.buildMultiPathsTable C) In manilaFixer.utilities.pathEncoder, change the line newPath = newPath + string.urlencode(string.nthField(path, "/", ix)) + "/" to
s = string.nthField(path, "/", ix);
if sys.OS() == "MacOS" { «02/05/26, 11:55:39 by DAB
s = string.macToLatin(s)}; «urls must be in iso8859-1
newPath = newPath + string.urlencode(s) + "/"
D) So now links in sitemenu will display properly, but Manila doesn't decode them correctly. This requires yet another patch In manilaSuite.hierarchyPage, after path = string.urlDecode (path); add
if sys.os() == "MacOS" { «02/05/26, 11:37:51 by DAB
path = string.latinToMac(path)}
E) Manila/mainresponder pass the value of referer from the page table in edit this page forms, ist is used to redirect the user to the edited page after a change is made. Since the url is placed in the form as the value of a hidden form element it must be iso8859 encoded. That assumes that it is in native Mac character set before being encoded, but the webserver does not ensure this or even url decode the referer url. A work-around is to create a new preFilter script at user.webserver.preFilters.fixupReferer
on fixupReferer (adrParamTable) {
«fixupReferer : 02/05/26, 06:01:26 by DAB
«Mozilla 1.0 bug?
if sys.os() == "MacOS" {
try {adrParamTable^.requestHeaders.referer = string.latinToMac(string.urlDecode(adrParamTable^.requestHeaders.referer))}}
else {
try {adrParamTable^.requestHeaders.referer = string.urlDecode(adrParamTable^.requestHeaders.referer)}};
return true}
|
|||||||||||||||||