This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compile with g++ icu-detect.cpp -I /usr/local/include -L /usr/local/lib -licuuc -licudata -licui18n | |
#include <cstdio> | |
#include <string> | |
#include <cassert> | |
#include "unicode/ucsdet.h" | |
#include "unicode/uclean.h" | |
int main(int argc, char **argv) | |
{ | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RE2 link("(?ims)(?:\\<a([^\\>]+)href=\\\")([^\\\"]+)\\\""); | |
re2::StringPiece content(html_text); | |
string match; | |
string domain; | |
while(RE2::FindAndConsume(&content, link, (void*)0, &match)){ | |
if(match[0] == '/'){ | |
if(!domain.size()){ | |
evbuffer_add_printf(evb, "Domain name required.\n"); | |
evhttp_send_reply(req, HTTP_BADREQUEST, "Client", evb); | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void onCompleted(evhttp_request *req, void* arg) | |
{ | |
fprintf(stderr, "Request completed\n"); | |
fwrite(req->input_buffer->buffer, 1, req->input_buffer->off, stderr); | |
fprintf(stderr, "\n"); | |
} | |
int main(int argc, char **argv) | |
{ | |
char const *address = argv[1]; |
NewerOlder