You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2001/10/12 14:48:27 UTC
DO NOT REPLY [Bug 4121] New: -
BinHTTPUrlInputStream needds to read entire HTTP header ...
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4121>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4121
BinHTTPUrlInputStream needds to read entire HTTP header ...
Summary: BinHTTPUrlInputStream needds to read entire HTTP header
...
Product: Xerces-C++
Version: 1.5.1
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: Utilities
AssignedTo: xerces-c-dev@xml.apache.org
ReportedBy: john.clayton@barclayscapital.com
Before the constructor 'completes' the ctor, it *must* read the entire HTTP
header response from the socket. I noticed that *sometimes* this would not
occur, and then when the code managed to get into readBytes() it would return
information from the HTTP header. In my case, the made the scanDoc() method
fail as that is expecting to see some sort of DECL statment I think.
The patch is attached. It's not perfect for you - because I've also fixed up
two other bugs (one is already fixed in CVS here:
* $Log: BinHTTPURLInputStream.cpp,v $
* Revision 1.7 2001/09/04 17:52:57 peiyongz
* Bugzilla# 3170: patch from Kevin Philips to handle Query in XMLURL.
And another is tiny: the HTTP header does not separate the port and host with a
colon - simple!
The diff is attached :
59,61d58
< * Revision 1.7 2001/09/04 17:52:57 peiyongz
< * Bugzilla# 3170: patch from Kevin Philips to handle Query in XMLURL.
< *
109d105
< #include <util/Janitor.hpp>
110a107,108
> #include <util/Janitor.hpp>
> #include <crtdbg.h>
256d253
<
279a277
>
282d279
< ArrayJanitor<char> janBuf3(fragmentAsCharStar);
285,287c282
< char* queryAsCharStar = 0;
< if (query)
< queryAsCharStar = XMLString::transcode(query);
---
> char * queryAsCharStar = XMLString::transcode
(query);
289a285,286
> ArrayJanitor<char> janBuf3(fragmentAsCharStar);
>
337a335,336
> // Set a flag so we know that the headers have not been read yet.
> bool fHeaderRead = false;
342a342,344
>
> memset(fBuffer, 0, sizeof(fBuffer));
>
346c348
< if (queryAsCharStar != 0)
---
> if (fragmentAsCharStar != 0)
348,349c350
< fBuffer[strlen(fBuffer)] = chQuestion;
< strcat(fBuffer, queryAsCharStar);
---
> strcat(fBuffer, fragmentAsCharStar);
352c353
< if (fragmentAsCharStar != 0)
---
> if(queryAsCharStar != 0)
354c355,356
< strcat(fBuffer, fragmentAsCharStar);
---
> fBuffer[strlen(fBuffer)] = chQuestion;
> strcat(fBuffer, queryAsCharStar);
355a358
>
358d360
<
362a365
> strcat(fBuffer, ":");
378d380
<
381a384
> memset(fBuffer, 0, sizeof(fBuffer));
391a395,396
> do
> {
396a402
>
400a407,408
>
> fHeaderRead = true;
408a417,418
>
> fHeaderRead = true;
411c421,428
< fBufferPos = fBufferEnd;
---
> {
> //
> // Header is not yet read, do another recv() to
get more data...
> aLent = recv(s, fBufferEnd, (sizeof(fBuffer) -
1) - (fBufferEnd - fBuffer), 0);
> if (aLent == SOCKET_ERROR || aLent == 0)
> {
> // Call WSAGetLastError() to get the
error number.
> ThrowXML(NetAccessorException,
XMLExcepts::NetAcc_ReadSocket);
413a431,436
> fBufferEnd = fBufferEnd + aLent;
> *fBufferEnd = 0;
> }
> }
> } while(fHeaderRead == false);
>
448d470
<
481d502
<
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org