mochi / mochiweb

MochiWeb is an Erlang library for building lightweight HTTP servers.
Other
1.86k stars 474 forks source link

about https #230

Closed NextSat closed 3 years ago

NextSat commented 4 years ago

I use Erlang/OTP 22, I try to test the https_store in the example. After compiled and run, I use the command "$ curl -k --verbose https://localhost:8443", it will return an error: "{error,{tls alert,{unexpected_message,\"TLS server:In state hello received UNDEFINED ALERT:Fatal - Unexpected Message \n", I can't figure out it. I hop someone can help me.

apuello commented 4 years ago

@Xiao-Qi-Yang make sure the module is able to find the certs, this is working perfectly for me.

$ echo -e "Fred\nWilma\nBarney" |
> curl -k --verbose https://localhost:8443/flintstones \
> -X PUT -H "Content-Type: text/plain" --data-binary @-
-bash: $: command not found
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=localhost
*  start date: Mar 18 19:39:18 2010 GMT
*  expire date: Mar 15 19:39:18 2020 GMT
*  issuer: CN=localhost
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
> PUT /flintstones HTTP/1.1
> Host: localhost:8443
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: text/plain
> Content-Length: 0
> 
< HTTP/1.1 201 Created
< Content-Length: 13
< Date: Fri, 15 May 2020 01:43:07 GMT
< Server: MochiWeb/1.0 (Any of you quaids got a smint?)
< 
201 Created