Skip to content

Commit 7d1f6c3

Browse files
committed
Use explicit instead of default encoding.
Signed-off-by: Santiago Pericasgeertsen <[email protected]>
1 parent 1e86c50 commit 7d1f6c3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

webserver/webserver/src/main/java/io/helidon/webserver/ListenerConfigBlueprint.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ interface ListenerConfigBlueprint {
333333
*
334334
* @return proxy support status
335335
*/
336-
@ConfiguredOption("false")
336+
@Option.Default("false")
337337
boolean enableProxyProtocol();
338338

339339
/**

webserver/webserver/src/main/java/io/helidon/webserver/ProxyProtocolHandler.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static ProxyProtocolData handleV1Protocol(PushbackInputStream inputStream) throw
108108

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

125125
// source address
126126
n = readUntil(inputStream, buffer, (byte) ' ');
127-
var sourceAddress = new String(buffer, 0, n);
127+
var sourceAddress = new String(buffer, 0, n, StandardCharsets.US_ASCII);
128128
match(inputStream, (byte) ' ');
129129

130130
// destination address
131131
n = readUntil(inputStream, buffer, (byte) ' ');
132-
var destAddress = new String(buffer, 0, n);
132+
var destAddress = new String(buffer, 0, n, StandardCharsets.US_ASCII);
133133
match(inputStream, (byte) ' ');
134134

135135
// source port
136136
n = readUntil(inputStream, buffer, (byte) ' ');
137-
int sourcePort = Integer.parseInt(new String(buffer, 0, n));
137+
int sourcePort = Integer.parseInt(new String(buffer, 0, n, StandardCharsets.US_ASCII));
138138
match(inputStream, (byte) ' ');
139139

140140
// destination port
141141
n = readUntil(inputStream, buffer, (byte) '\r');
142-
int destPort = Integer.parseInt(new String(buffer, 0, n));
142+
int destPort = Integer.parseInt(new String(buffer, 0, n, StandardCharsets.US_ASCII));
143143
match(inputStream, (byte) '\r');
144144
match(inputStream, (byte) '\n');
145145

0 commit comments

Comments
 (0)