+  HandyCache форум
|-+  Главная категория» English forum» Is it possible to fake the User-Agent string with an extension?
Имя пользователя:
Пароль:
Страниц: [1]   Вниз
  Отправить эту тему    Печать  
Автор Тема: Is it possible to fake the User-Agent string with an extension?  (Прочитано 7499 раз)
0 Пользователей и 1 Гость смотрят эту тему.
www
Новичок
*

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

Сообщений: 39


« : 20 июля 2011, 09:28:33 »

I want to pretend to be on Opera Mini/Mobile or on an iPhone to access the mobile versions of websites automatically, but I failed at my attempts at creating a regular expression to replace the User-Agent line in the GET headers.  Is there some protection against changing it or did I just create bad expressions?
Сообщить модератору   Записан
DenZzz
Модератор
*****

Репутация: +179/-11
Offline Offline

Сообщений: 5589



« Ответ #1 : 20 июля 2011, 12:03:12 »

An extension can change any line in the request header.
Example code:

Код:
--[[ <HCExtension>
@name         Change User-Agent in the request headers
@event        RequestHeaderReceived/Request
</HCExtension> ]]

function Request()
hc.request_header = re.replace(hc.request_header, [[^User-Agent: \K[^\r\n]+]], 'My_Agent')
end
Сообщить модератору   Записан
www
Новичок
*

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

Сообщений: 39


« Ответ #2 : 21 июля 2011, 08:09:49 »

Thank you, DenZzz.
Сообщить модератору   Записан
Страниц: [1]   Вверх
  Отправить эту тему    Печать  

 
Перейти в: