-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop cookies from duplicating on each item processed #12
base: master
Are you sure you want to change the base?
Stop cookies from duplicating on each item processed #12
Conversation
As opposed to appending individual cookies each time which causes duplicate cookies to be added to requests until they are too long to send. Note that there was some logic initially for excluding certain cookies. This doesn't seem to be required for EBI to work, requests work correctly either way. The removed snippet was added when attempting to support self-signed SSL and I have tested that self-signed SSL still works after this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine to me. Just one thing though... If you blitz the cookie jar with the last response, could that mean you might loose a session cookie etc?
When you start importing it runs a login again and grabs the token at the start so that isn't a problem, the problem persists over individual items but not over multiple import runs. So it works like:
|
Hmmm, yeah that was the scenario I was concerned about. But perhaps oEQ is returning the session cookie with every response and so the problem is avoided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SammyIsConfused has confirmed the session cookie is returned in every response, so this should be good to go.
Looks like you'll probably want to build/do a release for this. |
The purpose of this PR is to change how cookies are grabbed from server responses and appended to future requests.
So previously these would be appended to the cookie jar on each iteration, which causes a duplicate of each cookie per item imported until the requests are too long to be sendable as the cookie jar is maintained between each item processed.
My fix for this involves simply grabbing the set-cookie value from the header and using that as the contents of the cookie jar, replacing the contents of the jar rather than appending to it.
Note that the way this previously was supposed to work was to only append cookies that were not "PATH", "DOMAIN", "EXPIRES", "SECURE", or "HTTPONLY" cookies. Not only did this not seem to be working (these cookies would still appear in the cookie jar and get duplicated) but these cookies do not seem to prevent EBI from working at all. If it turns out that this is required I can work to retain this logic but after a chat with @nelson-edalex and some testing it doesn't appear to be al that necessary.
The snippet that this PR replaces was added in this commit when adding support for self-signed certificates, and so I have tested with an openEQUELLA using self-signed certificates as well as real certificates and can confirm that it still works both ways.
This bug was found when testing openEQUELLA using AWS Load Balancer, which adds two cookies AWSALB and AWSALBCORS to the header. These were quite long and so after duplicating 10 times or so the cookies would be too long to send a request, limiting the amount of items that can be processed at once to just 10. I have tested against AWS LB with over a hundred items and confirmed that this no longer happens.
It would be beneficial to get @nelson-edalex to test this too as this tool is used heavily in consulting and the change was as a result of a bug found by him.