Skip to content

Commit

Permalink
Ensure static content is case-insensitive verified.
Browse files Browse the repository at this point in the history
  • Loading branch information
allinurl committed Jan 26, 2016
1 parent 4710a2c commit 422db19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
17 changes: 0 additions & 17 deletions config/goaccess.conf
Original file line number Diff line number Diff line change
Expand Up @@ -241,39 +241,22 @@ all-static-files false
# The actual '.' is required and extensions are case sensitive
#
static-file .css
static-file .CSS
static-file .dae
static-file .DAE
static-file .eot
static-file .EOT
static-file .gif
static-file .GIF
static-file .ico
static-file .ICO
static-file .jpeg
static-file .JPEG
static-file .jpg
static-file .JPG
static-file .js
static-file .JS
static-file .map
static-file .MAP
static-file .mp3
static-file .MP3
static-file .pdf
static-file .PDF
static-file .png
static-file .PNG
static-file .svg
static-file .SVG
static-file .swf
static-file .SWF
static-file .ttf
static-file .TTF
static-file .txt
static-file .TXT
static-file .woff
static-file .WOFF

# Exclude an IPv4 or IPv6 from being counted.
# Ranges can be included as well using a dash in between
Expand Down
9 changes: 6 additions & 3 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,10 @@ extract_referer_site (const char *referer, char *host)
return 1;
}

/* returns 1 if the request seems to be a static file */
/* Determine if the given request is static (e.g., jpg, css, js, etc).
*
* On error, or if not static, 0 is returned.
* On success, the 1 is returned. */
static int
verify_static_content (char *req)
{
Expand All @@ -644,12 +647,12 @@ verify_static_content (char *req)
if (conf.all_static_files && (pch = strchr (req, '?')) != NULL &&
pch - req > elen) {
pch -= elen;
if (0 == strncmp (ext, pch, elen))
if (0 == strncasecmp (ext, pch, elen))
return 1;
continue;
}

if (!memcmp (nul - elen, ext, elen))
if (!strncasecmp (nul - elen, ext, elen))
return 1;
}

Expand Down

0 comments on commit 422db19

Please sign in to comment.