Coder Social home page Coder Social logo

okumy / aiohttp-tus Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 7.0 902 KB

tus.io protocol implementation for aiohttp.web applications

Home Page: https://www.okumy.com/

License: BSD 3-Clause "New" or "Revised" License

Makefile 3.74% Python 96.26%
aiohttp aiohttp-server python-3 python-3-6 python-3-7 python-3-8 python-library tus tus-protocol

aiohttp-tus's Issues

Support Cors headers

There doesn't seem to be any way currently to add CORS headers

I tried doing this with aiohttp-cors and received an error like this:

<PlainResource 'tus_upload_L3VwbG9hZHM_'  /uploads> already has OPTIONS handler <function upload_options at 0x7fa21b527670>

Please provide example with CORS

Hello, I have a setup with an API service on one port, and the webui on another port. I cannot, for the life of me, get this setup to work with CORS. Can you please provide an example of the correct way to do this?

aiohttp moved _Handler to typedefs.Handler

from aiohttp.web_middlewares import _Handler as Handler

Just noticed this today:

ImportError: cannot import name '_Handler' from 'aiohttp.web_middlewares' (/usr/local/lib/python3.8/dist-packages/aiohttp/web_middlewares.py)

I poked around in the aiohttp commit history and saw this one: aio-libs/aiohttp@1b45c73#diff-b756d284fe20863e4e6a5fdfa7a6f460e7f0699f4b3d658f5049be5ee821ab31

It looks like aiohttp.web_middlewares._Handler may have moved to aiohttp.typedefs.Handler

No port forwarding in Location header

I'm using aiohttp-tus behind nginx. here is my nginx config:

location ~ ^/uploads.*$ {
         proxy_pass http://localhost:7010;
         proxy_request_buffering off;
         proxy_buffering off;
         proxy_http_version 1.1;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-Host $host;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Port $server_port;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
         client_max_body_size 0;
      }

Now I'm trying an upload via tusjs-client in my angular 11 application running on a specific port locally.
The POST works as expected.
The following upload requets seem to work for default port 443.
But if I'm run my application on a different port the Location header on upload response is wrong because the port is missing in URL.

Is this a bug or something missing in my nginx config?

How to handle dynamic upload folder path?

upload_path currently only takes in a static path which can be augmented by a the username (match_info)

How would I do some async function + db call to get a user's upload directory instead?

Maybe upload_path could take in a lambda function as well?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.