From: SourceForge.net <no...@so...> - 2005-02-21 09:28:21
|
Bugs item #1145277, was opened at 2005-02-21 02:28 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719006&aid=1145277&group_id=130646 Category: None Group: Current Status: Open Resolution: None Priority: 6 Submitted By: Stephen Deasey (sdeasey) Assigned to: Stephen Deasey (sdeasey) Summary: Encoding URL path and query components Initial Comment: The current code follows (mostly) the rules for encoding/decoding segments of a URL query component. But the rules for segments of the path component are different, and there is no code to handle this. One of those differences is the treatment of + characters. In the query component this should be decoded into an ASCII space. In the path component however it should be treated literaly. The end result is that clients which correctly request the file /some+file are dissapointed with a 404 error. This patch deprecates the old C API and introduces the following new routines: Tcl_Encoding Ns_GetUrlEncoding(char *charset); char *Ns_UrlPathEncode(Ns_DString *, char *, Tcl_Encoding); char *Ns_UrlPathDecode(Ns_DString *, char *, Tcl_Encoding); char *Ns_UrlQueryEncode(Ns_DString *, char *, Tcl_Encoding); char *Ns_UrlQueryDecode(Ns_DString *, char *, Tcl_Encoding); request.c is modified to call Ns_UrlPathDecode() and form.c is modified to call Ns_UrlQueryDecode(). The updated Tcl commands look like this: ns_urldecode ?-part path|query? ?--? segment ns_urlencode ?-part path|query? ?--? segment ?segment ...? If the URL component part is not specified, the default is 'query'. Multiple segments will be joined with / or & when encoding. The '-charset' switch has been dropped, it seems broken considering Tcl's use of UTF8 encoded strings internaly. I added a set of tests to exercise the Tcl commands. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719006&aid=1145277&group_id=130646 |