WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Cookies Won't Go Through

Keywords: 	 cookies WinInet

Question:

While using standard ibegin, iHostConnect, iHttpInit, iHttpOpen, and supplying my own headers, I can not get winbatch to send a cookie. I specify my content, connection, accept, and cookie, then i strcat() them all together. The strcat() works fine but when i send the request(POST request), the cookie does not go through.

I'm using TCPdump and i can see clearly that the cookie header is not being posted. Ive also noticed that although i supply my own accept header, wininet puts one of there own in there as well (both accept headers are in the request), is there anything i can do to stop this from happening?

addextender("wwint33i.dll")

acc="Accept: test"
lan ="Accept-Language: en"
encoding="Accept-Encoding: gzip, deflate"
user="User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)"
host="Host: www.winbatch.com"
;length="Content-Length: 112"
conn="Connection: Keep-Alive"
cookie ="Cookie: test"
HtmlFile="http://www.winbatch.com"
url = "www.winbatch.com"


myheader=strcat(acc, @crlf, lan, @crlf, encoding, @crlf, user, @crlf, cookie, @crlf, host, @crlf, conn, @crlf, cookie)
message("test", myheader)


TopHandle =ibegin(0,"","")
conhandle=iHostConnect(TopHandle, Url ,@HTTP, "", "")
datahandle=iHttpInit(conhandle, "GET", "/index.html", "",0)
rslt=iHttpOpen(datahandle, Myheader, 0 , 0)
xx =ireaddata(datahandle,"c:\temp.txt") ; writes whole html file 

Now this is what the request looks like
GET /index.html HTTP/1.1
Accept: *.*
Accept: test
Accept-Language: en
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
Host: www.winbatch.com
Connection: Keep-Alive
Then the winbatch servers reply
HTTP/1.1 200 OK
Date: Wed, 26 Jul 2000 17:27:33 GMT
Server: Apache/1.2.4
Last-Modified: Fri, 26 May 2000 20:23:56 GMT
ETag: "e2e15-2813-392edd5c"
Content-Length: 10259
Accept-Ranges: bytes
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html
As you can see my cookie header was not included and there is 2 accept headers

Answer:

  1. Cookie is in your headers (myheader variable) twice.

  2. Do you have cookies disabled in MSIE?

  3. Basically the WinInet extender passes the information of MSIE. THen MSIE can alter the request before it leaves your computer.
All cookies are taken care of by MSIE - Which the WinInet extender piggy-backs onto.. It may be removing the cookie header and the stuff after it.

Resolution:

Turning on cookies in IE did it!
Article ID:   W14557
Filename:   Cookies Wont Go Through.txt
File Created: 2000:07:26:11:23:44
Last Updated: 2000:07:26:11:23:44