Skip to content

Commit b091cb0

Browse files
committed
fix(server): always send Connection: close in clash-verge-service IPC responses
1 parent 6735498 commit b091cb0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core/server.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ fn create_ipc_router() -> Result<Router> {
156156
.get(IpcCommand::Magic.as_ref(), |_| async move {
157157
Ok(HttpResponse::builder()
158158
.status(StatusCode::OK)
159+
.header("connection", "close")
159160
.text("Tunglies!")
160161
.build())
161162
})
@@ -167,6 +168,7 @@ fn create_ipc_router() -> Result<Router> {
167168
};
168169
Ok(HttpResponse::builder()
169170
.status(StatusCode::OK)
171+
.header("connection", "close")
170172
.json(&json_value)?
171173
.build())
172174
})
@@ -183,6 +185,7 @@ fn create_ipc_router() -> Result<Router> {
183185
};
184186
return Ok(HttpResponse::builder()
185187
.status(StatusCode::SERVICE_UNAVAILABLE)
188+
.header("connection", "close")
186189
.json(&json_value)?
187190
.build());
188191
}
@@ -194,11 +197,13 @@ fn create_ipc_router() -> Result<Router> {
194197
};
195198
Ok(HttpResponse::builder()
196199
.status(StatusCode::OK)
200+
.header("connection", "close")
197201
.json(&json_value)?
198202
.build())
199203
}
200204
Err(e) => Ok(HttpResponse::builder()
201205
.status(StatusCode::BAD_REQUEST)
206+
.header("connection", "close")
202207
.text(format!("Invalid JSON: {}", e))
203208
.build()),
204209
}
@@ -214,6 +219,7 @@ fn create_ipc_router() -> Result<Router> {
214219
};
215220
return Ok(HttpResponse::builder()
216221
.status(StatusCode::SERVICE_UNAVAILABLE)
222+
.header("connection", "close")
217223
.json(&json_value)?
218224
.build());
219225
}
@@ -225,6 +231,7 @@ fn create_ipc_router() -> Result<Router> {
225231
};
226232
Ok(HttpResponse::builder()
227233
.status(StatusCode::OK)
234+
.header("connection", "close")
228235
.json(&json_value)?
229236
.build())
230237
});

0 commit comments

Comments
 (0)