Referrer-Policy Header by gsquire · Pull Request #920 · hyperium/hyper
-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Conversation
Instead of parsing one value in the ReferrerPolicy struct, allow for a list and use the last value. I believe this is what the ticket mentions, but I could have misinterpreted.
Closes #882
This isn't quite right - this still only looks at the very last comma-separated values and ignores the others. We want to return the rightmost value that is successfully recognized - this implies that we either need to iterate left to right and track the most recent successful parse, or iterate right to left and return the first value that is successful.
Ah I see.
I think the ideal way to do that would be to scan right to left checking the value each time and returning the first valid one. I will make that change. Thanks for your input.
@gsquire it would also help here to include a test in this module of this behavior
I don't think my solution is elegant so I am open to suggestions on improving it.
I also rebased onto master.