-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aiohttp proxy support #259
Comments
It seems to me that it might be caused by creating the ProxyConnector from within "async" functions. |
I think I have found a solution. The problem was indeed creating the ProxyConnector inside async calls. To workaround this I simply made a new module which declares the ProxyConnector and import it into all of the relevant python modules using aiohttp |
I added a "connector" parameter to all the aiohttp.request calls. I can write up the changes as soon as I really have it all worked out. Currently it seems to be working as long as you don't use folders inside google drive. I seem to be having an issue with files inside of folders wanting to use "%2F" instead of forward slashes in the URI causing it to not load. If I manually change it then it loads. Although I wonder if that has anything to do with using a version of the OSF that's several months old, maybe something changed in a dependency or the API google uses. |
Hey @jpkeith4! Can you give me an example of where you're running into this? Our googledrive provider definitely has some issues with encoding. We mostly work around this by using the file/folder IDs where we can. Cheers, |
[EDIT] Actually now that I think about it, this issue might be more related to OSF than waterbutler, however the proxy issue earlier was waterbutler related [/EDIT] For example, just trying to open a text file stored in Google Drive. If the textfile is not inside any folder but just at the lowest level in Google Drive then OSF loads and renders it properly. However if it is located inside a folder in Google Drive and I click to access it then there is a 404 and the URI shows
If I manually change it to
in the address bar then it loads the page and displays the file. |
Well for the time being I'll post the specific changes I did, although it still doesn't completely work. The reason I did it this way is because adding a proxy connector inside the async calls seems to cause issues, so the idea was basically just to create the proxy connector outside of async calls and since I don't know the code very well it seemed like importing a module would be the simplest way. So I just created the file
Then I go to every file which makes a "aiohttp.request" call and at the top I add This mostly seems to solve the issues and allow storage services to connect, file uploads work, deleting files works, but there is an issue with renaming the files. When attempting to rename a file I get the error: |
Hey @jpkeith4, This is a shot in the dark, but it looks like the Cheers, |
Got it working, your suggestion helped a lot actually, thanks.
Where the "proxy_workaround.py" module is:
|
There seems to be no support for proxies when communicating with external storage services such as Google Drive. In the file:
waterbutler/core/provider.py
for instance I can see aiohttp being used to make a request:but aiohttp doesn't have built-in support for using proxies, so it must manually be coded in like:
just as an example. This seems to allow an initial connection to be created from behind a proxy, however it seems to fail shortly after so I'm guessing either there are more places in the code that also need proxy support or the above example isn't the most correct way to do it.
The error given on a failed requests (when using the ProxyConnector example above) is:
Ideally I suppose the best solution would be to read environment variables such as $HTTP_PROXY and $NO_PROXY to decide whether to apply proxies or not. Although I'm not sure why the aiohttp library isn't already doing this itself as its fairly standard.
The text was updated successfully, but these errors were encountered: