🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #110

TCppWebBrowser cookie problem

#110
From: Mike Ruskai
Date: Fri, 30 May 2008 21:24
59 lines
2695 bytes
I'm using TCppWebBrowser to display a web page in my application.

CTRL-clicking a point on that page causes a POST, which then triggers a
response like this is from the server:

=====
HTTP/1.1 200 OK
Date: [date]
Server: [server ID]
Set-Cookie: [cookie name]=[cookie value] 
Content-Length: [length]
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function openDetailWin() {
  var win =
window.open('[URL]','[title]','height=500,width=750,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,location=no');
  win.focus();
}
</SCRIPT>
</HEAD>
<BODY onload="openDetailWin();">
[non-visible text]
</BODY>
</HTML>
=====

Note, in particular, the fact that it's specifying a cookie name and value.
That's the session cookie, required to authenticate the browser.

The window is opened, but that window issues this request:

=====
GET [URL] HTTP/1.1
Accept: */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)
Host: [host]
Connection: Keep-Alive
=====

Note that absence of a cookie, which prevents the content from being
retrieved.  That absence of a cookie is literally the only difference between
the request made via a new window from the TCppWebBrowser control and a
standalone IE instance that's viewing the same page.

Now here's the strange bit.  If I open that standalone IE instance and load
the main page in question, the TCppWebBrowser control adds the cookie to the
popup window content request.  Close the IE instance, and the cookie
disappears from the request again.

Anyone have any ideas on how to work around this problem?
Technical Details
Message-ID: <qir044h4vduuvh2fni5hs81sr50aabjqlt@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,ac14937141a5116d,start
X-Google-Attributes: gidfeeec,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Mike Ruskai <BUTthannydI@DONTearthlinkLIKE.netSPAM>
Newsgroups: borland.public.cppbuilder.internet.web
Subject: TCppWebBrowser cookie problem
Date: Fri, 30 May 2008 17:24:49 -0400
Message-ID: <qir044h4vduuvh2fni5hs81sr50aabjqlt@4ax.com>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 65.41.246.29
X-Trace: newsgroups.borland.com 1212182686 65.41.246.29 (30 May 2008 14:24:46 -0700)
Lines: 59
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail