forked from Mirrors/privacore-open-source-search-engine
Better encapsulation of HttpRequest
This commit is contained in:
@ -103,6 +103,9 @@ class HttpRequest {
|
||||
int32_t getFileOffset () const { return m_fileOffset; }
|
||||
int32_t getFileSize () const { return m_fileSize; }
|
||||
|
||||
const char *getOrigUrlRequest() const { return m_origUrlRequest; }
|
||||
int32_t getOrigUrlRequestLen() const { return m_origUrlRequestLen; }
|
||||
|
||||
const char *getHost () const { return m_host; }
|
||||
int32_t getHostLen () const { return m_hostLen; }
|
||||
bool isLocal () const { return m_isLocal; }
|
||||
@ -167,6 +170,7 @@ class HttpRequest {
|
||||
return m_fieldLens[i];
|
||||
}
|
||||
|
||||
private:
|
||||
// . s is a cgi string
|
||||
// . either the stuff after the '?' in a url
|
||||
// . or the content in a POST operation
|
||||
@ -204,7 +208,7 @@ class HttpRequest {
|
||||
|
||||
// are we coming from a local machine?
|
||||
bool m_isLocal;
|
||||
|
||||
|
||||
// does the connecting machine have admin privledges?
|
||||
//bool m_isMasterAdmin;
|
||||
|
||||
|
@ -1472,8 +1472,8 @@ bool printSearchResultsTail ( State0 *st ) {
|
||||
// show banned results
|
||||
replaceParm2 ("sb=1",
|
||||
&newUrl,
|
||||
hr->m_origUrlRequest,
|
||||
hr->m_origUrlRequestLen );
|
||||
hr->getOrigUrlRequest(),
|
||||
hr->getOrigUrlRequestLen() );
|
||||
// no deduping by summary or content hash etc.
|
||||
StackBuf<> newUrl2;
|
||||
replaceParm2("dr=0",&newUrl2,newUrl.getBufStart(),
|
||||
@ -4916,8 +4916,8 @@ static bool printMenu ( SafeBuf *sb , int32_t menuNum , HttpRequest *hr ) {
|
||||
|
||||
MenuItem *first = NULL;
|
||||
|
||||
char *src = hr->m_origUrlRequest;
|
||||
int32_t srcLen = hr->m_origUrlRequestLen;
|
||||
const char *src = hr->getOrigUrlRequest();
|
||||
int32_t srcLen = hr->getOrigUrlRequestLen();
|
||||
|
||||
const char *frontTag = "";
|
||||
const char *backTag = "";
|
||||
@ -5107,8 +5107,8 @@ static bool printMenu ( SafeBuf *sb , int32_t menuNum , HttpRequest *hr ) {
|
||||
static bool replaceParm ( const char *cgi , SafeBuf *newUrl , HttpRequest *hr ) {
|
||||
if ( ! cgi[0] ) return true;
|
||||
// get original request url. this is not \0 terminated
|
||||
char *src = hr->m_origUrlRequest;
|
||||
int32_t srcLen = hr->m_origUrlRequestLen;
|
||||
const char *src = hr->getOrigUrlRequest();
|
||||
int32_t srcLen = hr->getOrigUrlRequestLen();
|
||||
return replaceParm2 ( cgi ,newUrl, src, srcLen );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user