I'm working on a Google Chrome extension that does some processing based on HTTP response headers using the chrome.webRequest.onHeadersReceived
event. I'm able to receive the headers, but the documentation seems to indicate that the headers are just represented as simple string name-value pairs.
The values for some HTTP headers, particularly Content-Type
and Content-Disposition
in my case, can store multiple pieces of information, including parameters with special mechanisms to escape characters. I want to be able to semantically interpret the header values rather than just see them as strings.
However, I don't want to have to write my own HTTP header value parsing code to meet the HTTP specifications and be able to cope with real-world values; I consider this an entire project of its own, and I want to focus on developing my extension.
How can I achieve this?