NetworkAccessManager was getting pretty complex, and adding something
that modifies or intercepts requests is becoming a common change.
This change introduces a chain of handlers which can modify a request or
return a response of their own.
To start with, this extracts the concerns of fixing missing content
types, setting custom headers, and intercepting blacklisted requests.
Destroying the NetworkAccessManager seems to result in "terminate called
without an active exception" segfaults. The documentation states that an
application requires only a single single NetworkAccessManager.
The behavior of QWebFrame::toPlainText is undefined if the content
contains non-Latin1 characters. In Qt 5, additional MIME types are
considered supported, so there's no way to get at the raw data when
unsupported content has been loaded. Instead, proxy network replies
through NetworkReplyProxy which provides repetitive reads.
QWebFrame::url() does not return a valid URL for iframes. We can't just
look up the requested URL in m_responses because the request may have
been redirected, so instead we keep track of redirects and set up the
NetworkResponse when the final reply is received.
Adds a SetBlacklist command that takes a list of URLs
which will be black listed by the WebKit Server. When
a request is made to one these URLs webkit_server will
intercept the request and return a NoOpReply which contains
no content.
reuse the existing manager and just clear its headers and cookies.
This avoids repeatedly setting up the SIGNAL/SLOT callback stuff which
is leading to unclosed pipes on Ubuntu, eventually causing "too many
open files" errors in large test suites.