forked from Mirrors/privacore-open-source-search-engine
More constness in HttpServer
This commit is contained in:
@ -128,15 +128,15 @@ bool HttpServer::getDoc ( char *url ,
|
||||
int16_t proxyPort,
|
||||
int32_t maxTextDocLen ,
|
||||
int32_t maxOtherDocLen ,
|
||||
char *userAgent ,
|
||||
const char *userAgent ,
|
||||
//bool respectDownloadLimit ,
|
||||
char *proto ,
|
||||
const char *proto ,
|
||||
bool doPost ,
|
||||
char *cookie ,
|
||||
char *additionalHeader ,
|
||||
char *fullRequest ,
|
||||
char *postContent ,
|
||||
char *proxyUsernamePwdAuth ) {
|
||||
const char *cookie ,
|
||||
const char *additionalHeader ,
|
||||
const char *fullRequest ,
|
||||
const char *postContent ,
|
||||
const char *proxyUsernamePwdAuth ) {
|
||||
// sanity
|
||||
if ( ip == -1 )
|
||||
log("http: you probably didn't mean to set ip=-1 did you? "
|
||||
@ -162,7 +162,7 @@ bool HttpServer::getDoc ( char *url ,
|
||||
// "fullRequest" and the url will be like "CONNECT foo.com:443 HTT..."
|
||||
// and it is an https url, because we only use the CONNECT cmd for
|
||||
// downloading https urls over a proxy i think
|
||||
char *p = fullRequest;
|
||||
const char *p = fullRequest;
|
||||
if ( p && strncmp(p,"CONNECT ",8)==0 )
|
||||
urlIsHttps = true;
|
||||
|
||||
@ -1174,9 +1174,9 @@ bool HttpServer::sendReply ( TcpSocket *s , HttpRequest *r , bool isAdmin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HttpServer::sendReply2 ( char *mime,
|
||||
bool HttpServer::sendReply2 ( const char *mime,
|
||||
int32_t mimeLen ,
|
||||
const char *content ,
|
||||
const char *content,
|
||||
int32_t contentLen ,
|
||||
TcpSocket *s ,
|
||||
bool alreadyCompressed ,
|
||||
@ -1352,13 +1352,13 @@ void cleanUp ( void *state , TcpSocket *s ) {
|
||||
delete (f);
|
||||
}
|
||||
|
||||
bool HttpServer::sendSuccessReply ( GigablastRequest *gr , char *addMsg ) {
|
||||
bool HttpServer::sendSuccessReply ( GigablastRequest *gr , const char *addMsg ) {
|
||||
return sendSuccessReply ( gr->m_socket ,
|
||||
gr->m_hr.getReplyFormat() ,
|
||||
addMsg );
|
||||
}
|
||||
|
||||
bool HttpServer::sendSuccessReply ( TcpSocket *s , char format, char *addMsg) {
|
||||
bool HttpServer::sendSuccessReply ( TcpSocket *s , char format, const char *addMsg) {
|
||||
// get time in secs since epoch
|
||||
time_t now ;
|
||||
if ( isClockInSync() ) now = getTimeGlobal();
|
||||
@ -1613,7 +1613,7 @@ bool HttpServer::sendQueryErrorReply( TcpSocket *s , int32_t error ,
|
||||
const char *errmsg,
|
||||
//int32_t rawFormat,
|
||||
char format ,
|
||||
int errnum, char *content) {
|
||||
int errnum, const char *content) {
|
||||
|
||||
// just use this for now. it detects the format already...
|
||||
log(LOG_ERROR,"%s:%s:%d: call sendErrorReply. %d [%s]", __FILE__, __func__, __LINE__, errnum, errmsg);
|
||||
@ -2296,7 +2296,7 @@ bool HttpServer::hasPermission ( int32_t ip , HttpRequest *r ,
|
||||
// . status should be 200 for all replies except POST which is 201
|
||||
bool HttpServer::sendDynamicPage ( TcpSocket *s, const char *page, int32_t pageLen, int32_t cacheTime,
|
||||
bool POSTReply, const char *contentType, int32_t httpStatus,
|
||||
char *cookie, char *charset, HttpRequest *hr) {
|
||||
const char *cookie, const char *charset, HttpRequest *hr) {
|
||||
// how big is the TOTAL page?
|
||||
int32_t contentLen = pageLen; // headerLen + pageLen + tailLen;
|
||||
// get the time for a mime
|
||||
|
30
HttpServer.h
30
HttpServer.h
@ -71,19 +71,19 @@ class HttpServer {
|
||||
int16_t proxyPort,
|
||||
int32_t maxTextDocLen ,
|
||||
int32_t maxOtherDocLen ,
|
||||
char *userAgent = NULL ,
|
||||
const char *userAgent = NULL ,
|
||||
// . say HTTP/1.1 instead of 1.0 so we can communicate
|
||||
// with room alert...
|
||||
// . we do not support 1.1 that is why you should always
|
||||
// use 1.0
|
||||
char *proto = DEFAULT_HTTP_PROTO , // "HTTP/1.0" ,
|
||||
const char *proto = DEFAULT_HTTP_PROTO , // "HTTP/1.0" ,
|
||||
bool doPost = false ,
|
||||
char *cookie = NULL ,
|
||||
char *additionalHeader = NULL , // does not include \r\n
|
||||
const char *cookie = NULL ,
|
||||
const char *additionalHeader = NULL , // does not include \r\n
|
||||
// specify your own mime and post data here...
|
||||
char *fullRequest = NULL ,
|
||||
char *postContent = NULL ,
|
||||
char *proxyUsernamePwdAuth = NULL );
|
||||
const char *fullRequest = NULL ,
|
||||
const char *postContent = NULL ,
|
||||
const char *proxyUsernamePwdAuth = NULL );
|
||||
|
||||
bool gotDoc ( int32_t n , TcpSocket *s );
|
||||
|
||||
@ -92,17 +92,17 @@ class HttpServer {
|
||||
void requestHandler ( TcpSocket *s );
|
||||
|
||||
// send an error reply, like "HTTP/1.1 404 Not Found"
|
||||
bool sendErrorReply ( TcpSocket *s , int32_t error , const char *errmsg ,
|
||||
bool sendErrorReply ( TcpSocket *s, int32_t error, const char *errmsg,
|
||||
int32_t *bytesSent = NULL );
|
||||
bool sendErrorReply ( class GigablastRequest *gr );
|
||||
// xml and json uses this
|
||||
bool sendSuccessReply ( class GigablastRequest *gr,char *addMsg=NULL);
|
||||
bool sendSuccessReply (TcpSocket *s , char format , char *addMsg=NULL);
|
||||
bool sendSuccessReply ( class GigablastRequest *gr, const char *addMsg=NULL);
|
||||
bool sendSuccessReply (TcpSocket *s, char format, const char *addMsg=NULL);
|
||||
// send a "prettier" error reply, formatted in XML if necessary
|
||||
bool sendQueryErrorReply ( TcpSocket *s , int32_t error , const char *errmsg,
|
||||
// FORMAT_HTML=0,FORMAT_XML,FORMAT_JSON
|
||||
char format, int errnum,
|
||||
char *content=NULL);
|
||||
const char *content=NULL);
|
||||
|
||||
|
||||
// these are for stopping annoying seo bots
|
||||
@ -125,8 +125,8 @@ class HttpServer {
|
||||
int32_t cacheTime = -1 , bool POSTReply = false ,
|
||||
const char *contentType = NULL,
|
||||
int32_t httpStatus = -1,
|
||||
char *cookie = NULL,
|
||||
char *charset = NULL ,
|
||||
const char *cookie = NULL,
|
||||
const char *charset = NULL ,
|
||||
HttpRequest *hr = NULL );
|
||||
|
||||
// for PageSockets
|
||||
@ -167,9 +167,9 @@ class HttpServer {
|
||||
// go ahead and start sending the file ("path") over the socket
|
||||
bool sendReply ( TcpSocket *s , HttpRequest *r , bool isAdmin);
|
||||
|
||||
bool sendReply2 ( char *mime,
|
||||
bool sendReply2 ( const char *mime,
|
||||
int32_t mimeLen ,
|
||||
const char *content ,
|
||||
const char *content,
|
||||
int32_t contentLen ,
|
||||
TcpSocket *s ,
|
||||
bool alreadyCompressed = false ,
|
||||
|
Reference in New Issue
Block a user