Referer undefined validation - in requestOptions #107
Conversation
If the referer is undefined in the requestOption headers, the plugin terminates with a crash. Tested in windows 7, 64 bit with nodejs 0.12.*.
Can you provide a stack trace for the crash? I'd prefer to fix the crash itself than falsely inject a blank referrer value. (The undefined value can more accurately be used to determine that a referrer was not sent—as opposed to a blank referrer, which could be a header with no value.) |
Actually, it throws an error stating exactly where it invokes As you rightly said, sending an empty string wouldn't be a good way. Sorry for that. But will it be fine to remove the referrer if it is undefined? If fine then I can submit one for the same. |
I think the right solution would be to conditionally assign the referrer header, like so:
That should stop the crash. Then we'll need to add a regression test for it! |
Referer added to the header after an if condition check.
Thanks cgiffard! I did make the change and also tested the fix from my end. It works fine now. Have updated the commit either. May be it helps now |
Thanks Krishna! In order to ensure that I (or another contributor) don't accidentally reintroduce this bug, would you be able to assist by providing a regression test? I am happy to help you with this if required. |
Sure cgiffard, Let me know the process and I will try my best to help you with this. If you can point me, in what is expected from me, then I can definitely help you on this. |
…ion - in requestOptions
Adds regression test to: Referer undefined validation - in requestOptions #107
If the referer is undefined in the requestOption headers, the plugin terminates with a crash. Tested in windows 7, 64 bit with nodejs 0.12.*.
Added validation for the same.