DelphiFAQ Home Search:

Apache's access control passed multiple times during multi-part downloads

 

commentsThis 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.

my $headers_in = $r->headers_in();
while(my($k,$v) = each %$headers_in) {
   print LOGFILE "$k = $v\n";
}

if ($r->headers_in->get('Range') eq '') {
  # process only for the first (non partial) request
}

Content-type: text/html

Comments:

2012-06-05, 21:36:23
anonymous from China  
<strong> http://www.coachout..strong> <a href=' http://www.coachout..g>Coach Outlet Online</strong></a><br />
<strong> http://www.coachfac..strong> <a href=' http://www.coachfac..g>Coach Factory</strong></a><br />
<strong> http://www.myloveco..strong> <a href=' http://www.myloveco..g>Coach Outlet Online</strong></a><br />
<strong> http://www.buyincoa..strong> <a href=' http://www.buyincoa..g>Coach Outlet</strong></a><br />
<strong> http://www.cheapcoa..strong> <a href=' http://www.cheapcoa..g>Cheap Coach Handbags</strong></a><br />
<strong> http://www.coachfac..strong> <a href=' http://www.coachfac..g>Coach Factory Outlet</strong></a><br />
<strong> http://www.buycoach..strong> <a href=' http://www.buycoach..g>Coach Outlet Online</strong></a><br />
<strong>www.coachoutletonfactory.net</strong> <a href=' http://www.coachout..g>Coach Factory Outlet</strong></a><br />
<strong>www.coachoutletonline4you.us</strong> <a href=' http://www.coachout..g>Coach Outlet Online</strong></a><br />
<strong>coachfactoryoutletq.net</strong> <a href=' http://www.coachfac..g>Coach Factory</strong></a><br />
<strong>gotocoachoutlets.net</strong> <a href=' http://www.gotocoac..g>Coach Outlet Online</strong></a><br />
2012-11-12, 02:54:30
coach001 from United Kingdom  

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: