Note that there are some explanatory texts on larger screens.

plurals
  1. POHttpPost: No "Set-Cookie" Header
    primarykey
    data
    text
    <p>I want to get the session cookie of a website. Unfortunately the "Set-Cookie"-Header doesn't show up. </p> <p>Here's the code I've written: "commands" is a String[][] and the whole code is wrapped by try/catch.</p> <pre><code>CookieStore cookieStore = new BasicCookieStore(); HttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE,cookieStore); HttpPost httppost = new HttpPost(url); List&lt;NameValuePair&gt; nvps = new ArrayList&lt;NameValuePair&gt;(0); for (int i=0;i&lt;commands.length;++i) nvps.add(new BasicNameValuePair(commands[i][0],commands[i][1])); httppost.setEntity(new UrlEncodedFormEntity(nvps,HTTP.UTF_8)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); Header[] headers = response.getAllHeaders(); List&lt;Cookie&gt; cookies = cookieStore.getCookies(); String data = EntityUtils.toString(entity); </code></pre> <p>My understanding of Http Communication tells me that there should be a "Set-Cookie" Header. The only Headers I get from response.getAllHeaders() are Connection:close, X-Powered-By:PHP/4.3.4 and Content-Type:text/html</p> <p>There is a bit of javascript included in the returned data (response.getEntity()).</p> <pre><code>&lt;script language = "javascript"&gt; &lt;!-- location.href="/index.php"; function SetCookie(name,value,expire,path){ document.cookie = name + "=" + escape(value) + ((path == null) ? "":(";path="+path)) } var iad = 461180104 SetCookie("iad",iad,0,"/") --&gt; &lt;/script&gt; </code></pre> <p>As far as I understand this, this code is never executed because it's just a comment ?! But as well this is probably the bit where the cookie should be created.</p> <p>Any ideas?</p> <p>UPDATE: "Opera Mobile" is the only browser for Android I found which has no problem with cookies on this site. "Opera Mini", "Dolphin HD" and the Froyo Stock browser all fail. No Desktop browser has problems connecting. Is this a webkit issue? And if this is the case: how to avoid it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload