浏览代码

Support absolute uri (#197) - (Step 11/?)

bel2125 9 年之前
父节点
当前提交
40fd0245c1
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 1 1
      src/civetweb.c
  2. 3 2
      src/mod_lua.inl

+ 1 - 1
src/civetweb.c

@@ -10549,7 +10549,7 @@ mg_connect_websocket_client(const char *host,
 	                   origin);
 
 	/* Connection object will be null if something goes wrong */
-	if (conn == NULL || (strcmp(conn->request_info.uri, "101") != 0)) {
+	if (conn == NULL || (strcmp(conn->request_info.request_uri, "101") != 0)) {
 		if (!*error_buffer) {
 			/* if there is a connection, but it did not return 101,
 			 * error_buffer is not yet set */

+ 3 - 2
src/mod_lua.inl

@@ -488,7 +488,7 @@ static int lsp_redirect(lua_State *L)
 	const char *target = (num_args == 1) ? lua_tostring(L, 1) : NULL;
 
 	if (target) {
-		conn->request_info.uri = target;
+		conn->request_info.rel_uri = target;
 		handle_request(conn);
 		lsp_abort(L);
 	} else {
@@ -1047,7 +1047,8 @@ static void prepare_lua_request_info(struct mg_connection *conn, lua_State *L)
 	lua_pushstring(L, "request_info");
 	lua_newtable(L);
 	reg_string(L, "request_method", conn->request_info.request_method);
-	reg_string(L, "uri", conn->request_info.uri);
+	reg_string(L, "request_uri", conn->request_info.request_uri);
+	reg_string(L, "uri", conn->request_info.rel_uri);
 	reg_string(L, "http_version", conn->request_info.http_version);
 	reg_string(L, "query_string", conn->request_info.query_string);
 #if defined(MG_LEGACY_INTERFACE)