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

Unexpected character in root json response #130

Closed
mauri870 opened this issue Jan 28, 2019 · 7 comments
Closed

Unexpected character in root json response #130

mauri870 opened this issue Jan 28, 2019 · 7 comments
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@mauri870
Copy link
Contributor

mauri870 commented Jan 28, 2019

After issuing the command curl -X GET http://localhost:8080 -output - the following response is returned by toshi:

){"name":"Toshi Search","version":"0.1.1"}

As you can see, this is invalid json, there's an aditional character at the start of the response and it vary between: -, +, ,, ), etc. I don't know why it's returning this, seems like garbage to me. Removing the Deflate middleware somehow solves the problem. If you try to change the name in ToshiInfo the initial byte changes too, pretty strange.

@LucioFranco
Copy link
Member

hmm this is odd @hntd187 do you have any idea of what is going on?

@mauri870
Copy link
Contributor Author

My guess is a leak of some sort, maybe in unsafe code? I don't know. Rust allowing garbage to be thrown somewhere is very unusual. As I've said, removing the Deflate middleware seems to solve the problem.

@LucioFranco
Copy link
Member

@mauri870 that is strange, I won't have time this week to see if I can isolate this. but that would probably be the best action forward and then we can bring it up with carl who wrote tower-web.

@hntd187
Copy link
Member

hntd187 commented Jan 28, 2019

hmm yea that's super odd, yea, its probably best to remove the deflate until we can pin that down it seems like an off by 1 error in whatever buffer deflate uses or the buffer isn't cleared entirely on request. I'm not sure I'll have to investigate as well.

@hntd187 hntd187 added bug Something isn't working invalid This doesn't seem right labels Jan 28, 2019
@mauri870
Copy link
Contributor Author

Well guys, I tried to recreate the same scenario as the root handler and use the deflate middleware with a new tower-web project and I can't reproduce the issue. I'ts definetely related to some weird thing in toshi.

@mauri870
Copy link
Contributor Author

Nvm, it's related to tower-web. I'll open an issue and link to here.

@mauri870
Copy link
Contributor Author

Well, that's unfortunate. I just forget to add --compressed to curl 🤦‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants