+  HandyCache форум
|-+  Главная категория» English forum» help me make extension replace http metode exception
Имя пользователя:
Пароль:
Страниц: [1]   Вниз
  Отправить эту тему    Печать  
Автор Тема: help me make extension replace http metode exception  (Прочитано 3209 раз)
0 Пользователей и 1 Гость смотрят эту тему.
reges007
Новичок
*

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

Сообщений: 29


« : 08 октября 2012, 03:36:59 »

some contents using http metode HEAD then i want create extension replace header from metode HEAD to GET

here some case debug
Код:
08.10.12 03:38:14,640 # 499/881 >>> URL: http://down.antivirus.co.id/base/update.dat
noReqDo:
HEAD http://down.antivirus.co.id/base/update.dat HTTP/1.1
Host: down.antivirus.co.id
Accept: text/html, */*
Accept-Encoding: identity
User-Agent: Mozilla/3.0 (compatible; Indy Library)

i succes using this extension
Код:
@event         RequestHeaderReceived/Request
</HCExtension> ]]
function Request()
hc.request_header = re.replace(hc.request_header, [[^HEAD]], 'GET')

end

but the problem is i want to skip replace header HEAD to GET if file are already in dir cache
how to created rule exception if file is already in dir cache?

thank's


sorry for my bad english
Сообщить модератору   Записан
Михаил
Gold beta tester
*****

Репутация: +337/-14
Offline Offline

Сообщений: 5513



« Ответ #1 : 08 октября 2012, 03:53:25 »

May be:

Код:
@event         RequestHeaderReceived/Request
</HCExtension> ]]
function Request()
   if hc.cache_file_name== '' then   -- no cache file existed
      hc.request_header = re.replace(hc.request_header, [[^HEAD]], 'GET')
   end
end
Сообщить модератору   Записан
reges007
Новичок
*

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

Сообщений: 29


« Ответ #2 : 08 октября 2012, 07:30:17 »

it works!

thank you very much  Веселый  Отлично!
Сообщить модератору   Записан
Страниц: [1]   Вверх
  Отправить эту тему    Печать  

 
Перейти в: