curl-unix-socket
curl-unix-socket copied to clipboard
add a feature for https
Sometimes I want to check a port for an app that is forcing a redirect (301) to https. Is it possible to use https into the socket?
Done in https://github.com/Soulou/curl-unix-socket/commit/4aed38106006740b39d36f6aff04cff3816df2a7
Example of usage:
go run server_examples/https.go example.sock certpath.pem keypath.pem &
go build
./curl-unix-socket -https -k unix://example.sock:/
You need to create the cert/key before with OpenSSL for example.
Does it answer your need?
I tried it on a socket for a puma web server I have running:
curl-unix-socket -k -https -v unix:///var/run/project/puma-2.sock:
Fail to connect to /var/run/project/puma-2.sock : tls: oversized record received with length 20527
What is the result of
curl-unix-socket -v unix:///var/run/project/puma-2.sock:
??
$ curl-unix-socket -v unix:///var/run/project/puma-2.sock:
> GET HTTP/1.1
> Socket: /var/run/project/puma-2.sock
> Content-Length: 0
>
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html
< Location: https:///
Works fine. I get a 301 cuz the app redirects to https, which is why I wanted the https :)
ok got it, I've to handle http to https redirection