Skip to content

Commit

Permalink
Be more paranoid about content type for new session
Browse files Browse the repository at this point in the history
It's possible we have an incoming request that doesn't
set the content type but is otherwise valid.
  • Loading branch information
shs96c committed May 21, 2017
1 parent 2ab61e1 commit 304f879
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,14 @@ private void readCapabilities(
Map<String, Object> ossKeys,
Map<String, Object> alwaysMatch,
List<Map<String, Object>> firstMatch) throws IOException {
String reqEncoding = req.getCharacterEncoding();
if (reqEncoding == null) {
// Assume utf8
reqEncoding = UTF_8.toString();
}

try (InputStream rawIn = new BufferedInputStream(req.getInputStream());
Reader reader = new InputStreamReader(rawIn, req.getCharacterEncoding());
Reader reader = new InputStreamReader(rawIn, reqEncoding);
Writer writer = Files.newBufferedWriter(allCaps, UTF_8);
Reader in = new TeeReader(reader, writer);
JsonReader json = new JsonReader(in)) {
Expand Down

0 comments on commit 304f879

Please sign in to comment.