Comments (6)
给下具体 rust 版本及不指定报的错误,我用 1.69.0-nightly 本地编译测试没问题
指定报错 403 跟这些加的 header 没关系
from rains.
@rookie0 很奇怪,我换了两台电脑了,都是i这个问题,而且是runtime panic, 就是在这个方法内,其他都无问题
rustc --version
rustc 1.67.0 (fc594f156 2023-01-24)
panicked at 'called `Result::unwrap()` on an `Err` value: Protocol(InvalidHeader("sec-websocket-key"))'
很奇怪啊,我刚才编译了一下git代码,为啥有时候他会报这个错,有时候不会?
我加了一下header,然后就是403的错误:
// let req = Request::builder()
// .method(Method::GET)
// .uri(format!(
// "wss://hq.sinajs.cn/wskt?list={}",
// fmt_quote_symbols(symbols)
// ))
// // .header(header::ORIGIN, HeaderValue::from_static(PORTAL))
// .header(header::CONNECTION, "Upgrade")
// .header(header::UPGRADE, "websocket")
// .header("Sec-WebSocket-Version", "13")
// .header(header::HOST, HeaderValue::from_static(PORTAL))
// .header("Sec-WebSocket-Key", tungstenite::handshake::client::generate_key())
// .body(())
// .unwrap();
let req = Request::builder()
.method(Method::GET)
.uri(format!(
"wss://hq.sinajs.cn/wskt?list={}",
fmt_quote_symbols(symbols)
))
.header(header::ORIGIN, HeaderValue::from_static(PORTAL))
.body(())
.unwrap();
是我缺少了什么配置么
from rains.
403 是因为用的 header 不对,应该是 origin
InvalidHeader("sec-websocket-key")
的问题 macos 未复现,不确定是否是 tungstenite
这个库不支持 windows 平台,你可以从这方面跟下
from rains.
@rookie0 我mac下测试了也同样报错。
rust 是stable的最新版。
from rains.
btw, 我是mac M1 pro
from rains.
@rookie0 你clone一个git的不更改版本,编译一下看看么,我在公司电脑编译你的代码没有问题(windows),
在家用windows mac都会又那个runtime panic,缺少header。
是因为vpn?》??
这个问题让人丈二和尚摸不到头脑啊,
from rains.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rains.