+  HandyCache форум
|-+  Главная категория» English forum» [Extension] Smart HTTP Referers
Имя пользователя:
Пароль:
Страниц: [1]   Вниз
  Отправить эту тему    Печать  
Автор Тема: [Extension] Smart HTTP Referers  (Прочитано 6833 раз)
0 Пользователей и 1 Гость смотрят эту тему.
www
Новичок
*

Репутация: +5/-0
Offline Offline

Сообщений: 39


« : 31 мая 2011, 06:03:31 »

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 variables

This list is just for reference.

VariableDescription
referer_hostThe full host of the webpage that sent the GET request. Examples:
Код:
example.net
www.example.co.uk
one.more.example.net
referer_host_mainOnly 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_fullThe full host of the requested URL. Examples:
Код:
example.net
www.example.co.uk
one.more.example.net
get_host_mainOnly 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_headersThe 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.


* Smart HTTP Referers 1.0.zip (0.6 Кб - загружено 124 раз.)
« Последнее редактирование: 20 декабря 2011, 14:06:12 от DenZzz » Сообщить модератору   Записан
www
Новичок
*

Репутация: +5/-0
Offline Offline

Сообщений: 39


« Ответ #1 : 06 июля 2011, 04:56:20 »

I've added mai62's example of a graphical options window to STR, so users can add exceptions easily. The only website I've had problems with after a month using STR was Google, so I've included some of their domains by default to the exceptions list.

* Smart HTTP Referers 1.5.zip (1.52 Кб - загружено 121 раз.)
Сообщить модератору   Записан
www
Новичок
*

Репутация: +5/-0
Offline Offline

Сообщений: 39


« Ответ #2 : 07 января 2012, 13:56:35 »

After updating HandyCache to the latest version, I've noticed that my extension is changing the referer to

Код:
Referer: opera.com
 http://www.google.com/xhtml?hl=en&q=echo.opera.com&pws=0

instead of just

Код:
Referer: opera.com

Was it already broken or this was caused by the HandyCache update? Грустный
Сообщить модератору   Записан
mai62
Автор HC
*****

Репутация: +226/-4
Offline Offline

Сообщений: 6383


« Ответ #3 : 07 января 2012, 16:18:03 »

In last version the options used for regular expressions have changed.
Replace this line
  new_headers = re.replace(hc.request_header,    "Referer:.*?http\:\/\/(.*?\/).*?\r\n", "Referer: http://"..get_host_full .. "\/\r\n")
with another
  new_headers = re.replace(hc.request_header, "Referer:[^\r]*\r\n", "Referer: http://"..get_host_full)
Сообщить модератору   Записан
www
Новичок
*

Репутация: +5/-0
Offline Offline

Сообщений: 39


« Ответ #4 : 08 января 2012, 01:30:01 »

It seems that it worked. Thanks!

* Smart HTTP Referers 1.6.zip (1.55 Кб - загружено 222 раз.)
Сообщить модератору   Записан
Страниц: [1]   Вверх
  Отправить эту тему    Печать  

 
Перейти в: