Browse Source

Add TODO-mark to support absolute URIs (#197)

bel 9 years ago
parent
commit
5437f5d37e
1 changed files with 13 additions and 3 deletions
  1. 13 3
      src/civetweb.c

+ 13 - 3
src/civetweb.c

@@ -9837,14 +9837,24 @@ struct mg_connection *mg_connect_client(
 	return conn;
 	return conn;
 }
 }
 
 
+
 static int is_valid_uri(const char *uri)
 static int is_valid_uri(const char *uri)
 {
 {
-	/* Conform to
+	/* According to the HTTP standard
 	 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
 	 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
-	 * URI can be an asterisk (*) or should start with slash. */
-	return uri[0] == '/' || (uri[0] == '*' && uri[1] == '\0');
+	 * URI can be an asterisk (*) or should start with slash (relative uri),
+     * or it should start with the protocoll (absolute uri). */
+    if (uri[0] == '*' && uri[1] == '\0') {
+        return 1;
+    }
+    if (uri[0] == '/') {
+        return 1;
+    }
+    /* TODO: support absoluteURI #197 */
+	return 0;
 }
 }
 
 
+
 static int
 static int
 getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err)
 getreq(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err)
 {
 {