mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 12:17:35 +03:00
expose "urlip" injection parm to provide ip of url
being injected to save gigablast from an ip lookup if you want.
This commit is contained in:
parent
f9c4f8fc9a
commit
bcdecc63c6
@ -75,6 +75,13 @@ void setInjectionRequestFromParms ( TcpSocket *sock ,
|
||||
int32_t def = atoll(m->m_def);
|
||||
*ii = (char)hr->getLong(m->m_cgi,def);
|
||||
}
|
||||
else if ( m->m_type == TYPE_IP ) {
|
||||
char *ii = (char *)((char *)ir + m->m_off);
|
||||
char *is = hr->getString(m->m_cgi,NULL);
|
||||
*(int32_t *)ii = 0; // default ip to 0
|
||||
// otherwise, set the ip
|
||||
if ( is ) *(int32_t *)ii = atoip(is);
|
||||
}
|
||||
// if unsupported let developer know
|
||||
else { char *xx=NULL;*xx=0; }
|
||||
}
|
||||
|
19
Parms.cpp
19
Parms.cpp
@ -15107,6 +15107,19 @@ void Parms::init ( ) {
|
||||
m->m_off = (char *)&ir.m_hopCount - (char *)&ir;
|
||||
m++;
|
||||
|
||||
m->m_title = "url IP";
|
||||
m->m_desc = "Use this IP when injecting the document. Do not use or "
|
||||
"set to 0.0.0.0, if unknown. If provided, it will save an IP "
|
||||
"lookup.";
|
||||
m->m_cgi = "urlip";
|
||||
m->m_obj = OBJ_IR;
|
||||
m->m_type = TYPE_IP;
|
||||
m->m_def = "0.0.0.0";
|
||||
m->m_flags = PF_API;
|
||||
m->m_page = PAGE_INJECT;
|
||||
m->m_off = (char *)&ir.m_injectDocIp - (char *)&ir;
|
||||
m++;
|
||||
|
||||
m->m_title = "last spider time";
|
||||
m->m_desc = "Override last time spidered";
|
||||
m->m_cgi = "lastspidered";
|
||||
@ -15213,7 +15226,10 @@ void Parms::init ( ) {
|
||||
"Separate MIME from actual content with two returns. "
|
||||
"At least put a single space in here if you want to "
|
||||
"inject empty content, otherwise the content will "
|
||||
"be downloaded from the url.";
|
||||
"be downloaded from the url. This is because the "
|
||||
"page injection form always submits the content text area "
|
||||
"even if it is empty, which should signify that the "
|
||||
"content should be downloaded.";
|
||||
m->m_cgi = "content";
|
||||
m->m_obj = OBJ_IR;
|
||||
m->m_type = TYPE_CHARPTR;
|
||||
@ -22490,6 +22506,7 @@ bool Parm::printVal ( SafeBuf *sb , collnum_t collnum , int32_t occNum ) {
|
||||
return sb->safePrintf("CMD");
|
||||
|
||||
if ( m_type == TYPE_IP )
|
||||
// may print 0.0.0.0
|
||||
return sb->safePrintf("%s",iptoa(*(int32_t *)val) );
|
||||
|
||||
log("parms: missing parm type!!");
|
||||
|
11
XmlDoc.cpp
11
XmlDoc.cpp
@ -1258,6 +1258,12 @@ bool XmlDoc::set4 ( SpiderRequest *sreq ,
|
||||
utf8Content = m_mime.getContent();
|
||||
}
|
||||
|
||||
// use this to avoid ip lookup if it is not zero
|
||||
if ( forcedIp ) {
|
||||
m_ip = forcedIp;
|
||||
m_ipValid = true;
|
||||
}
|
||||
|
||||
// sometimes they supply the content they want! like when zaks'
|
||||
// injects pages from PageInject.cpp
|
||||
if ( utf8Content ) {
|
||||
@ -1290,11 +1296,6 @@ bool XmlDoc::set4 ( SpiderRequest *sreq ,
|
||||
// use this ip as well for now to avoid ip lookup
|
||||
//m_ip = atoip("127.0.0.1");
|
||||
//m_ipValid = true;
|
||||
// use this to avoid ip lookup if it is not zero
|
||||
if ( forcedIp ) {
|
||||
m_ip = forcedIp;
|
||||
m_ipValid = true;
|
||||
}
|
||||
// do not need robots.txt then
|
||||
m_isAllowed = true;
|
||||
m_isAllowedValid = true;
|
||||
|
Loading…
Reference in New Issue
Block a user