/v2/crawl api

This commit is contained in:
Matt Wells
2013-10-22 12:25:37 -07:00
parent c7d7e24f9b
commit 8c3a61f070
2 changed files with 8 additions and 5 deletions

@ -910,9 +910,13 @@ bool HttpServer::sendReply ( TcpSocket *s , HttpRequest *r , bool isAdmin) {
// "GET /crawlbot/downloadurls"
// "GET /crawlbot/downloadobjects"
// "GET /crawlbot/downloadpages"
if ( strncmp ( path , "/crawlbot/download/" ,19 ) == 0 )
if ( strncmp ( path , "/crawlbot/download/" ,19 ) == 0 ||
strncmp ( path , "/v2/crawl/download/" ,19 ) == 0 )
return sendBackDump ( s , r );
if ( strncmp ( path , "/v2/crawl", 9 ) == 0 )
return sendPageCrawlbot ( s , r );
// . is it a diffbot api request, like "GET /api/*"
// . ie "/api/startcrawl" or "/api/stopcrawl" etc.?
//if ( strncmp ( path , "/api/" , 5 ) == 0 )

@ -1739,8 +1739,8 @@ bool sendReply2 (TcpSocket *socket , long fmt , char *msg ) {
// send this back to browser
SafeBuf sb;
if ( fmt == FMT_JSON ) {
sb.safePrintf("{\n{\"response\":\"success\"},\n"
"{\"message\":\"%s\"}\n}\n"
sb.safePrintf("{\n\"response\":\"success\",\n"
"\"message\":\"%s\"\n}\n"
, msg );
ct = "application/json";
}
@ -1770,8 +1770,7 @@ bool sendErrorReply2 ( TcpSocket *socket , long fmt , char *msg ) {
// send this back to browser
SafeBuf sb;
if ( fmt == FMT_JSON ) {
sb.safePrintf("{\n{\"response\":\"fail\"},\n"
"{\"message\":\"%s\"}\n}\n"
sb.safePrintf("{\"error\":\"%s\"}\n"
, msg );
ct = "application/json";
}