Selaa lähdekoodia

Temporary fix for storing response code in uri

bel 8 vuotta sitten
vanhempi
commit
0dd56f1440
2 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  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 */
 		 *       2) here, ri.uri is the http response code */
 		conn->request_info.uri = conn->request_info.request_uri;
 		conn->request_info.uri = conn->request_info.request_uri;
 #endif
 #endif
+        conn->request_info.local_uri = conn->request_info.request_uri;
 
 
 		/* TODO (mid): Define proper return values - maybe return length?
 		/* TODO (mid): Define proper return values - maybe return length?
 		 * For the first test use <0 for error and >0 for OK */
 		 * 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 */
 			 *       2) here, ri.uri is the http response code */
 			conn->request_info.uri = conn->request_info.request_uri;
 			conn->request_info.uri = conn->request_info.request_uri;
 #endif
 #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);
 	client_ri = mg_get_request_info(client);
 	ck_assert(client_ri != NULL);
 	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);
 	ck_assert_int_eq(r, 3);
 
 
 	data_read = 0;
 	data_read = 0;