I need the URLSession to be able to interpret non-compliant HTTP-like responses. The response may contain a non-standard status-line HTTP version (SOURCETABLE, instead of HTTP/1.1), may be missing a CRLF to separate the status-line and message body and may contain custom headers.
My thought is to intercept and modify the textual traffic to make it HTTP-compliant. How would I intercept and modify the traffic in Swift?
I'm considering intercepting and modifying the request to be optimal, since it requires the least amount of rewriting (reinventing the wheel with URLSession HTTP support). Alternatively, I've considered using a custom URLProtocol. However, this appears to require writing a lot of the HTTP parsing code.
1
0
991