[Development] QTBUG-35892. QML XMLHttpRequest does not support the OPTIONS method.
Thiago Macieira
thiago.macieira at intel.com
Wed Sep 3 19:10:29 CEST 2014
On Wednesday 03 September 2014 20:05:20 Валерий Котов wrote:
> Greetings everybody!
>
> I'm working on QTBUG-35892 (
> https://bugreports.qt-project.org/browse/QTBUG-35892) feature request:
> adding support for HTTP OPTIONS method for QML XmlHttpRequest class.
>
> >From discussion with Richard Moore and Thiago Macieira I understood that 2
>
> methods should be added to QNetworkAccessManager class: for "OPTIONS URL"
> and for "OPTIONS *" requests.
>
> In my understanding in should be something like the following:
> QNetworkReply *resourceOptions(const QNetworkRequest &request, QIODevice
> *data);
> QNetworkReply *resourceOptions(const QNetworkRequest &request, const
> QByteArray &data);
> QNetworkReply *commonOptions(const QNetworkRequest &request, const QIODevice
> *data);
> QNetworkReply *commonOptions(const QNetworkRequest &request, const
> QByteArray &data);
Actually, I'm going back on what I had said. I think we can do
sendCustomRequest for both types of requests. The difference would be that
http://example.com sends OPTIONS * to example.com, but http://example.com/
sends OPTIONS / to example.com.
> We also should reject "OPTIONS *" request when HTTP proxy is in use.
> Unfortunately, I'm a little unsure what exactly should we do to reject the
> request.
> Should we check if HTTP proxy is in use inside commonOptions and return 0?
No.
> Or should this check be performed later when we create http header (e.g. in
> QHttpProtocolHandler::sendRequest or QHttpNetworkRequestPrivate::header)?
As soon as you realise a proxy is in use and this request can't work, cause
the QNetworkReply to fail.
> How "OPTIONS *" call should be represented in QML? Should it be something
> like this:
> var x = new XMLHttpRequest;
> x.open("OPTIONS", url); // for request with url
> var x = new XMLHttpRequest;
> x.open("OPTIONS *", url); // for request with asterisk
How is it represented in HTML5?
Just do it the same way.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list