forked from cory/tildefriends
robots.txt => C
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4832 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -508,6 +508,20 @@ static void _httpd_endpoint_hitches(tf_http_request_t* request)
|
||||
tf_free(response);
|
||||
}
|
||||
|
||||
static void _httpd_endpoint_robots_txt(tf_http_request_t* request)
|
||||
{
|
||||
if (_httpd_redirect(request))
|
||||
{
|
||||
return;
|
||||
}
|
||||
char* response =
|
||||
"User-Agent: *\n"
|
||||
"Disallow: /*/*/edit\n"
|
||||
"Allow: /\n";
|
||||
const char* headers[] = { "Content-Type", "text/plain; charset=utf-8" };
|
||||
tf_http_respond(request, 200, headers, tf_countof(headers) / 2, response, response ? strlen(response) : 0);
|
||||
}
|
||||
|
||||
static void _httpd_endpoint_debug(tf_http_request_t* request)
|
||||
{
|
||||
if (_httpd_redirect(request))
|
||||
@ -557,6 +571,7 @@ void tf_httpd_register(JSContext* context)
|
||||
tf_http_set_trace(http, tf_task_get_trace(task));
|
||||
JS_SetOpaque(httpd, http);
|
||||
|
||||
tf_http_add_handler(http, "/robots.txt", _httpd_endpoint_robots_txt, NULL, NULL);
|
||||
tf_http_add_handler(http, "/debug", _httpd_endpoint_debug, NULL, task);
|
||||
tf_http_add_handler(http, "/disconnections", _httpd_endpoint_disconnections, NULL, task);
|
||||
tf_http_add_handler(http, "/hitches", _httpd_endpoint_hitches, NULL, task);
|
||||
|
Reference in New Issue
Block a user