X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=src%2Fsendfile.c;h=85ea9bb2a9c5eb7f4938e32e18d9c161f6f9a9e8;hp=e6f67865f72f6dc385996865ecbeb71c0e323f13;hb=595adb9922885c2a05bc6917ee8f8f02f496e618;hpb=2a516eedef5051e08ecaf7ddaa3adebe6cf239de diff --git a/src/sendfile.c b/src/sendfile.c index e6f6786..85ea9bb 100644 --- a/src/sendfile.c +++ b/src/sendfile.c @@ -271,13 +271,24 @@ int main(int argc, char **argv) simpleerror(1, 500, "Internal Error", "The server could not access its own data."); exit(1); } - if(contype == NULL) - contype = getmimetype(file, &sb); + if(!strcasecmp(argv[optind], "get")) { + ishead = 0; + } else if(!strcasecmp(argv[optind], "head")) { + ishead = 1; + } else { + simpleerror(1, 405, "Method not allowed", "The requested method is not defined for this resource."); + return(0); + } + if(contype == NULL) { + if((hdr = getenv("REQ_X_ASH_CONTENT_TYPE")) != NULL) + contype = hdr; + else + contype = getmimetype(file, &sb); + } contype = ckctype(contype); checkcache(file, &sb); - ishead = !strcasecmp(argv[optind], "head"); if((hdr = getenv("REQ_RANGE")) != NULL) sendrange(fd, &sb, contype, hdr, ishead); else