I'm writing an Android client that is supposed to communicate with a web application (running on appengine with webapp2). The client sends POST request on the server and needs to authenticate first.
The application stores authentication tokens as session cookies. Those cookies have an equality sign in their value. For example
Set-Cookie: auth=bsoq64sesba=als|sadasd|sdads
I'm using HttpURLConnection on the client side. The problem is that the cookies get truncated if they contain the equality sign. So when the next request is sent, the server receives the following cookie:
auth=bsoq64sesba
Which is useless of course. Is there any way to properly receive cookies with an equality sign in their value?
Here is the code that sends requests
/*The cookie store is initiated once, before the first request*/
CookieManager cookieManager = new CookieManager();
CookieHandler.setDefault(cookieManager);
/*Prepare the connection*/
URL url = new URL(address);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(true);
connection.setChunkedStreamingMode(0);
/*Write request body*/
OutputStream ostream = connection.getOutputStream();
ostream.write(postBody);
ostream.flush();
/*Read response*/
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String responseContents = "";
String line;
while ((line=reader.readLine())!=null) responseContents+=line;
return responseContents;