mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-15 02:36:08 -04:00
fix a couple different cores.
This commit is contained in:
@ -136,7 +136,7 @@ bool HttpServer::getDoc ( char *url ,
|
||||
long defPort = 80;
|
||||
// check for a secured site
|
||||
TcpServer *tcp = &m_tcp;
|
||||
if ( strncasecmp(url, "https://", 8) == 0 ) {
|
||||
if ( url && strncasecmp(url, "https://", 8) == 0 ) {
|
||||
if (!m_ssltcp.m_ready) {
|
||||
// TODO: set an error here
|
||||
log("https: Trying to get HTTPS site when SSL "
|
||||
|
@ -20,6 +20,10 @@ void Msg3a::constructor ( ) {
|
||||
m_finalBuf = NULL;
|
||||
m_docsToGet = 0;
|
||||
m_numDocIds = 0;
|
||||
|
||||
// need to call all safebuf constructors now to set m_label
|
||||
m_rbuf2.constructor();
|
||||
|
||||
// NULLify all the reply buffer ptrs
|
||||
for ( long j = 0; j < MAX_INDEXDB_SPLIT; j++ )
|
||||
m_reply[j] = NULL;
|
||||
|
11
Process.cpp
11
Process.cpp
@ -2265,14 +2265,17 @@ void Process::checkFanSwitch ( ) {
|
||||
|
||||
if ( m_desiredFanState )
|
||||
// this turns it on
|
||||
urlBuf.safePrintf("http://10.5.0.10/outlet.cgi?outlet=1&"
|
||||
if ( !urlBuf.safePrintf("http://10.5.0.10/outlet.cgi?outlet=1&"
|
||||
"command=1&time=%li",
|
||||
getTimeGlobal());
|
||||
getTimeGlobal()) )
|
||||
return;
|
||||
else
|
||||
// this turns it off
|
||||
urlBuf.safePrintf("http://10.5.0.10/outlet.cgi?outlet=1&"
|
||||
if ( !urlBuf.safePrintf("http://10.5.0.10/outlet.cgi?outlet=1&"
|
||||
"command=0&time=%li",
|
||||
getTimeGlobal());
|
||||
getTimeGlobal()) )
|
||||
return;
|
||||
|
||||
// . make a cookie with the login info
|
||||
// . on chrome open the console and click "Network" tab
|
||||
// to view the http network requests and replies
|
||||
|
@ -33,6 +33,14 @@ SafeBuf::SafeBuf(long initSize, char *label ) {
|
||||
m_encoding = csUTF8;
|
||||
}
|
||||
|
||||
void SafeBuf::constructor ( ) {
|
||||
m_capacity = 0;
|
||||
m_length = 0;
|
||||
m_buf = NULL;
|
||||
m_usingStack = false;
|
||||
m_encoding = csUTF8;
|
||||
m_label = NULL;
|
||||
}
|
||||
|
||||
SafeBuf::SafeBuf() {
|
||||
m_capacity = 0;
|
||||
|
@ -9,6 +9,9 @@ struct SafeBuf {
|
||||
//*TRUCTORS
|
||||
SafeBuf();
|
||||
SafeBuf(long initSize, char *label = NULL);
|
||||
|
||||
void constructor();
|
||||
|
||||
//be careful with passing in a stackBuf! it could go out
|
||||
//of scope independently of the safebuf.
|
||||
SafeBuf(char* stackBuf, long cap);
|
||||
|
@ -1657,7 +1657,32 @@ connected:
|
||||
void TcpServer::destroySocket ( TcpSocket *s ) {
|
||||
if ( ! s ) return ;
|
||||
// sanity check
|
||||
if ( s->m_udpSlot ) { char *xx=NULL;*xx = 0; }
|
||||
if ( s->m_udpSlot ) {
|
||||
log("tcp: sending back error on udp slot err=%s",
|
||||
mstrerror(g_errno));
|
||||
//char *sendBuf = "Error. destroying sock.";
|
||||
//long sendBufUsed = gbstrlen(sendBuf);
|
||||
long timeout = 30*1000;
|
||||
// sen back the error i guess
|
||||
g_udpServer.sendReply_ass ( NULL,//sendBuf ,
|
||||
0,//sendBufUsed ,
|
||||
NULL,//sendBuf ,
|
||||
0,//sendBufSize ,
|
||||
s->m_udpSlot ,
|
||||
timeout , // timeout?
|
||||
NULL,//state ,
|
||||
NULL );// callback
|
||||
// we now free the read buffer here since PageDirectory.cpp
|
||||
// might have reallocated it.
|
||||
if ( s->m_readBuf )
|
||||
mfree (s->m_readBuf, s->m_readBufSize,"TcpUdp");
|
||||
// free it! we allocated in HttpServer.cpp handleRequestfd()
|
||||
mfree ( s , sizeof(TcpSocket) , "tcpudp" );
|
||||
// assume did not block
|
||||
return;
|
||||
//char *xx=NULL;*xx = 0; }
|
||||
}
|
||||
|
||||
// . you cannot destroy socket's who have called a handler and the
|
||||
// handler is still in progress, because when he's got a reply ready
|
||||
// he expects this TcpSocket to still be there
|
||||
|
Reference in New Issue
Block a user