mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
patches from richard: fix typo, more robust proxy error checking
This commit is contained in:
parent
d0be463cc6
commit
e8fd6922a0
2 changed files with 21 additions and 2 deletions
|
@ -71,8 +71,25 @@ class GetShared(QDialog):
|
|||
self.parent.setProgressParent(None)
|
||||
self.form.search.setFocus()
|
||||
if err:
|
||||
errorString = self.http.errorString()
|
||||
else:
|
||||
# double check ... make sure http status code was valid
|
||||
# this is to counter bugs in handling proxy responses
|
||||
respHeader = self.http.lastResponse()
|
||||
if respHeader.isValid():
|
||||
statusCode = respHeader.statusCode()
|
||||
if statusCode < 200 or statusCode >= 300:
|
||||
err = True
|
||||
errorString = respHeader.reasonPhrase()
|
||||
else:
|
||||
err = True
|
||||
errorString = "Invalid HTTP header received!"
|
||||
|
||||
if err:
|
||||
if self.parent.config['proxyHost']:
|
||||
errorString += "\n" + _("Please check the proxy settings.")
|
||||
showInfo(_("Unable to connect to server.") + "\n" +
|
||||
self.http.errorString(), parent=self)
|
||||
errorString, parent=self)
|
||||
self.close()
|
||||
return
|
||||
data = self.http.readAll()
|
||||
|
|
|
@ -1956,6 +1956,8 @@ it to your friends.
|
|||
msg = _("""\
|
||||
<h1>Sync Failed</h1>
|
||||
Couldn't contact Anki Online. Please check your internet connection.""")
|
||||
if self.config['proxyHost']:
|
||||
msg += _(" Also check your proxy settings.")
|
||||
if self.config['syncInMsgBox']:
|
||||
ui.utils.showWarning(msg)
|
||||
else:
|
||||
|
@ -2592,7 +2594,7 @@ Consider backing up your media directory first."""))
|
|||
proxy.setPort(self.config['proxyPort'])
|
||||
if self.config['proxyUser']:
|
||||
proxy.setUser(self.config['proxyUser'])
|
||||
proxy.setPass(self.config['proxyPass'])
|
||||
proxy.setPassword(self.config['proxyPass'])
|
||||
QNetworkProxy.setApplicationProxy(proxy)
|
||||
# python
|
||||
proxy = "http://"
|
||||
|
|
Loading…
Reference in a new issue