Alterserv

RaptorCache => Plugins para RaptorCache => Mensaje publicado por: nqm74 en Octubre 23, 2013, 04:11:42 PM

Título: Plugins cadivi.gob.ve | seniat.gob.ve | inces.gob.ve
Publicado por: nqm74 en Octubre 23, 2013, 04:11:42 PM
Buenas amigo firecold espero te encuentres bien hermano, queria solicitar su gran ayuda para la creación de 3 plugin o si algún compañero del foro que los tenga en producción y los pueda compartir.. saludos a todos... espero por su pronta ayuda..

http://www.cadivi.gob.ve/
http://www.seniat.gob.ve/
http://www.inces.gob.ve/
Título: Re:Ayuda, con 3 Plugin..
Publicado por: JoseM14 en Octubre 23, 2013, 06:10:42 PM
Buenas Amigo Aqui Acabo De Hacerte 2 de los plugins probado y cacheando

#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o seniat.gob.ve.so seniat.gob.ve.cpp
// regex
// http.*\.seniat\.gob\.ve.*(\.gif|\.jpg|\.png|\.swf)

string get_filename(string url) {
        vector<string> resultado;
        if (url.find("?") != string::npos) {
            stringexplode(url, "?", &resultado);
            stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
            return resultado.at(resultado.size()-1);           
        } else {
            stringexplode(url, "/", &resultado);
            return resultado.at(resultado.size()-1);
        }
}

extern "C" resposta getmatch(const string url) {
    resposta r;   

if ( (url.find(".seniat.gob.ve") != string::npos)
   ) {
     
       r.file = get_filename(url);
      if (!r.file.empty()) {
         r.match = true;         
         r.domain = "seniat";
      } else {
         r.match = false;
      }
   } else {
      r.match = false;
   }
   return r;
}


#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o cadivi.gob.ve.so cadivi.gob.ve.cpp
// regex
// http.*\.cadivi\.gob\.ve.*(\.jpg|\.png|\.gif)

string get_filename(string url) {
      vector<string> resultado;
      if (url.find("?") != string::npos) {
         stringexplode(url, "?", &resultado);
         stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
         return resultado.at(resultado.size()-1);           
      } else {
         stringexplode(url, "/", &resultado);
         return resultado.at(resultado.size()-1);
      }
}

extern "C" resposta getmatch(const string url) {
    resposta r;   

if ( (url.find(".cadivi.gob.ve/") != string::npos) and ((url.find(".jpg") != string::npos) or (url.find(".png") != string::npos) or (url.find(".gif") != string::npos))
) {

       r.file = get_filename(url);
      if (!r.file.empty()) {
         r.match = true;
         r.domain = "Cadivi";
      } else {
         r.match = false;
      }
   } else {
      r.match = false;
   }
   return r;
}


el del ince no lo probe pero dime si te cachea

#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o inces.gob.ve.so inces.gob.ve.cpp
// regex
// http.*\.inces\.gob\.ve.*(\.jpg|\.png|\.gif)

string get_filename(string url) {
      vector<string> resultado;
      if (url.find("?") != string::npos) {
         stringexplode(url, "?", &resultado);
         stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
         return resultado.at(resultado.size()-1);           
      } else {
         stringexplode(url, "/", &resultado);
         return resultado.at(resultado.size()-1);
      }
}

extern "C" resposta getmatch(const string url) {
    resposta r;   

if ( (url.find(".inces.gob.ve/") != string::npos) and ((url.find(".jpg") != string::npos) or (url.find(".png") != string::npos) or (url.find(".gif") != string::npos))
) {

       r.file = get_filename(url);
      if (!r.file.empty()) {
         r.match = true;
         r.domain = "inces";
      } else {
         r.match = false;
      }
   } else {
      r.match = false;
   }
   return r;
}


Comenta Si te Funcionaron Saludos :)
Título: Re:Ayuda, con 3 Plugin..
Publicado por: firecold en Octubre 23, 2013, 07:27:42 PM
Cita de: JoseM14 en Octubre 23, 2013, 06:10:42 PM
Buenas Amigo Aqui Acabo De Hacerte 2 de los plugins probado y cacheando

#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o seniat.gob.ve.so seniat.gob.ve.cpp
// regex
// http.*\.seniat\.gob\.ve.*(\.gif|\.jpg|\.png|\.swf)

string get_filename(string url) {
        vector<string> resultado;
        if (url.find("?") != string::npos) {
            stringexplode(url, "?", &resultado);
            stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
            return resultado.at(resultado.size()-1);           
        } else {
            stringexplode(url, "/", &resultado);
            return resultado.at(resultado.size()-1);
        }
}

extern "C" resposta getmatch(const string url) {
    resposta r;   

if ( (url.find(".seniat.gob.ve") != string::npos)
   ) {
     
       r.file = get_filename(url);
      if (!r.file.empty()) {
         r.match = true;         
         r.domain = "seniat";
      } else {
         r.match = false;
      }
   } else {
      r.match = false;
   }
   return r;
}


