Java GAE UrlFetch; Ignore/Disable cookies when sending HTTP request

494 views
Skip to first unread message

ecbrodie via StackOverflow

unread,
Nov 13, 2012, 10:52:47 AM11/13/12
to google-appengin...@googlegroups.com

I am writing a Java GAE app that uses URL Fetch (via the HttpURLConnection class) in order to send HTTP requests to and receive HTTP responses from other web sites. One such site is the iTunes endpoint for verifying iOS in-app purchase receipts (see this link). After I have posted the request and I want to read response data back from the connection (HttpURLConnection.getResponseCode()), the following warning message prints in my logger:

13-Nov-2012 3:37:35 PM com.google.appengine.repackaged.org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 1][name: mzf_in][value: 990112][domain: .apple.com][path: /WebObjects][expiry: null]". Domain attribute ".apple.com" violates RFC 2109: host minus domain may not contain any dots
13-Nov-2012 3:37:35 PM com.google.appengine.repackaged.org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: mzf_odc][value: NK1][domain: .apple.com][path: /WebObjects][expiry: Tue Nov 13 11:08:24 EST 2012]". Illegal path attribute "/WebObjects". Path of origin: "/verifyReceipt"
13-Nov-2012 3:37:35 PM com.google.appengine.repackaged.org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: mzf_dr][value: 0][domain: .apple.com][path: /WebObjects][expiry: Wed Dec 31 19:00:00 EST 1969]". Illegal path attribute "/WebObjects". Path of origin: "/verifyReceipt"

Instead of wasting my time figuring out why Apple's cookies are being rejected by URL Fetch, I instead would rather just ignore these log output. I believe that the simplest way to do so would be to just ignore all cookies when I use URL Fetch. These warnings are very annoying in my log files, especially in my Jenkins console when I release a build to my team.

Is there such a way to do that -- to tell my HTTP request to ignore all incoming cookies in the response? I searched the web for an HTTP header to use: that would be the easiest way to get rid of the warnings. However, I cannot find such an HTTP header to ignore cookies. Is there one that exists? Also, is there some sort of URL Fetch method similar to HTTP Client's set Cookie Policy to IGNORE (http://stackoverflow.com/questions/8795911/httpclient-4-x-how-to-use-cookies) that I can use?

NB: I also came across this post, but I disagree that it is a duplicate: How to ignore cookies in App Engine URLFetchService?



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/13363939/java-gae-urlfetch-ignore-disable-cookies-when-sending-http-request
Reply all
Reply to author
Forward
0 new messages