*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
return fread(buf, 1, max, file);
}
return fread(buf, 1, max, file);
}
- } else if (!strncmp(nurl, URL_BASE_API_1_0_SENSORS,
- strlen(URL_BASE_API_1_0_SENSORS))
- && nurl[strlen(URL_BASE_API_1_0_SENSORS)] == '/') {
+ } else if (!strncmp(nurl, URL_BASE_API_1_1_SENSORS,
+ strlen(URL_BASE_API_1_1_SENSORS))
+ && nurl[strlen(URL_BASE_API_1_1_SENSORS)] == '/') {
s = psensor_list_get_by_id(server_data.sensors, sid);
if (s)
page = sensor_to_json_string(s);
s = psensor_list_get_by_id(server_data.sensors, sid);
if (s)
page = sensor_to_json_string(s);
resp = create_response_api(nurl, method, rp_code);
} else {
char *fpath = get_path(nurl, server_data.www_dir);
resp = create_response_api(nurl, method, rp_code);
} else {
char *fpath = get_path(nurl, server_data.www_dir);
- return MHD_create_response_from_data
- (strlen(page), page, MHD_YES, MHD_NO);
- }
+ char *page = strdup(PAGE_NOT_FOUND);
+ *rp_code = MHD_HTTP_NOT_FOUND;
+
+ return MHD_create_response_from_data(strlen(page),
+ page,
+ MHD_YES,
+ MHD_NO);
ret = MHD_queue_response(connection, resp_code, response);
MHD_destroy_response(response);
ret = MHD_queue_response(connection, resp_code, response);
MHD_destroy_response(response);