Frans, As I mentioned before, replacing spaces will still leave you open to other invalid characters. If you want a quick fix for your current problem, then I suggest URL-encoding the entire URL instead of just the the spaces. Its been a while since I've used HttpCli, so I'm not sure if it provides one, but creating a URL encoding function is not that hard (its basically turning every invalid character into a code of the form %XX where XX represents the ASCII code for character in Hex), contact me privately if you need help with it.
As a long term solution, if Francois really wants to replicate browsers' behavior, then the URL must be URL-encoded at the latest moment when the request is being constructed to cover all possible capture points. Notice that this will involve a 2 step process: URL-decode and then URL-encode, to compensate for strings that have already been encoded by the application externally. -dZ. >------- Original Message ------- >From : Frans van Daalen[mailto:[EMAIL PROTECTED] >Sent : 4/19/2007 6:54:57 AM >To : twsocket@elists.org >Cc : >Subject : RE: Re: [twsocket] httpcli v6 "bad request" > >> > In my Ethereal dump the location-header of the 301-response already has > the space, so the server simply tries to redirect to an invalid URL, do > we really have to workaround such invalid URLs in the THttpCli? > With followRelocation := True this URL will generate a 400 on ThttpCli with absolutly no option to solve it except with a more or less illegal httpClient.FPath := stringreplace(httpclient.fpath,' ','%20',[rfreplaceall]); IE, Opera and possible other browser however will not generate a 400. I have no control over servers that generate a more or less invalid URL and it its hard to explain to any user why such a url is oke with IE etc and not with any ICS based product. As a reminder a quote from Francois in another posting " I remember long time ago we discussed this topic (post changed to get after relocation) and we concluded that it must be done so because most browser do not follow the standard and not doing like the browser will result in failure. That is probably how a bug in a well known browser become a de-facto standard ! Like it or not, if you don't do the same, your program will be accused of malfunction even if it perfectly follow the standard. " And to add to this: I needed more then a few days before finally finding this one, it's onyl one single space that caused this :-) -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be