Menú principal
Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Menú Mostrar Mensajes

Temas - BMWFRS

#1
Plugins para RaptorCache / Plugin Speakeasy/speedtes
Julio 04, 2013, 11:18:42 PM
Buen día colegas, por acá yo uso mucho el speakeasy en lugar de speedtest para hacer las pruebas de velocidad, les expongo aquí el plugin y me gustaria que me dijeran si está bien y/o me corrigieran

Las HTTPRequest:
http://speedtest1.dfw1.speakeasy.net/speedtest/random350x350.jpg
http://speedtest1.dfw1.speakeasy.net/speedtest/random350x350.jpg

http://speedtest1.dfw1.speakeasy.net/speedtest/random1000x1000.jpg

http://speedtest1.chi1.speakeasy.net/speedtest/random350x350.jpg?x=1372997156125-1


Y EL PLUGIN:
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"

// use this line to compile
// g++ -I. -fPIC -shared -g -o speakeasy.net.so speakeasy.net.cpp
// regex
// http.*\.speakeasy\.net.*\.jpg

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(".speakeasy.net/") != string::npos) and (url.find(".jpg") != string::npos)
) {

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