[Development] QTBUG-35892. QML XMLHttpRequest does not support the OPTIONS method.

Валерий Котов kotov.valery at gmail.com
Wed Sep 3 19:31:04 CEST 2014


2014-09-03 20:10 GMT+03:00 Thiago Macieira <thiago.macieira at intel.com>:
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, cons
>> 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.
Ok. Does that mean that from qml call should be like the following?
x.open("OPTIONS", "http://example.com/");      // for request with url
x.open("OPTIONS", "http://example.com");      // for request with asterisk

>> 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.
Ok. Thank you.

>> 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.
I'm a little unsure that I understood. Could you please clarify what did
you mean by "represented in HTML5"?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140903/8e2ccf15/attachment.html>


More information about the Development mailing list