src/rrd_daemon.c: Accept \r\n style line endings, too.
authorFlorian Forster <octo@leeloo.home.verplant.org>
Tue, 24 Jun 2008 12:43:15 +0000 (14:43 +0200)
committerFlorian Forster <octo@leeloo.home.verplant.org>
Tue, 24 Jun 2008 12:43:15 +0000 (14:43 +0200)
src/rrd_daemon.c

index 0e2d2df..4def10c 100644 (file)
@@ -637,6 +637,14 @@ static int handle_request (int fd) /* {{{ */
     RRDD_LOG (LOG_INFO, "handle_request: malformed request.");
     return (-1);
   }
+
+  /* Accept Windows style line endings, too */
+  if ((buffer_size > 2) && (buffer[buffer_size - 2] == '\r'))
+  {
+    buffer_size--;
+    buffer[buffer_size - 1] = '\n';
+  }
+
   /* Place the normal field separator at the end to simplify
    * `buffer_get_field's work. */
   buffer[buffer_size - 1] = ' ';