Apache's access control passed multiple times during multi-part downloads
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:We are using Apache and use perl module AuthCookie.pm for access control (authentication, authorization). We log all accesses into a mysql database. When users download large documents, I see multiple entries per downloaded document in our database - typically 6 to 12 entries. I see the corresponding log file entries with an http result code of 206 (partial download).
How can I log only the first of those 6 to 12 partial downloads?
Answer:From the authentication/ authorization code you have access to Apache's RequestRec object. You can see the headers there. One of the headers will be Range (in case a part of the file is requested. Look at the code below - it shows how to access the incoming headers (all of them) and in particular how to check if a request is a subsequent partial download.