Skip to content
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

Windows unexpected or badly formatted, MacOS bad protocol version #305

Open
fufesou opened this issue Oct 16, 2024 · 1 comment
Open

Windows unexpected or badly formatted, MacOS bad protocol version #305

fufesou opened this issue Oct 16, 2024 · 1 comment

Comments

@fufesou
Copy link

fufesou commented Oct 16, 2024

version: 0.2.12

We're currently facing this issue rustdesk/rustdesk-server-pro#417

It's the same to seanmonstar/reqwest#2004 and seanmonstar/reqwest#2411

Sample code

use native_tls::TlsConnector;
use std::io::{Read, Write};
use std::net::TcpStream;

fn main() {
    let connector = TlsConnector::new().unwrap();

    let stream = TcpStream::connect("test.com:443").unwrap();
    let mut stream = connector.connect("test.com", stream).unwrap();

    stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap();
    let mut res = vec![];
    stream.read_to_end(&mut res).unwrap();
    println!("{}", String::from_utf8_lossy(&res));
}

Output

Trace log on Windows
called `Result::unwrap()` on an `Err` value: Failure(Os { code: -2146893018, kind: Uncategorized, message: "The message received was unexpected or badly formatted." })
Trace log on MacOS
called `Result::unwrap()` on an `Err` value: Failure(Error { code: -9836, message: "bad protocol version" })
Curl -vv
* Connected to test.com (54.36.110.163) port 443 (#0)
* ALPN: offers h2,http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
*  CAfile: D:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
*  CApath: none
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [15 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [2838 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [520 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [36 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [36 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=test.com
*  start date: Oct 15 13:29:24 2024 GMT
*  expire date: Jan 13 13:29:23 2025 GMT
*  subjectAltName: host "test.com" matched cert's "*.test.com"
*  issuer: C=US; O=Let's Encrypt; CN=R10
*  SSL certificate verify ok.
} [5 bytes data]
* using HTTP/2
* h2h3 [:method: GET]
* h2h3 [:path: /api/oidc/auth]
* h2h3 [:scheme: https]
* h2h3 [:authority: test.com]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x1f41c451480)
} [5 bytes data]
> GET /api/oidc/auth HTTP/2
> Host: test.com
> user-agent: curl/7.88.1
> accept: */*
>
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [122 bytes data]
< HTTP/2 405
< allow: POST
< date: Wed, 16 Oct 2024 03:38:35 GMT
< content-length: 0

The most possible reason. rustdesk/rustdesk-server-pro#417 (comment)

@fufesou
Copy link
Author

fufesou commented Oct 25, 2024

rustdesk/rustdesk-server-pro#417 (comment)

Hi, sorry to bother, but is there any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant