Skip to content

Commit

Permalink
Use explicit instead of default encoding.
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
  • Loading branch information
spericas committed Oct 23, 2023
1 parent 1e86c50 commit 7d1f6c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ interface ListenerConfigBlueprint {
*
* @return proxy support status
*/
@ConfiguredOption("false")
@Option.Default("false")
boolean enableProxyProtocol();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static ProxyProtocolData handleV1Protocol(PushbackInputStream inputStream) throw

// protocol and family
n = readUntil(inputStream, buffer, (byte) ' ', (byte) '\r');
String familyProtocol = new String(buffer, 0, n);
String familyProtocol = new String(buffer, 0, n, StandardCharsets.US_ASCII);
var family = Family.fromString(familyProtocol);
var protocol = Protocol.fromString(familyProtocol);
byte b = readNext(inputStream);
Expand All @@ -124,22 +124,22 @@ static ProxyProtocolData handleV1Protocol(PushbackInputStream inputStream) throw

// source address
n = readUntil(inputStream, buffer, (byte) ' ');
var sourceAddress = new String(buffer, 0, n);
var sourceAddress = new String(buffer, 0, n, StandardCharsets.US_ASCII);
match(inputStream, (byte) ' ');

// destination address
n = readUntil(inputStream, buffer, (byte) ' ');
var destAddress = new String(buffer, 0, n);
var destAddress = new String(buffer, 0, n, StandardCharsets.US_ASCII);
match(inputStream, (byte) ' ');

// source port
n = readUntil(inputStream, buffer, (byte) ' ');
int sourcePort = Integer.parseInt(new String(buffer, 0, n));
int sourcePort = Integer.parseInt(new String(buffer, 0, n, StandardCharsets.US_ASCII));
match(inputStream, (byte) ' ');

// destination port
n = readUntil(inputStream, buffer, (byte) '\r');
int destPort = Integer.parseInt(new String(buffer, 0, n));
int destPort = Integer.parseInt(new String(buffer, 0, n, StandardCharsets.US_ASCII));
match(inputStream, (byte) '\r');
match(inputStream, (byte) '\n');

Expand Down

0 comments on commit 7d1f6c3

Please sign in to comment.