I've created this simple Lua extension and hope that it'll be useful for someone else. Feel free to translate this "manual" to Russian or other languages, and please let me know if you find any errors or have any suggestions to improve the code. I'm not a programmer.
If a page requests a URL from another domain,
Smart HTTP Referers modifies the referer to the new domain and adds the rule "SHR" to the monitor. If there's no referer or if the request comes from the same domain or a subdomain of the same domain, SHR doesn't do anything.
I was inspired by
Firefox's RefControl and
mai62's example extension, and tested it by opening some websites on Opera for Windows and Firefox for Linux (with HandyCache running on Wine).
List of variablesThis list is just for reference.
Variable | Description |
referer_host | The full host of the webpage that sent the GET request. Examples:
example.net www.example.co.uk one.more.example.net
|
referer_host_main | Only the main domain of the host requesting the URL. It's created by stripping out all subdomains from referer_host_full. Examples:
example.net example.co.uk example.com
|
get_host_full | The full host of the requested URL. Examples:
example.net www.example.co.uk one.more.example.net
|
get_host_main | Only the main domain of the server that hosts the requested URL. It's created by stripping out all subdomains from get_host_full. Examples:
example.net example.co.uk example.com
|
new_headers | The HTTP headers that will actually be sent to the host of the requested URL, if and only if get_host_main is different from referer_host_main. It's the same as get_host_main with a slash at the end. |