DaveAKing / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

MediaType isn't lenient enough for real-world media types #1726

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm doing some web crawling with OkHttp, and I ran into some Content-Type 
declarations that are malformed but harmless. Most notable is the malformed 
media type on http://netscape.aol.com.

  Content-Type: text/html;;charset=utf-8

I fixed OkHttp's MediaType to handle this case, and also the case of a dangling 
semi-colon that also appears in-the-wild. You may want to do the same with 
Guava, or not, depending on how strict you want to be.

Original issue reported on code.google.com by limpbizkit on 14 Apr 2014 at 2:19

GoogleCodeExporter commented 9 years ago
Hey Jesse... are you thinking of some sort of MediaType.parseLenient() option?

Original comment by kevinb@google.com on 14 Apr 2014 at 10:31

GoogleCodeExporter commented 9 years ago
That would work. Or you could just change the existing parse() to support 
unnecessary semicolons. (Postel's law).

Original comment by limpbizkit on 14 Apr 2014 at 10:58

GoogleCodeExporter commented 9 years ago
Or introduce .parseStrict()?

Original comment by fgalie...@gmail.com on 14 May 2014 at 6:27

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:09

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07