Skip to content

Commit

Permalink
Relax Base64 Decoding
Browse files Browse the repository at this point in the history
Strict decoding breaks Base64 MIME encodings, which place newlines after
a certain number of spaces. MIME encoding is commonly used by Java
Clients.
  • Loading branch information
Hans Viken Duedal committed Aug 22, 2019
1 parent 3a45042 commit 11f51f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/json_request_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ JsonRequestTranslator::JsonRequestTranslator(
stream_translator_.reset(new RequestStreamTranslator(
*type_resolver, output_delimiters, std::move(request_info)));
writer = stream_translator_.get();
writer->set_use_strict_base64_decoding(false);
translated = stream_translator_.get();
} else {
// No streaming - use a RequestMessageTranslator
message_translator_.reset(new RequestMessageTranslator(
*type_resolver, output_delimiters, std::move(request_info)));
writer = &message_translator_->Input();
writer->set_use_strict_base64_decoding(false);
translated = message_translator_.get();
}
parser_.reset(new pbconv::JsonStreamParser(writer));
Expand Down
3 changes: 3 additions & 0 deletions src/request_message_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ RequestMessageTranslator::RequestMessageTranslator(
writer_pipeline_ = prefix_writer_.get();
}

// Relax B64 to support MIME B64
writer_pipeline_->set_use_strict_base64_decoding(false);

if (output_delimiter_) {
// Reserve space for the delimiter at the begining of the message_
ReserveDelimiterSpace();
Expand Down

0 comments on commit 11f51f7

Please sign in to comment.