Unsupported Redirect (303) while fetching plugins
rparree opened this issue · comments
Hi,
I'm getting a 303 error when the role tries to fetch plugins.
msg: 'Unsupported HTTP response for: https://plugins.jetbrains.com/pluginManager/?action=download&build=IU-203.7717.56&id=com.chrisrm.idea.MaterialThemeUI (status=303)'
I checked with cUrl and the service above redirects to the file download:
$ curl -I https://plugins.jetbrains.com/pluginManager/\?action\=download\&build\=IU-203.7717.56\&id\=org.intellij.scala | grep Location
HTTP/2 303
…
location: /files/1347/113954/scala-intellij-bin-2020.3.23.zip?updateId=113954&pluginId=1347&family=INTELLIJ&code=IU&build=203.7717.56
…
I've had this problem for a long time. Tried using the latest version, but to no avail.
tx
I suspect the reason that com.chrisrm.idea.MaterialThemeUI
fails to download is it's a paid plugin.
The plugin org.intellij.scala
installed fine when I tried it (this role handles the redirect).
Since I don't pay for any plugins (nothing against paid plugins - just haven't found one I wanted), I've not tested them with this role. I suspect you'd need to send a username & password/token to download them. They'd be a pain to test and support, so I don't plan on adding support to this role.
Sorry, but you're welcome to fork the role if you want to add support for paid plugins.
Sorry to have included a plugin that has paid features as well. I removed it. But that does not effect the "Unsupported HTTP response" on other plugins.
'Unsupported HTTP response for: https://plugins.jetbrains.com/pluginManager/?action=download&build=IU-203.7717.56&id=org.intellij.scala (status=303)'
I created a draft PR to test support for the Scala plugin: https://github.com/gantsign/ansible-role-intellij/runs/2432532128?check_suite_focus=true it does install correctly.
I suspect the most likely issue is you're using an older version of this role. If you're installing behind a corporate firewall/proxy that may also be the cause of the issue.
I already tried updating everything: this role, ansible, url/request based python libraries on the target host.
Still same error that it does not expect a redirect 303 (which it should, as that is what the cURL also shows)
I just started using Ansible to configure Intellij, and ran into this problem.
I dug into it, and the problem seems to be that for some plugins, when the script runs get_plugin_info(), the response header for the 303 HTTPError includes two Set-Cookie entries. When it tries to unpack that in fetch_url() to update the info dictionary, it throws a KeyError, and doesn't include any of the header info, in particular the 'Location' of the redirect.
Without a 'Location' in info, it fails with 'Unsupported HTTP response'. If fetch_url was able to filter or ignore duplicate keys in the HTTPError header, that should fix it.
@abandurka-calian thanks for the help. I've made some changes to fetch_url()
to improve Python 3 compatibility. I wasn't able to reproduce the issue myself (and I'm testing on Python 3), so I can't be certain it'll fix the issue, but give version 6.4.0
a go and let me know.
@freemanjp That looks like it did the trick. All my plugins installed properly. Thanks!
@freemanjp i can also confirm this solved the problem.
tx
Great, thanks @rparree and @abandurka-calian .