diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-10-01 12:03:31 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-10-01 12:12:44 (GMT) |
commit | 0b24f1996debc24a9af2bd1dc921f347506ac32c (patch) | |
tree | a8ee4c0be06fe9154ad3831d58ea19ff4fe6a5ec /src/network | |
parent | 58344e4fc4503e20c1eb0f8d97986bae5f1f4f71 (diff) | |
download | Qt-0b24f1996debc24a9af2bd1dc921f347506ac32c.zip Qt-0b24f1996debc24a9af2bd1dc921f347506ac32c.tar.gz Qt-0b24f1996debc24a9af2bd1dc921f347506ac32c.tar.bz2 |
QNAM HTTP Code: Always send an Accept-Language header
Send a header that we accept every language. Works around a bug in some
broken websites and is hopefully of no harm for us.
Task-number: QT-952
Reviewed-by: Thiago
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 4fcbc1f..aef1258 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -244,6 +244,15 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) request.d->autoDecompress = false; #endif } + + // some websites mandate an accept-language header and fail + // if it is not sent. This is a problem with the website and + // not with us, but we work around this by setting a + // universal one always. + value = request.headerField("accept-language"); + if (value.isEmpty()) + request.setHeaderField("accept-language", "en,*"); + // set the User Agent value = request.headerField("user-agent"); if (value.isEmpty()) |