Skip to content
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

[Bug] [HTTP] Multipart requests fail when attempting to read them, because they were already read #1814

Open
technomunk opened this issue Oct 4, 2023 · 0 comments
Labels
bug Bug reports web server Functionality related to the web server serving HTTP requests and websockets

Comments

@technomunk
Copy link
Contributor

technomunk commented Oct 4, 2023

Issue

Attempting to call reading functions on a multipart web request in a handler will result in Could not find starting boundary in ... aiohttp error.

Replication

Server

from aiohttp import web
import tomodachi

class Service(tomodachi.Service):
    @tomodachi.http(("POST",), "/bug")
    async def http_example(self, request: web.Request) -> None:
        data = await request.post()

Client

import asyncio
import aiohttp

async def replicate_fault() -> None:
  session = aiohttp.ClientSession(base_url="localhost:...")  # needs the port where the tomodachi service is running
  with open(..., "rb") as f:  # any file
      await session.post("/bug", {"file": f})

asyncio.run(replicate_fault())

Note

As far as I understand the issue stems from this request.read() call

@kalaspuff kalaspuff added bug Bug reports web server Functionality related to the web server serving HTTP requests and websockets labels Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports web server Functionality related to the web server serving HTTP requests and websockets
Projects
None yet
Development

No branches or pull requests

2 participants