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 fileNow this is what the request looks likeGET /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-AliveThen the winbatch servers replyHTTP/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/htmlAs you can see my cookie header was not included and there is 2 accept headersAnswer:
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.
- Cookie is in your headers (myheader variable) twice.
- Do you have cookies disabled in MSIE?
- Basically the WinInet extender passes the information of MSIE. THen MSIE can alter the request before it leaves your computer.
Resolution:
Turning on cookies in IE did it!
Article ID: W14557Filename: Cookies Wont Go Through.txt