[Qt-interest] Breaking the authenticationRequired loop
Thiago Macieira
thiago.macieira at trolltech.com
Mon Aug 10 23:25:04 CEST 2009
Brian Zambrano wrote:
>Hi all,
>
>I'm working with a webservice which requires a valid username/password
>for every call. From Qt (PyQt, really), I'm accessing the webservice
>using
>QNetworkAccessManager which emits the
>
>"authenticationRequired (QNetworkReply*, QAuthenticator*)"
>
>signal when (obviously), authentication is required. When I fill in
>the a valid user/passwd for QAuthenticator, everything works fine.
>However, I can't see an obvious way to break the loop when the user is
>*not* valid. From the docs for authenticationRequired:
>
>"If it rejects the credentials, this signal will be emitted again."
>
>Invalid credentials means this signal is emitted again, and again, and
>again....looking at the error code in the reply showed 0. How is this
>case supposed to be handled so it terminates with an error? I know I
>can say reply.abort(), but how is it supposed to be determined that
>this particular signal was emitted from invalid credentials?
If the credentials are not accepted by the server, the signal will be
emitted again.
If you have no new credentials to set, just don't set any. If you don't
set credentials, QNAM will give up and will just give you the 401 error.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Development Frameworks
Sandakerveien 116, NO-0402 Oslo, Norway
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090810/8eb8a681/attachment.bin
More information about the Qt-interest-old
mailing list