Java.net.ProtocolException: Too many follow-up requests (FAULTY COOKIE)

I have this problem Too many follow-up , when I try to make an okhttp3 request , I found a similar problem on stackoverflow and GitHub and most of them pointed to authentication errors. but in my case they are different

that's what I'm doing:

Login into a website --> obtain cookie --> make okhttp3 request

when i do it from desktop it works fine but i get error when doing this same action from my android device

I tried to manually change the userAgent of my web browser, didn't work.

then i tried to make the same call (from my android device) with a Cookie that was received by Desktop and it worked, so I concluded that Android Cookie is causing the problem

So how can I solve this problem?

here's my code:

////LOGIN Completed///
final RequestBody requestBody = new MultipartBody.Builder()
        .setType(MultipartBody.FORM)
        .addFormDataPart("key1","value1")
        .addFormDataPart("key2","value2")
        .build();

   final Request request = new Request.Builder()
         .addHeader("Cookie",""+mCookie)
         .url("example.com/request.php")
         .method("POST", RequestBody.create(null, new byte[0]))
         .post(requestBody)
         .build();


 final Response response = client.newCall(request).execute();

      

+3


source to share





All Articles