Skip to content

Instantly share code, notes, and snippets.

@yoursunny
Created August 8, 2013 17:25
Show Gist options
  • Save yoursunny/6186715 to your computer and use it in GitHub Desktop.
Save yoursunny/6186715 to your computer and use it in GitHub Desktop.
ndnd robots.txt patch
@@ -81,6 +81,13 @@
"HTTP/1.1 405 Method Not Allowed" CRLF
"Connection: close" CRLF CRLF;
+static const char *respRobots =
+ "HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Content-Length: 26" CRLF CRLF
+ "User-Agent: *" CRLF
+ "Disallow: /";
+
static void
ndnd_stats_http_set_debug(struct ndnd_handle *h, struct face *face, int level)
{
@@ -98,7 +105,7 @@
ndnd_stats_handle_http_connection(struct ndnd_handle *h, struct face *face)
{
struct ndn_charbuf *response = NULL;
- char rbuf[16];
+ char rbuf[32];
int i;
int nspace;
int n;
@@ -144,6 +151,9 @@
response = collect_stats_xml(h);
send_http_response(h, face, "text/xml", response);
}
+ else if (0 == strcmp(rbuf, "GET /robots.txt ")) {
+ ndnd_send(h, face, respRobots, strlen(respRobots));
+ }
else if (0 == strcmp(rbuf, "GET "))
ndnd_send(h, face, resp404, strlen(resp404));
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment