[Qt-interest] Remove Headers from QNetworkRequest

Thiago Macieira thiago at kde.org
Fri Nov 12 16:09:25 CET 2010


Em Sexta-feira, 12 de Novembro de 2010, às 11:31:17, siteshwar at gmail.com 
escreveu:
> Hello,
> 
> I'm trying to send http request using QNetworkRequest, and it automatically
> adds following headers to my http request:
> 
> Connection: Keep-Alive
> Accept-Encoding: gzip
> Accept-Language: en-IN,*
> 
> How can I stop QNetworkRequest from adding these headers ?

Why don't you want those headers?

The Connection and Accept-Encoding headers are transport ones. You don't see 
the difference and it's entirely handled by the QNAM architecture for you. The 
Connection one is required for HTTP/1.0 servers, whereas the Accept-Encoding 
would reduce your transfer size by compressing the data.

The Accept-Language one is added because we found that many servers didn't 
work properly without. You can turn it off by setRawHeader("Accept-Language", 
QByteArray());

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101112/d5773c4e/attachment.bin 


More information about the Qt-interest-old mailing list