Add files via upload
This commit is contained in:
parent
2606f671b1
commit
4ace1fbbea
3 changed files with 15 additions and 11 deletions
4
c/cr.c
4
c/cr.c
|
@ -247,8 +247,8 @@ int main(int argc, char **argv)
|
|||
int prefixsize = httpswww+httpwww+https+http;
|
||||
char urlnoprefix[urlsize-prefixsize+1];
|
||||
char urlnopathnoprefix[urlsize-prefixsize+1];
|
||||
memset(urlnoprefix,0,urlsize-prefixsize+2);
|
||||
memset(urlnopathnoprefix,0,urlsize-prefixsize+2);
|
||||
memset(urlnoprefix,0,urlsize-prefixsize+1);
|
||||
memset(urlnopathnoprefix,0,urlsize-prefixsize+1);
|
||||
int urlcount=0,urlnoprefixcount=0,urlnopathnoprefix_done=0;
|
||||
|
||||
//store the url without prefix to urlnoprefix
|
||||
|
|
|
@ -311,7 +311,7 @@ void htmlparse(){
|
|||
if(urlFound == 0 && urlTagFound == 0 && incomment == 0 && instyle == 0 && inscript == 0 && inlink == 0 && locateInWindow(windowWithSpaces,"<a ","<A ",3)==1){//sometimes there is something between "<a" and "href"
|
||||
urlTagFound = 1;
|
||||
}
|
||||
if(urlFound == 0 && incomment == 0 && instyle == 0 && inscript == 0 && inlink == 0 && (locateInWindow(window,"ahref=","AHREF=",6)==1) || (urlTagFound == 1 && locateInWindow(window,"href=","HREF=",5)==1)){
|
||||
if(urlFound == 0 && incomment == 0 && instyle == 0 && inscript == 0 && inlink == 0 && (locateInWindow(window,"ahref=","AHREF=",6)==1 || (urlTagFound == 1 && locateInWindow(window,"href=","HREF=",5)==1))){
|
||||
urlFound = 1;
|
||||
}
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ int locateInURL(char *url, char *birdLower, char *birdUpper, int length, int url
|
|||
long start = urlSize-length;
|
||||
if(urlSize >= length){
|
||||
for(int i=0;i<length;i++){
|
||||
if(url[start] != birdLower[i] && window[start] != birdUpper[i]){
|
||||
if(url[start] != birdLower[i] && url[start] != birdUpper[i]){
|
||||
return 0;
|
||||
}
|
||||
start++;
|
||||
|
|
18
c/urlparse.h
18
c/urlparse.h
|
@ -141,7 +141,7 @@ void urlparse(char* url){
|
|||
}
|
||||
|
||||
//check for file extension like html/htm/txt if no prefix in url
|
||||
if(noprebutisdomain==1 && urlsize>4){
|
||||
if(noprebutisdomain==1 && strlen(urlnopathnoprefix_fromlist)>4){
|
||||
if(checkDomain(urlnopathnoprefix_fromlist,".html",".HTML",urlnopathnoprefix_len,5)==1 || checkDomain(urlnopathnoprefix_fromlist,".htm",".HTM",urlnopathnoprefix_len,4)==1 || checkDomain(urlnopathnoprefix_fromlist,".txt",".txt",urlnopathnoprefix_len,4)==1 || checkDomain(urlnopathnoprefix_fromlist,".php",".PHP",urlnopathnoprefix_len,4)==1 || checkDomain(urlnopathnoprefix_fromlist,".shtml",".SHTML",urlnopathnoprefix_len,6)==1 || checkDomain(urlnopathnoprefix_fromlist,".xhtml",".XHTML",urlnopathnoprefix_len,6)==1 || checkDomain(urlnopathnoprefix_fromlist,".cgi",".CGI",urlnopathnoprefix_len,4)==1){
|
||||
memset(domain,0,1000);
|
||||
memset(urlnoprefix_fromlist,0,1000);
|
||||
|
@ -286,11 +286,15 @@ void urlparse(char* url){
|
|||
|
||||
int checkDomain(char *domain, char *substrLower, char *substrUpper, int domainLen, int substrLen){
|
||||
int j=0;
|
||||
for(int i=domainLen-substrLen;i<domainLen;i++){
|
||||
if(domain[i]!=substrLower[j] && domain[i]!=substrUpper[j]){
|
||||
return 0;
|
||||
if(domainLen>=substrLen){
|
||||
for(int i=domainLen-substrLen;i<domainLen;i++){
|
||||
if(domain[i]!=substrLower[j] && domain[i]!=substrUpper[j]){
|
||||
return 0;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue