more nyt.com bug fixes

This commit is contained in:
mwells
2014-08-07 10:26:30 -07:00
parent cc1ceaaac2
commit 5149f855af
4 changed files with 17 additions and 6 deletions

@ -326,7 +326,7 @@ bool HttpRequest::set (char *url,long offset,long size,time_t ifModifiedSince,
//log("captch: %s",m_buf);
}
if ( ! postData ) {
if ( ! doPost ) { // postData ) {
m_reqBuf.safePrintf("\r\n");
}

@ -271,7 +271,7 @@ bool Msg13::forwardRequest ( ) {
// we have to serialize it now because it has cookies as well as
// the url.
char *requestBuf = serializeMsg ( sizeof(Msg39Request),
char *requestBuf = serializeMsg ( sizeof(Msg13Request),
&r->size_url,
&r->size_cookie,
&r->ptr_url,
@ -468,6 +468,14 @@ void handleRequest13 ( UdpSlot *slot , long niceness ) {
Msg13Request *r = (Msg13Request *)slot->m_readBuf;
// use slot niceness
r->m_niceness = niceness;
// deserialize it now
deserializeMsg ( sizeof(Msg13),
&r->size_url,
&r->size_cookie,
&r->ptr_url,
r->m_buf );
// . sanity - otherwise xmldoc::set cores!
// . no! sometimes the niceness gets converted!
//if ( niceness == 0 ) { char *xx=NULL;*xx=0; }

@ -90,6 +90,9 @@ public:
long size_url;
long size_cookie;
// string buf for deserializeMsg() function
char m_buf[0];
long getSize() {
return ((char *)ptr_url-(char *)this) +size_url+size_cookie;};

@ -1362,15 +1362,15 @@ bool TcpServer::setTotalToRead ( TcpSocket *s ) {
if ( size > 0 ) s->m_totalToRead = size;
// if size is unknown ensure we have at least 10k of extra space
if ( size == -1 ) size = s->m_readOffset + 10*1024;
// . if it's smaller than our current buffer don't worry
// . we need to make sure to store a \0 at end of the read...
//if ( size <= s->m_readBufSize ) return true;
if ( size < s->m_readBufSize ) return true;
// adjust so we can include our \0 at the end of the m_readBuf
size += 1;
// and for the proxy ip!!
// (See HttpServer.cpp::sendDynamicPage())
size += 4;
// . if it's smaller than our current buffer don't worry
// . we need to make sure to store a \0 at end of the read...
//if ( size <= s->m_readBufSize ) return true;
if ( size < s->m_readBufSize ) return true;
// prepare for realloc if we're point to s->m_tmpBuf
//char *tmp = NULL;
char *newBuf = NULL;