[svn] Quote '?' as '%3F' in local files when `--html-extension' is turned on.

Published in <sxszo4ztiwr.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2001-12-04 01:49:37 -08:00
parent 16b1387c7c
commit e986f7dad3
2 changed files with 20 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2001-12-04 Hrvoje Niksic <hniksic@arsdigita.com>
* url.c (local_quote_string): Reenable quoting of question marks,
but only when `--html-extension' is used.
2001-12-03 Hrvoje Niksic <hniksic@arsdigita.com> 2001-12-03 Hrvoje Niksic <hniksic@arsdigita.com>
* snprintf.c (dopr): Cast the result of va_arg to short int and * snprintf.c (dopr): Cast the result of va_arg to short int and

View File

@ -2097,32 +2097,27 @@ find_fragment (const char *beg, int size, const char **bp, const char **ep)
return 0; return 0;
} }
/* The idea here was to quote ? as %3F to avoid passing part of the /* Quote FILE for use as local reference to an HTML file.
file name as the parameter when browsing the converted file through
HTTP. However, actually doing that breaks local browsing because
"index.html%3Ffoo=bar" isn't even recognized as an HTML file!
Perhaps this should be controlled by an option, but for now I'm
leaving the question marks.
This is the original docstring of this function: We quote ? as %3F to avoid passing part of the file name as the
parameter when browsing the converted file through HTTP. However,
FILE should be a relative link to a local file. It should be it is safe to do this only when `--html-extension' is turned on.
quoted as HTML because it will be used in HTML context. However, This is because converting "index.html?foo=bar" to
we need to quote ? as %3F to avoid passing part of the file name as "index.html%3Ffoo=bar" would break local browsing, as the latter
the parameter. (This is not a problem when viewing locally, but is isn't even recognized as an HTML file! However, converting
if the downloaded and converted tree is served by an HTTP "index.html?foo=bar.html" to "index.html%3Ffoo=bar.html" should be
server.) */ safe for both local and HTTP-served browsing. */
/* Quote string as HTML. */
static char * static char *
local_quote_string (const char *file) local_quote_string (const char *file)
{ {
return html_quote_string (file);
#if 0
const char *file_sans_qmark; const char *file_sans_qmark;
int qm = count_char (file, '?'); int qm;
if (!opt.html_extension)
return html_quote_string (file);
qm = count_char (file, '?');
if (qm) if (qm)
{ {
@ -2154,7 +2149,6 @@ local_quote_string (const char *file)
file_sans_qmark = file; file_sans_qmark = file;
return html_quote_string (file_sans_qmark); return html_quote_string (file_sans_qmark);
#endif
} }
/* We're storing "modes" of type downloaded_file_t in the hash table. /* We're storing "modes" of type downloaded_file_t in the hash table.