#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o cadivi.gob.ve.so cadivi.gob.ve.cpp
// regex
// http.*\.cadivi\.gob\.ve.*(\.jpg|\.png|\.gif)

string get_filename(string url) {
      vector<string> resultado;
      if (url.find("?") != string::npos) {
         stringexplode(url, "?", &resultado);
         stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
         return resultado.at(resultado.size()-1);           
      } else {
         stringexplode(url, "/", &resultado);
         return resultado.at(resultado.size()-1);
      }
}

extern "C" resposta getmatch(const string url) {
    resposta r;   

if ( (url.find(".cadivi.gob.ve/") != string::npos) and ((url.find(".jpg") != string::npos) or (url.find(".png") != string::npos) or (url.find(".gif") != string::npos))
) {

       r.file = get_filename(url);
      if (!r.file.empty()) {
         r.match = true;
         r.domain = "Cadivi";
      } else {
         r.match = false;
      }
   } else {
      r.match = false;
   }
   return r;
}


el del ince no lo probe pero dime si te cachea

#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o inces.gob.ve.so inces.gob.ve.cpp
// regex
// http.*\.inces\.gob\.ve.*(\.jpg|\.png|\.gif)

string get_filename(string url) {
      vector<string> resultado;
      if (url.find("?") != string::npos) {
         stringexplode(url, "?", &resultado);
         stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
         return resultado.at(resultado.size()-1);           
      } else {
         stringexplode(url, "/", &resultado);
         return resultado.at(resultado.size()-1);
      }
}

extern "C" resposta getmatch(const string url) {
    resposta r;   

if ( (url.find(".inces.gob.ve/") != string::npos) and ((url.find(".jpg") != string::npos) or (url.find(".png") != string::npos) or (url.find(".gif") != string::npos))
) {

       r.file = get_filename(url);
      if (!r.file.empty()) {
         r.match = true;
         r.domain = "inces";
      } else {
         r.match = false;
      }
   } else {
      r.match = false;
   }
   return r;
}


Comenta Si te Funcionaron Saludos :)

Gracias amigo por participar y colaborar en este foro, Bienvenido y espero que te puedas beneficiar con este proyecto, Saludos
Título: Re:Ayuda, con 3 Plugin..
Publicado por: nqm74 en Octubre 23, 2013, 09:35:37 PM
Muchas gracias hermano por su gran  ayuda, le estaré comentando como me va con los plugin..  saludos..
Título: Re:Ayuda, con 3 Plugin..
Publicado por: david_domh en Octubre 24, 2013, 02:47:14 AM
para que se vea màs elegante los còdigos : click en el signo numeral luego poner al lado de code=cpp



entonces aparecerà asi :

Código (cpp) [Seleccionar]
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o seniat.gob.ve.so seniat.gob.ve.cpp
// regex
// http.*\.seniat\.gob\.ve.*(\.gif|\.jpg|\.png|\.swf)

string get_filename(string url) {
       vector<string> resultado;
       if (url.find("?") != string::npos) {
           stringexplode(url, "?", &resultado);
           stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
           return resultado.at(resultado.size()-1);          
       } else {
           stringexplode(url, "/", &resultado);
           return resultado.at(resultado.size()-1);
       }
}

extern "C" resposta getmatch(const string url) {
   resposta r;  

if ( (url.find(".seniat.gob.ve") != string::npos)
  ) {
   
      r.file = get_filename(url);
     if (!r.file.empty()) {
        r.match = true;        
        r.domain = "seniat";
     } else {
        r.match = false;
     }
  } else {
     r.match = false;
  }
  return r;
}



Saludos
Buenos aportes
Título: Re:Ayuda, con 3 Plugin..
Publicado por: JoseM14 en Octubre 24, 2013, 04:10:34 PM
De Nada Amigo y Bueno Amigo David y firecold Estare al Pendiente Para ver Como lo Hago Mas Elegante jejeje :)
Título: Re:Ayuda, con 3 Plugin..
Publicado por: TecnoCyber en Octubre 30, 2013, 09:45:33 AM
excelente felicidades viejo.... gracias
Título: Re:Plugins cadivi.gob.ve | seniat.gob.ve | inces.gob.ve
Publicado por: omalave en Diciembre 30, 2013, 10:57:51 PM
me funciona perfecto, pero no me aparece en la parte de "contenido cache" por que sera? lo mismo me pasa con otros dominios
Título: Re:Plugins cadivi.gob.ve | seniat.gob.ve | inces.gob.ve
Publicado por: omalave en Diciembre 31, 2013, 05:12:42 PM
ahora me hace cache seniat perfecto, pero cadivi solo 3 items.. osea 3 archivos png y ya.. mas nada.. usando el regexp que esta en el cpp