According to Joe R. Jah:
> On Fri, 15 Mar 2002, Gilles Detillieux wrote:
> > According to Joe R. Jah:
...
> > > And somehow turning the rest of the space into %20 in the code?
> >
> > OK, this is a little bit more effort, because now you're expanding a
> > single character into 3, so you can't do it in place. However, you
> > could probably change the first few lines of the URL constructor and
> > parse methods like this. First, change the "u" to "ref" in the parse
> > method for consistency. Then, instead of simply assigning ref to temp
> > as String temp(ref); and then removing white space characters, you can
> > do this:
>
> The above patch already allows in non-(leading/trailing) space. The code
> bellow would just convert the allowed space into %20. I believe the term
> allow_space_in_url would be more expressive as convert_space_to_%20, or
> something;)
No, the code below does two things: 1) if allow_space_in_url is not
set, the code works like the standard 3.1.x code does, i.e. in strips
out all white space characters, and 2) if allow_space_in_url is set,
the code strips out all white space characters other than the space
itself - for the space character (ASCII 20 hex) it strips leading and
trailing spaces and converts the spaces within the URL to %20. The name
allow_space_in_url is correct, because if the attribute is false,
no spaces are allowed - they're stripped out, just as the currently
released code does, in accordance with RFC 2396. However, if you prefer
encode_space_in_url we can go with that. We're not going to start putting
all sorts of wierd punctuation characters like "%" in attribute names.
> > 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++;
> > }
> >
> >
> > Then, you'll have to set allow_space_in_url: true in your htdig.conf
> > to enable this feature.
>
> At any case, I do not see the rationale behind this option. We do not
> give an option for allowing non-(leading/trailing) space, but we give one
> for converting them to %20;-/ Unless we somehow integrate your option,
> allow_space_in_url, in the entire patch;)
Maybe my description of the code above helps you see the rationale more
clearly. The attribute selects both behaviours, not just the encoding.
The reason to make it user-selectable option is that some users may
actually prefer htdig to follow the standards rather than ignore them
like MS/AOL do.
I'm not sure what you mean by integrating my option in the entire patch.
The code above should be complete on its own, as a change to vanilla
3.1.6 URL.cc code. You don't need to integrate it with earlier proposed
changes - just put it in both URL methods you were changing before and
make a patch out of it.
--
Gilles R. Detillieux E-mail: <[EMAIL PROTECTED]>
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
_______________________________________________
htdig-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/htdig-dev