Git Product home page Git Product logo

Comments (5)

mousumikhatua avatar mousumikhatua commented on May 2, 2024 3

I am facing the similar issues.
I get multiple cookie sets with Set-Cookie headers.
In HurlStack.java line 122 - it's only considering the first one.
Need an API update so that I can get all the cookie values.

from volley.

jpd236 avatar jpd236 commented on May 2, 2024 3

I looked a little more at this while working on cleaning up Volley's Apache HTTP dependency, and I think it can be done without breaking the current API.

The new BaseHttpStack interface introduced by the above fix obtains a Map<String, List> of response headers instead of a Map<String, String> from the HTTP stack, which is the first step. From there, we can safely add a new Map<String, List field to NetworkResponse and deprecate the old one while still populating it for backwards compatibility with the first header for a particular key. We'd need to make a similar change to Cache.Entry and read in the duplicate keys in DiskBasedCache (which we can thankfully do without changing the on-disk format, since they're just stored as a flat list; the duplicate entries are dropped on read).

So all told, I think we should be able to fix this without breaking public API, which is good. If someone would like to send a PR for this, I'd recommend waiting until #2 is resolved and then following the above path. Otherwise I will try to get to this at some point soon.

from volley.

jpd236 avatar jpd236 commented on May 2, 2024 3

This should now be resolved in master and will make it to a 1.0.1-SNAPSHOT build soon.

NetworkResponse (and Cache.Entry) now includes an "allHeaders" field which is the raw list of all headers returned by the server and thus can include duplicates by name. You may iterate over this list if non-null to find all headers with a given name. This is not case-sensitive, FYI; I opted not to pre-process the list as a case-insensitive Map<String, List<String>> because that'd be a fairly expensive structure to create in the common case that clients don't actually care about reading multiple headers with the same key. So for example, if you want all "Set-Cookie" headers, I'd iterate through the full list for any Headers for which "Set-Cookie".equalsIgnoreCase(header.getName()).

If you are using a built-in HTTP stack (HurlStack/HttpClientStack), these fields should be populated and can be used directly.

If you are using another stack implementation, you will need to update the implementation atop the new BaseHttpStack for the new fields to be populated. There are some instructions on how to do this here: https://github.com/google/volley/wiki/Migrating-from-Apache-HTTP

Custom Network and Cache implementations would also need to be updated to populate the new fields. BasicNetwork and DiskBasedCache are fine.

from volley.

gonzadocarmo avatar gonzadocarmo commented on May 2, 2024

So, I'm seeing 2 ways here:

from volley.

jpd236 avatar jpd236 commented on May 2, 2024

#91 out for review to implement the approach described above.

from volley.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.