[Development] QNetworkRequest: allow overriding connect host

Justin Karneges justin at affinix.com
Fri May 10 01:44:10 CEST 2013


Hi people,

I discussed this feature with Shane and went ahead and made a patch.

The idea is to be able to explicitly specify a TCP host/port target for 
an HTTP request, while leaving everything else alone. The HTTP Host 
header, TLS certificate validation, and TLS server name indication would 
all go against the host from the URL.

I personally need this feature so I can enforce IP address restrictions 
on HTTP requests. My application resolves the host from the URL in 
advance, and if the IP address is allowed then I use it as the connect 
host when the request is made. Currently, I'm making this work in my 
application by rewriting the URL to contain the IP address and then 
overriding the HTTP Host header with the original host. Unfortunately, 
that approach doesn't work for https URLs. My patch makes things cleaner 
and works with https.

The feature could also be useful in testing environments. And in 
general, manual connect host overrides are handy to have in protocol 
network libs just in case.

Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qnetworkrequest_connecthost.diff
Type: text/x-patch
Size: 17479 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130509/75505933/attachment.bin>


More information about the Development mailing list