Procházet zdrojové kódy

move HTTPD stack back to 4k and do not free headers before call to httpd_resp_send

Philippe G před 4 roky
rodič
revize
e131b674fd

+ 3 - 2
components/wifi-manager/http_server_handlers.c

@@ -979,6 +979,7 @@ esp_err_t process_redirect(httpd_req_t *req, const char * status){
 	char * ap_ip_address=get_ap_ip_address();
 	char * remote_ip=NULL;
 	in_port_t port=0;
+	char *redirect_url = NULL;
 
 	ESP_LOGD_LOC(TAG,  "Getting remote socket address");
 	remote_ip = http_alloc_get_socket_address(req,0, &port);
@@ -988,13 +989,12 @@ esp_err_t process_redirect(httpd_req_t *req, const char * status){
 
 	if(strcasestr(status,"302")){
 		size_t url_buf_size = strlen(location_prefix) + strlen(ap_ip_address)+1;
-		char * redirect_url = malloc(url_buf_size);
+		redirect_url = malloc(url_buf_size);
 		memset(redirect_url,0x00,url_buf_size);
 		snprintf(redirect_url, buf_size,"%s%s/",location_prefix, ap_ip_address);
 		ESP_LOGW_LOC(TAG,  "Redirecting host [%s] to %s (from uri %s)",remote_ip, redirect_url,req->uri);
 		httpd_resp_set_hdr(req,"Location",redirect_url);
 		snprintf(redirect, buf_size,"OK");
-		FREE_AND_NULL(redirect_url);
 	}
 	else {
 
@@ -1007,6 +1007,7 @@ esp_err_t process_redirect(httpd_req_t *req, const char * status){
 	httpd_resp_set_status(req, status);
 	httpd_resp_send(req, redirect, HTTPD_RESP_USE_STRLEN);
 	FREE_AND_NULL(redirect);
+	FREE_AND_NULL(redirect_url);
 	FREE_AND_NULL(remote_ip);
 
 	return ESP_OK;

+ 0 - 1
components/wifi-manager/wifi_manager_http_server.c

@@ -132,7 +132,6 @@ esp_err_t http_server_start()
     config.max_uri_handlers = 25;
     config.max_open_sockets = 8;
     config.uri_match_fn = httpd_uri_match_wildcard;
-	config.stack_size = 6*1024;
     //todo:  use the endpoint below to configure session token?
     // config.open_fn