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

poor error message on malformed media range #20

Open
GoogleCodeExporter opened this issue May 13, 2015 · 1 comment
Open

poor error message on malformed media range #20

GoogleCodeExporter opened this issue May 13, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I'm seeing this Accept header in the wild: 

`text/html,application/json;q=0.9application/xhtml+xml,application/xml;q=0.9,*/*
;q=0.8`

Note the `0.9application`, which I believe is an error and should be 
`0.9,application`. mimeparse.parse_media_range fails with `ValueError: invalid 
literal for float(): 0.9application/xhtml+xml`. I would expect instead an error 
message saying the header is malformed. Does mimeparse have a concept of strict 
and lenient parsing? Does it want one?

Original issue reported on code.google.com by whit537@gmail.com on 20 May 2013 at 3:44

@GoogleCodeExporter
Copy link
Author

Relatedly, it chokes on an Accept header (again, found in the wild) of:

'*/*;'

which again is arguably malformed.  So should mimeparse be doing its best to 
cope with these found-in-the-wild errors?  Or should it be throwing some kind 
of 'Malformed Header' exception? (So a server using it could raise a 400, for 
example?)

Original comment by pjimen...@gmail.com on 8 Oct 2013 at 3:52

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

No branches or pull requests

1 participant