Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-09-23 17:32:37 +02:00
parent 374b05a379
commit 2352725c58
3 changed files with 4 additions and 4 deletions

View file

@ -895,10 +895,10 @@ pub fn add_routes(app: &mut tide::Server<Arc<AppState>>, rpc: &Arc<Peer>) {
let upgrade_to_websocket = header_contains_ignore_case(&request, UPGRADE, "websocket");
let upgrade_requested = connection_upgrade && upgrade_to_websocket;
let client_protocol_version: Option<u32> = request
.header("X-ZRPC-VERSION")
.header("X-Zed-Protocol-Version")
.and_then(|v| v.as_str().parse().ok());
if !upgrade_requested || client_protocol_version != Some(zrpc::VERSION) {
if !upgrade_requested || client_protocol_version != Some(zrpc::PROTOCOL_VERSION) {
return Ok(Response::new(StatusCode::UpgradeRequired));
}

View file

@ -503,7 +503,7 @@ impl Client {
"Authorization",
format!("{} {}", credentials.user_id, credentials.access_token),
)
.header("X-ZRPC-VERSION", zrpc::VERSION);
.header("X-Zed-Protocol-Version", zrpc::PROTOCOL_VERSION);
cx.background().spawn(async move {
if let Some(host) = ZED_SERVER_URL.strip_prefix("https://") {
let stream = smol::net::TcpStream::connect(host).await?;

View file

@ -5,4 +5,4 @@ pub mod proto;
pub use conn::Connection;
pub use peer::*;
pub const VERSION: u32 = 0;
pub const PROTOCOL_VERSION: u32 = 0;