瀏覽代碼

Temporary fix for storing response code in uri

bel 8 年之前
父節點
當前提交
0dd56f1440
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 2 0
      src/civetweb.c
  2. 3 2
      test/public_server.c

+ 2 - 0
src/civetweb.c

@@ -13514,6 +13514,7 @@ mg_get_response(struct mg_connection *conn,
 		 *       2) here, ri.uri is the http response code */
 		conn->request_info.uri = conn->request_info.request_uri;
 #endif
+        conn->request_info.local_uri = conn->request_info.request_uri;
 
 		/* TODO (mid): Define proper return values - maybe return length?
 		 * For the first test use <0 for error and >0 for OK */
@@ -13560,6 +13561,7 @@ mg_download(const char *host,
 			 *       2) here, ri.uri is the http response code */
 			conn->request_info.uri = conn->request_info.request_uri;
 #endif
+            conn->request_info.local_uri = conn->request_info.request_uri;
 		}
 	}
 

+ 3 - 2
test/public_server.c

@@ -4003,8 +4003,9 @@ minimal_http_client_impl(const char *server, uint16_t port, const char *uri)
 	client_ri = mg_get_request_info(client);
 	ck_assert(client_ri != NULL);
 
-	/* e.g.: ck_assert_str_eq(client_ri->local_uri, "200"); */
-	r = (int)strlen(client_ri->local_uri);
+	/* e.g.: ck_assert_str_eq(client_ri->request_uri, "200"); */
+    ck_assert_ptr_ne(client_ri->request_uri, NULL);
+	r = (int)strlen(client_ri->request_uri);
 	ck_assert_int_eq(r, 3);
 
 	data_read = 0;