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

Do not GZIP TCP stream #61

Merged
merged 1 commit into from
Jun 25, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/java/org/graylog2/GelfMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,18 @@ public ByteBuffer[] toBuffers() {
}

public ByteBuffer toBuffer() {
byte[] messageBytes = gzipMessage(toJson());
byte[] messageBytes;
try {
// Do not use GZIP, as the headers will contain \0 bytes
// graylog2-server uses \0 as a delimiter for TCP frames
// see: https://github.com/Graylog2/graylog2-server/issues/127
String json = toJson() ;
json += '\0';
messageBytes = json.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("No UTF-8 support available.", e);
}

ByteBuffer buffer = ByteBuffer.allocate(messageBytes.length);
buffer.put(messageBytes);
buffer.flip();
Expand Down