Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

следим за заголовками [D7, XP]


LexXL ©   (2006-10-25 08:18:00) 

Есть форма на ней  Webbrowser,необходимо логировать заголовки отправленные и полученные Webbrowser-м, большая просьба помочь.
Заранее огромное спасибо!


LexXL   (2006-10-25 14:04:00) [1]

извеняюсь скорее всего я не так сформулировал вопрос : под заголовками я имел в виду HTTP заголовки вида :

GET http://yandex.ruHTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; DigExt)
Host: yandex.ru

HTTP/1.0 200 OK
Date: Sat, 03 Sep 2005 146:15 GMT
Server: Apache/1.3.33 (Unix) mod_jk/1.2.5 PHP/4.3.10 mod_deflate/1.0.21
X-Powered-By: PHP/4.3.10
cookie> readnews=57378%2C57376%2C57369%2C57371%2C57380%2C57377%2C57375%2C57374%2C57373%2C57372%2C57364%2C57363%2C57360%2C57359%2C57358%2C57357%2C57356%2C57355%2C57354%2C57379%2C57297%2C57352%2C57370%2C57368%2C57351%2C57362%2C57367%2C57366%2C57365%2C57361; expires=Sun, 04-Sep-2005 146:15 GMT; path=/
hdr> Set-Cookie: readnews=57378%2C57376%2C57369%2C57371%2C57380%2C57377%2C57375%2C57374%2C57373%2C57372%2C57364%2C57363%2C57360%2C57359%2C57358%2C57357%2C57356%2C57355%2C57354%2C57379%2C57297%2C57352%2C57370%2C57368%2C57351%2C57362%2C57367%2C57366%2C57365%2C57361; expires=Sun, 04-Sep-2005 146:15 GMT; path=/
Content-Type: text/html; charset=latin1

вот как отправлять я знаю но как узнать ответ (желательно у webbrowser) я нигде не могу найти
есть наметки из :

uses MSHTML;
...
(WebBrowser as IHTMLDocument2Disp).cookie;
(WebBrowser as IHTMLDocument2Disp).domain;
(WebBrowser as IHTMLDocument2Disp).protocol;
(WebBrowser as IHTMLDocument2Disp).{...};


Dmitrij_K   (2006-10-25 13:47:00) [2]

Перехватывай функции передачи\приема
http://madshi.net/madCodeHookDescription.htm
вот рабочий пример для send, только он у меня из dll
uses
 Windows,Messages,SysUtils, WinSock,
 madCodeHook;

var
 SendNext1 : function (const s:Integer; Buf:PChar; len, flags: Integer ): Integer; stdcall;
 SendNext2 : function (const s:Integer; Buf:PChar; len, flags: Integer ): Integer; stdcall;

procedure send_(Buf:PChar; len:Integer);
var
 CDS: TCopyDataStruct;
begin
 CDS.dwData := GetCurrentProcessId;
 CDS.cbData := len;
 CDS.lpData := Buf;
 SendMessage(FindWindow('t_hook_send',nil), WM_COPYDATA, 0, Integer(@CDS));
end;

function SendHook1(const s:Integer; Buf:PChar; len, flags: Integer): Integer; stdcall;
begin
 send_(Buf,len);
 Result := SendNext1(s, Buf, len, flags);
end;

function SendHook2(const s:Integer; Buf:PChar; len, flags: Integer): Integer; stdcall;
begin
 send_(Buf,len);
 Result := SendNext2(s, Buf, len, flags);
end;

function IsDo:Boolean;
var
 TheFileName: array[0..MAX_PATH] of char;
 s:string;
begin
 FillChar(TheFileName, sizeof(TheFileName), #0);
 GetModuleFileName(0, TheFileName, sizeof(TheFileName));
 s := LowerCase(ExtractFileName(TheFileName));
 Result := (s='firefox.exe') or (s='iexplore.exe') or (s='project1.exe');
end;

begin
 if IsDo then
 begin
   if HookAPI('wsock_32.dll', 'send', @SendHook1, @SendNext1) and HookAPI('wsock32.dll', 'send', @SendHook2, @SendNext2) then
     MessageBox(0, 'Hook OK', 'blablabla',mb_ok)
   else MessageBox(0, 'Hook fail', 'blablabla',mb_ok)
 end;
end.


Наверх

Титульная страница Поиск, карта сайта Написать письмо