Autor Beitrag
Blamaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: Sa 23.08.08 18:01 
Hi,

ich bin gerade dabei über Idhttp und den CookieManager einen Cookie zu übergeben. Das klappt nun allerdings nicht so recht.

ausblenden Delphi-Quelltext
1:
2:
Idhttp1.CookieManager.AddCookie('user=*****-*****''host.com');
Idhttp1.Get('http://link.html', lstream);


Wenn ich nun meinen netzwerk verkehr sniffe bekomme ich allerdings nur folgendes:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
GET /link.html HTTP/1.1
Content-Type: text/html
Host: host.com
Accept: text/html, */*
User-Agent: Mozilla/3.0 (compatible; Indy Library)


Wenn ich allerdings über Mozilla direkt auf den Link zugreife bekomme ich vom sniffer folgende Infos:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
GET /link.html HTTP/1.1
Host: host.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: user=******-********


Da beim Linkaufrufen über Mozilla der Cookie im Sniff Log auftaucht beim Idhttp.Get allerdings nicht, vermute ich doch stark das der Cookie nicht übergeben wird.

Nur woran kann das liegen ?

mfg Blamaster
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 23.08.08 22:39 
Also entweder du hast den CookieManager nicht richtig mit der HTTP Kompo verbunden, oder du legst den Cookie falsch an.
Also z.b. für den falschen Host oder für die falsche URL.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Blamaster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: So 24.08.08 10:28 
Kann man testweise die cookies irgendwie manuell ohne den cookie manager übergeben ?

mfg Blamaster
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 24.08.08 10:34 
Du kannst ja bei der Indy HTTP Komponente selber auf die Header Einfluss nehmen.
DA kannst du dann selber den Cookie Header einbauen.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: So 24.08.08 12:19 
user profile iconmatze hat folgendes geschrieben:
Also entweder du hast den CookieManager nicht richtig mit der HTTP Kompo verbunden

Das kann eigentlich nicht sein:

user profile iconBlamaster hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
Idhttp1.CookieManager.AddCookie('user=*****-*****''host.com');
Idhttp1.Get('http://link.html', lstream);

Er greift ja über den HTTP-Client auf den CookieManager zu.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 24.08.08 14:08 
Oh stimmt. Hatte ich ganz übersehen.
Dann gibts eigentlich nur noch die Möglichkeit, dass er den Cookie falsch erstellt.

Ich glaube in der HTTP Komponente gabs auch noch ne Option ob Cookies akzeptiert werden oder nicht. Vielleicht steht die auf falseund vielleicht hat das Einfluss?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Blamaster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 164



BeitragVerfasst: So 24.08.08 15:00 
Ne daran sollte es nicht liegen ... cookies werden von der idhhtp akzeptiert ist also auf true gesetzt.

Wie genau könnte ich den cookie denn manuell in den header einbauen ?

mfg Blamaster
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: So 24.08.08 17:22 
user profile iconBlamaster hat folgendes geschrieben:
Wie genau könnte ich den cookie denn manuell in den header einbauen ?

Indem du die Cookie-Zeile dem Header hinzufügst. :idea:

ausblenden Quelltext
1:
Cookie: user=******-********					
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Sa 22.11.08 10:44 
mal ne Frage: welches Programm hast du benutzt um die Header zu kriegen?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 22.11.08 11:22 
Entweder du nimmst Wireshark oder entsprechende Firefox-Plugins wie Firebug.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)