-
Notifications
You must be signed in to change notification settings - Fork 278
Not working with HTTP/1.0, f.e. when proxied #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm, that's interesting, I don't actually know why we enforce HTTP/1.1 being used.. But what is "quick-node"? You're not using bitcoin core? |
Oh, is that https://www.quicknode.com/chains/btc? Interesting. So they use some HTTP proxy probably that is using HTTP/1.0. |
So, how can I set compatibility with HTTP/1.0? |
Same issue here |
Same issue |
Uhhh, HTTP/1.1 is from 1997, this is a bug in whatever software is requiring almost 30 year old protocols, not a bug in this library. |
Same issue on v0.19. Not sure why quicknode is using HTTP/1.0, alas we can't use it. We are trying to use it as a backup provider for when our bitcoin node is under maintenance. Instead we will spin up another one for the time being. |
You have this backwards, bitcoincore-rpc is using HTTP 1.0 and QuickNode enforces HTTP 1.1+. Is there a way to force use of a new version of jsonrpc? |
jsonrpc has never in its history used HTTP 1.0. You might be able to force a different version using And this project is unmaintained. |
rust-bitcoincore-rpc is using HTTP 1.0. What is the fix for that? It had appeared you had blamed it on a dependency above, but then I misunderstand. How does rust-bitcoincore-rpc get fixed to use HTTP 1.1 or later? |
For what it's worth, just use an HTTP library like reqwest against QuickNode (or other SaSS node providers) and forget about this library. There are so many methods not supported by Node SaSS and often additional and alternative methods not supported by bitcoin RPC. Example, QuickNode and NowNodes do not support |
It is not and never has been.
Who are you talking to? |
Thanks, I stand corrected, the HTTP 1.0 error is just obscuring an HTTP 400 response from QuickNode and the request was indeed HTTP 1.1. To individuals that may want to use rust-bitcoincore-rpc against QuickNode, you cannot, just use an HTTPS library. |
Same here: |
The error message turns out to be incorrect, it's just obfuscating the actual error. Look at the network trace if you can, but the actual error is going to be some message about the RPC method being unsupported by the node with an HTTP 400-599 return code. Don't use this lib to access non-self-hosted Node RPCs, just access directly. |
I tested the same method through cURL
And it worked. Are you sure the error is due to an unsupported method? |
No, I'm sure that whatever the error is, it is being obscured by the early bailout and incorrect messaging when receiving anything but HTTP 200 response. It can be any error, you'd need to sniff the network traffic (or the library or its dependency needs to avoid obscuring the error). |
We investigated the issue and there is a possible workaround. Since the There is an example for that implementation: use serde::de::DeserializeOwned;
#[derive(serde::Deserialize, Debug)]
pub struct Wrapper<T> {
pub id: String,
pub result: Option<T>,
pub error: Option<ErrorObject>,
}
#[derive(serde::Deserialize, Debug)]
pub struct ErrorObject {
pub code: i32,
pub message: String,
}
pub struct Client {
pub url: String,
}
impl bitcoincore_rpc::RpcApi for Client {
fn call<T: DeserializeOwned>(
&self,
cmd: &str,
args: &[serde_json::Value],
) -> bitcoincore_rpc::Result<T> {
let body = serde_json::json!({"jsonrpc": "1.0", "id": "1", "method": cmd, "params": args});
let mut request = reqwest::blocking::Client::new()
.post(&self.url)
.json(&body);
let res = request.send().unwrap();
let wrapper: Wrapper<T> = serde_json::from_str(res.text().unwrap().as_str())?;
Ok(wrapper.result.unwrap())
}
} The Note: The code example is unsafe for production since it's lack of proper error handling. |
hi, i have this error when use quick-node in rust: error: JSON-RPC error: transport error: HTTP response started with HTTP/1.0 ; expected HTTP/1.1 .
anyone can help?
The text was updated successfully, but these errors were encountered: