Edited sendfile to better support different configurations, added mimetype-function.