🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4905

Re: TIdHTTP end of content problem

#4905
From: Remy Lebeau (TeamB)
Date: Mon, 06 Dec 2004 07:52
28 lines
2031 bytes
"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: <41b41051$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41b15c54$1@newsgroups.borland.com> <41b25214@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
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41b15c54$1@newsgroups.borland.com> <41b25214@newsgroups.borland.com>
Subject: Re: TIdHTTP end of content problem
Date: Sun, 5 Dec 2004 23:52:20 -0800
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <41b41051$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1102319697 68.69.17.41 (5 Dec 2004 23:54:57 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail