Article View: borland.public.cppbuilder.internet.socket
Article #1202Re: WSAGetLastError return always 6
From: Eduardo Jauch
Date: Wed, 28 Feb 2007 01:21
Date: Wed, 28 Feb 2007 01:21
71 lines
4186 bytes
4186 bytes
Remy Lebeau (TeamB) escreveu: > Which is STILL the wrong thing to do!!! You are not even ensuring > that your char[] really is large enough to hold everything the server > may send to you, and at worse you are overallocating more memory than > you really need right now. I know that. > >> What I really do is search the first "<select " on the page. When I >> find it, I look for the second "<option " (if it exists) and so on > until >> I find the first "</select>" > > That is very error prone. Because of the nature of chunked transfers, > you are not even guaranteed to have such complete strings in your > buffer because you are not stripping out the chunked information > first. You could have "<sel"+chunk+"ect" and the like, which would > cause your searching algorithm to fail. You MUST handle chunked > transfers correctly in order to ensure the integrity of the data you > want to parse. I don't know how to make this any clearer to you. You're right. I forget the problem of the hex code of the chunk be inside the data. > >> This is why I do such horrible code... > > Your code is horrible not because of HOW UGLY it is to look at, but > because how INCOMPLETE it is to begin with. There are so many things > you are doing wrong with it that you are not guaranteed to end up with > the data that you are expecting. > I know that. >> And why I don't mind to read the chunked data etc... > > The presence of chunking is not an issue. Your handling of chunking, > on the other hand, is very much an issue. > I'm rewritting the code since yesterday to take care of many of the issues that you target. Including strip the chunk information of the data you pointed now. The code I show you on the beggining of the discussion was rewrite many times since them. >> And because the information that I want always come only >> with the last chunk, I don't bother with the rest. > > That is also not a guarantee, either. You really don't seem to be > grasping what HTTP is actually sending you. So you are going to keep > handling it all wrong. > >> sometimes the data that came is bigger than normal, and some of that >> come in the chunk right before the last. > > All the more reason why you NEED to handle chunking, and in fact any > HTTP transfer in general, properly from the very beginning. But you > are refusing to do that much. Obviously, you want a broken, > error-prone, dangerous implementation, so that is your choice. Sometimes, the broken, error-prone, dangerous implementation, even if it really fails from time to time, is a better choice than the opposite... > I'm done debating this discussion any further. > ok. Was a very instructive (yet may you don't believe) discussion to me. :) Thanks. :)
Technical Details
Message-ID:
<45e4d8f6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<45e24baa@newsgroups.borland.com> <45e31e54$1@newsgroups.borland.com> <45e34585$1@newsgroups.borland.com> <45e358b3$1@newsgroups.borland.com> <45e380bc@newsgroups.borland.com> <45e38fa2$1@newsgroups.borland.com> <45e3a6cf@newsgroups.borland.com> <45e3d748@newsgroups.borland.com> <45e4284e$1@newsgroups.borland.com> <45e47101$1@newsgroups.borland.com> <45e4a68c$1@newsgroups.borland.com> <45e4b0c8$1@newsgroups.borland.com> <45e4c107$1@newsgroups.borland.com> <45e4d0c0$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,ead06e5a7c488245 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 27 Feb 2007 22:21:53 -0300 From: Eduardo Jauch <eduardo.jauch@gmail.com> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: WSAGetLastError return always 6 References: <45e24baa@newsgroups.borland.com> <45e31e54$1@newsgroups.borland.com> <45e34585$1@newsgroups.borland.com> <45e358b3$1@newsgroups.borland.com> <45e380bc@newsgroups.borland.com> <45e38fa2$1@newsgroups.borland.com> <45e3a6cf@newsgroups.borland.com> <45e3d748@newsgroups.borland.com> <45e4284e$1@newsgroups.borland.com> <45e47101$1@newsgroups.borland.com> <45e4a68c$1@newsgroups.borland.com> <45e4b0c8$1@newsgroups.borland.com> <45e4c107$1@newsgroups.borland.com> <45e4d0c0$1@newsgroups.borland.com> In-Reply-To: <45e4d0c0$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 201.14.27.130 Message-ID: <45e4d8f6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172625654 201.14.27.130 (27 Feb 2007 17:20:54 -0800) Lines: 71 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail