Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • A apachedex
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 2
    • Merge requests 2
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Commits
Collapse sidebar
  • nexedinexedi
  • apachedex
  • Merge requests
  • !2

Support non escaped referer in log

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Jérome Perrin requested to merge jerome/apachedex:fix/caddy-edge-referrer into master Feb 28, 2019
  • Overview 15
  • Commits 3
  • Changes 3

Unlike apache which escape non ascii characters in referrer, caddy writes referrer as is. Edge seem to send referrer not escaped, so with Edge and caddy we can have non ascii text in referrer.

For lines which cannot be decoded as ASCII, we use python replace error handler which would in this case allow the line to be processed if the decoding problem is only about the encoding of the referrer.

We don't implement this case as "skip and report ill-formed line", because python does not provide utilities to do this easily.

reproduction with caddy:

curl -k http://localhost -H 'Referer: héhé'

With apache, LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" common

127.0.0.1 - - [28/Feb/2019:10:03:33 +0100] "GET / HTTP/1.1" 200 2046 "h\xc3\xa9h\xc3\xa9" "curl/7.50.1" 4

With caddy, log / stdout "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"

127.0.0.1 - [28/Feb/2019:10:05:00 +0100] "GET / HTTP/2.0" 200 1950 "héhé" "curl/7.50.1" 4

and some other changes to make sure we can still decode compressed files.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/caddy-edge-referrer
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7