|
From: Gilles D. <gr...@sc...> - 2002-03-16 00:36:13
|
According to Joe R. Jah:
> I misunderstood. Here is the patch:
> -------------------------------------8<-------------------------------------
> *** htlib/URL.cc.031202 Thu Feb 7 17:15:38 2002
> --- htlib/URL.cc Fri Mar 15 15:25:27 2002
> ***************
> *** 74,82 ****
> //
> URL::URL(char *ref, URL &parent)
> {
> ! String temp(ref);
> ! temp.remove(" \r\n\t");
> ! ref = temp;
Here's your error right here. You shouldn't have deleted that third
line, only the first two. The last one is needed because the constructor
then uses the ref pointer to walk through the cleaned up URL string.
You should set ref = temp; right after the close of the while loop
below.
>
> _host = parent._host;
> _port = parent._port;
> --- 74,97 ----
> //
> URL::URL(char *ref, URL &parent)
> {
> ! static int allowspace = config.Boolean("allow_space_in_url", 0);
> ! String temp;
> ! while (*ref)
> ! {
> ! if (*ref == ' ' && temp.length() > 0 && allowspace)
> ! {
> ! // Replace space character with %20 if there's more non-space
> ! // characters to come...
> ! char *s = ref+1;
> ! while (*s && isspace(*s))
> ! s++;
> ! if (*s)
> ! temp << "%20";
> ! }
> ! else if (!isspace(*ref))
> ! temp << *ref;
> ! ref++;
> ! }
You need...
ref = temp;
here, after the loop. Without it, ref is still pointing to the end of
the original URL, not the start of the cleaned up one, so the rest of
the code will think it got an empty string as a URL.
> _host = parent._host;
> _port = parent._port;
The second section, in URL::parse() looks fine to me, because in there,
there were only two lines that you removed at the start, and you left
the assignment of temp to nurl.
We'll make a programmer out of you yet, Joe. :-)
--
Gilles R. Detillieux E-mail: <gr...@sc...>
Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba Phone: (204)789-3766
Winnipeg, MB R3E 3J7 (Canada) Fax: (204)789-3930
|