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

Could not find starting boundary #5558

Closed
zhoujinhai opened this issue Mar 23, 2021 · 0 comments
Closed

Could not find starting boundary #5558

zhoujinhai opened this issue Mar 23, 2021 · 0 comments
Labels

Comments

@zhoujinhai
Copy link

zhoujinhai commented Mar 23, 2021

🐞 Describe the bug

I am used aiohttp as a client and a server to File Uploads,The server raised an error when I add headers in post request。

Could not find starting boundary b'--dd7db5e4c3bd4d5187bb978aef4d85b1'

💡 To Reproduce

environment

python: 3.7.4
aiohttp: 3.7.4.post0
windows10

server

...
print("Enter form-data")
print("req header: ", request.headers)
data = await request.post()
file_data = data["file"]

client

1、Not work

async with aiohttp.ClientSession() as session:
    async with session.post(
            url='http://{}:{}/mesh/recognize'.format(web_ip, web_port),
            data=file_data,
            headers={'Content-Type': 'multipart/form-data; boundary=dd7db5e4c3bd4d5187bb978aef4d85b1'}
    ) as resp:

console:

Enter form-data
req header: <CIMultiDictProxy('Host': '192.168.102.116:8000', 'Content-Type': 'multipart/form-data; boundary=dd7db5e4c3bd4d5187bb978aef4d85b1', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.7 aiohttp/3.7.4.post0', 'Content-Length': '364927')>
Could not find starting boundary b'--dd7db5e4c3bd4d5187bb978aef4d85b1'
---** predict is Failed **---

2、 work

async with aiohttp.ClientSession() as session:
    async with session.post(
            url='http://{}:{}/mesh/recognize'.format(web_ip, web_port),
            data=file_data) as resp:

console:

Enter form-data
req header: <CIMultiDictProxy('Host': '192.168.102.116:8000', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.7 aiohttp/3.7.4.post0', 'Content-Length': '364927', 'Content-Type': 'multipart/form-data; boundary=dd7db5e4c3bd4d5187bb978aef4d85b1')>
out: torch.float32
Predict result :tensor([[[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
[5.0122, 4.7581, 4.8532, ..., 4.7490, 4.6256, 4.8851]]]),
run time is 3054.393768310547ms
---** predict is Successed! **---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants