Skip to content

Commit

Permalink
[v3.0] Fix http config bug
Browse files Browse the repository at this point in the history
  • Loading branch information
abc123lzf committed Mar 25, 2021
1 parent f965004 commit af2e767
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ private void loadFile(Path path) {
this.connectTimeout = Integer.parseInt(properties.getProperty("connect-timeout", Integer.toString(DEFAULT_CONNECT_TIMEOUT)));
}

@Override
public boolean canSave() {
return true;
}

@Override
public void save() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ public void update(int port, boolean auth, String username, String password) {
}


@Override
public boolean canSave() {
return true;
}

@Override
public void save() throws Exception {
JSONObject json = new JSONObject();
Expand All @@ -220,7 +225,7 @@ public void save() throws Exception {
ByteBuffer buf = ByteBuffer.allocate(content.length());
buf.put(content.getBytes(StandardCharsets.US_ASCII));
Path path = this.filePath;
try (FileChannel ch = FileChannel.open(path, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)) {
try (FileChannel ch = FileChannel.open(path, StandardOpenOption.WRITE)) {
buf.rewind();
ch.write(buf);
} catch (IOException e) {
Expand Down Expand Up @@ -250,7 +255,7 @@ public String getBindAddress() {

@Override
public boolean isAuth() {
return false;
return config.isAuth();
}

@Override
Expand Down

0 comments on commit af2e767

Please sign in to comment.