libs-base icon indicating copy to clipboard operation
libs-base copied to clipboard

NSProtocol additional sanity check

Open onflapp opened this issue 2 years ago • 3 comments

Prevent setting headers if key or value are nil. I've encountered an URL where headers are corrupted and this causes internal exception within NSURLConnection.

onflapp avatar Sep 01 '23 11:09 onflapp

Isn't this change (stopping the low level code from raising an exception) just hiding the actual issue? I would prefer to address the problem by making the higher level code check for it and refrain from setting bad header values. Perhaps the header is merely unusual rather than corrupt, but the parsing code is failing in some way? Can you provide a test case demonstrating the corrupt header (so we can see how that header is parsed/handled earlier on) ?

rfm avatar Sep 06 '23 12:09 rfm

Isn't this change (stopping the low level code from raising an exception) just hiding the actual issue? I would prefer to address the problem by making the higher level code check for it and refrain from setting bad header values. Perhaps the header is merely unusual rather than corrupt, but the parsing code is failing in some way? Can you provide a test case demonstrating the corrupt header (so we can see how that header is parsed/handled earlier on) ?

Yes this is possible, although I wasn't able to debug this. I encountered this problem while downloading one of the OpenStep Previous images. https://winworldpc.com/download/3fc5bdc2-bde2-80a2-533f-11c3a4c2a90f

onflapp avatar Sep 06 '23 12:09 onflapp

I changed NSURLResponse.m to warn about bad (missing) header values. Perhaps that will help determine where they are coming from?

rfm avatar Sep 06 '23 16:09 rfm

I made setting nil equivalent to setting an empty string as a header value (some servers seem to do that) and allowed it.

rfm avatar Apr 04 '24 12:04 rfm