- LOG_INFO("Mount FAT filesystem.\n");
- result = f_mount(0, &fs);
- if (result != FR_OK)
- {
- LOG_ERR("Mounting FAT volumes error[%d]\n", result);
- sd_ok = false;
- f_mount(0, NULL);
- }
-
- if (sd_ok)
- {
- result = fatfile_open(&in_file, file_name, FA_OPEN_EXISTING | FA_READ);
-
- size_t count = 0;
- if (result == FR_OK)
- {
- LOG_INFO("Opened file '%s' size %ld\n", file_name, in_file.fat_file.fsize);
-
- http_sendOk(client);
-
- while (count < in_file.fat_file.fsize)
- {
- int len = kfile_read(&in_file.fd, tx_buf, sizeof(tx_buf));
- netconn_write(client, tx_buf, len, NETCONN_COPY);
- count += len;
- }
-
- kfile_flush(&in_file.fd);
- kfile_close(&in_file.fd);
-
- LOG_INFO("Sent: %d\n", count);
- }
- else
- {
- LOG_ERR("Unable to open file: '%s' error[%d]\n", file_name, result);
- http_sendFileNotFound(client);
- netconn_write(client, http_file_not_found, http_file_not_found_len - 1, NETCONN_NOCOPY);
- }
- }
+ LOG_ERR("Internal server error\n");
+ http_sendInternalErr(client);
+ netconn_write(client, http_server_error, http_server_error_len - 1, NETCONN_NOCOPY);