Diff

Differences From Artifact [a6b140c86c]:

To Artifact [99eaeee2ab]:


578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
	);
}

/* Handle a single request from a client */
static void filed_handle_client(int fd, struct filed_http_request *request) {
	struct filed_fileinfo *fileinfo;
	ssize_t sendfile_ret;
	size_t sendfile_len, sendfile_sent, sendfile_size;
	off_t sendfile_offset;
	char *path;
	char *date_current, date_current_b[64];
	int http_code;
	FILE *fp;

	/* Determine current time */
	date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));







|
|







578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
	);
}

/* Handle a single request from a client */
static void filed_handle_client(int fd, struct filed_http_request *request) {
	struct filed_fileinfo *fileinfo;
	ssize_t sendfile_ret;
	size_t sendfile_size;
	off_t sendfile_offset, sendfile_sent, sendfile_len;
	char *path;
	char *date_current, date_current_b[64];
	int http_code;
	FILE *fp;

	/* Determine current time */
	date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));
754
755
756
757
758
759
760
761
762
763

764
765
766
767
768
769
770
				sendfile_len -= sendfile_ret;
				sendfile_sent += sendfile_ret;
				if (sendfile_len == 0) {
					break;
				}
			}

			/* XXX: TODO: Report status */
			filed_log_msg("SEND_COMPLETE STATUS=%s FILE_FD=%i FD=%i BYTES=%llu BYTES_SENT=%llu",
				"<unknown>",

				fileinfo->fd,
				fd,
				(unsigned long long) request->headers.range.length,
				(unsigned long long) sendfile_sent
			);
		}








<

<
>







754
755
756
757
758
759
760

761

762
763
764
765
766
767
768
769
				sendfile_len -= sendfile_ret;
				sendfile_sent += sendfile_ret;
				if (sendfile_len == 0) {
					break;
				}
			}


			filed_log_msg("SEND_COMPLETE STATUS=%s FILE_FD=%i FD=%i BYTES=%llu BYTES_SENT=%llu",

				(sendfile_sent == request->headers.range.length) ? "OK" : "PARTIAL",
				fileinfo->fd,
				fd,
				(unsigned long long) request->headers.range.length,
				(unsigned long long) sendfile_sent
			);
		}