I'm sure this is probably a very easy for most people, but I'm an academic so barely use things related to the web (in terms of programming). As such I was trying now to just get a simple API call but I keep getting this error which I have no idea why it is. I'm using the crate reqwest for the calls. Code can be found here: Rust Playground. On my machine I keep getting this error:
Sorry, not updating this and thanks to mbrubeck on IRC we discovered that the issue is that the website (bitstamp) provides a SetCookie header which contains non-US ASCII characters which is decaprated in header fields with an RFC. The hyper httparse crate enforces this strictly, hence the problem was in the response header rather than the one sending. Currently, except them fixing this I don't think there is any workaround.
Interesting - thanks for coming back to mention the root cause.
A couple of thoughts:
It seems the hyper message can be a bit clearer about what it didn’t like. At the very least, indicate that it’s some response (vs request) header. But ideally, it would include the actual header name. As it stands, this error is virtually useless as far as debugability is concerned.
How do browsers handle this? I’m guessing they’re lenient. Why is httparse taking such a strict stance on it?