This repository has been archived by the owner on May 17, 2021. It is now read-only.
add optional headers functionality to http binding cache items in the main configuration file. #1371
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I know this is more a feature than a bug, but I would wish it on a stable code base, it can be used as soon as possible.
My use case is, that I need to send a login cookie in a HTTP request. Because I need several items with the same request, it makes sense to cache that, to be sure the box will won't explode due to many requests ;)
I made it with as less changes as possible, that's the reason why the
parseHttpHeaders
function now exists twice in the binding.Let me know if I should change that and were you would like to have the public static
parseHttpHeaders
function in that case.One side note:
I have seen that in the current code,
Matcher
is always used like this:but in my opinion the following would do the same:
What me confused, was that I sometimes hat trouble with the first example, but didn't find a good reason why. In my opinion both should work, but the first has a bit overhead.
Maybe I can learn something new and get an explanation, because I'm not a full time java developer :)
Let me know if i should change anything and would be great if this pull request would find the way to master to (or do I need to pull it there too?)
A second side note:
If I find the time to extend this a bit more, I would also suggest to allow REGEX in the cache item, so the retrieved string could be stripped down to the minimum required in the cache to save memory. Because if you rely heavily on cache item from damn big ugly html sites, than this would consume a lot of memory, especially for embedded devices.