Article View: borland.public.cppbuilder.internet.socket
Article #4911Re: TIdHTTP end of content problem
From: Ted Tripp
Date: Tue, 07 Dec 2004 02:54
Date: Tue, 07 Dec 2004 02:54
51 lines
2936 bytes
2936 bytes
You're right--not a bug in my code--I don't care that far into the HTML string--just a bug in your code if you use my code...:) <<Also, you could do away with the loop altogether by just using StringReplace()>> Yeah, probably could. Assuming you are right , my misunderstanding. I would have thought the StringReplace would stop at the 0 since I would think stringreplace would identify the same end as my object inspector. Apparently not true though. I think what was confusing me is the way the object inspector was showing the string--it will stop at the 0. Anyway--cool--but no kudos for identifying a problem (significant to me anyway) and hacking my through it?:) "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:41b41051$1@newsgroups.borland.com... > > "Ted Tripp" <ttripp@rankexec.com> wrote in message > news:41b25214@newsgroups.borland.com... > >> OK--my solution--roughly > > There is a bug in that code - you are ignoring the AnsiString's last > character when checking for '\0' characters. Your loop should be using > the > '<=' operator instead of '<'. > > Also, you could do away with the loop altogether by just using > StringReplace() instead of looping manually. > >> Oddly, the asBigString.Length() reported an accurate size > > As well it should. The string returned by TIdHTTP will contains all of > the > transmitted characters, regardless of what they actually are. The actual > characters are irrelevant to the transmission, they are stored in the > AnsiString as-is. > >> Not sure why it would truncate the string and then report it a >> size well past what it considered the end of the string. > > The only way that can happen is if your own code is treating the > AnsiString > content as a null-terminated C string rather than a true AnsiString. > > > Gambit > > >
Technical Details
Message-ID:
<41b51b50@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!news.moat.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<41b15c54$1@newsgroups.borland.com> <41b25214@newsgroups.borland.com> <41b41051$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,6b94060483c79e05 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Ted Tripp" <ttripp@rankexec.com> From: "Ted Tripp" <ttripp@rankexec.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <41b15c54$1@newsgroups.borland.com> <41b25214@newsgroups.borland.com> <41b41051$1@newsgroups.borland.com> Subject: Re: TIdHTTP end of content problem Date: Mon, 6 Dec 2004 20:54:07 -0600 Lines: 53 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 216.160.57.213 Message-ID: <41b51b50@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1102388048 216.160.57.213 (6 Dec 2004 18:54:08 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!news.moat.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail