*/
API_EXPORT(long) ap_send_fd(ap_file_t *fd, request_rec *r)
{
- return ap_send_fd_length(fd, r, -1);
+ ap_ssize_t len = r->finfo.st_size;
+#ifdef HAVE_SENDFILE
+ ap_bflush(r->connection->client);
+ if (ap_get_filesize(&len, fd) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
+ "ap_send_fd: ap_get_filesize failed.");
+ return 0;
+ }
+ if (iol_sendfile(r->connection->client->iol, fd, len,
+ NULL, 0, 0) != APR_SUCCESS) {
+ ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
+ "ap_send_fd: iol_sendfile failed.");
+ }
+#else
+ len = ap_send_fd_length(fd, r, -1);
+#endif
+ return len;
}
API_EXPORT(long) ap_send_fd_length(ap_file_t *fd, request_rec *r, long length)
return (s_iInitCount);
/* s_iInitCount == 0. Do the initailization */
- iVersionRequested = MAKEWORD(1, 1);
+ iVersionRequested = MAKEWORD(2, 0);
err = WSAStartup((WORD) iVersionRequested, &wsaData);
if (err) {
s_iInitCount = -1;