|
|
|
@ -2,10 +2,12 @@ package main
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"bytes" |
|
|
|
|
"crypto/sha1" |
|
|
|
|
"crypto/tls" |
|
|
|
|
"fmt" |
|
|
|
|
"io" |
|
|
|
|
"io/ioutil" |
|
|
|
|
"log" |
|
|
|
|
"net" |
|
|
|
|
"net/http" |
|
|
|
|
"net/url" |
|
|
|
|
"path/filepath" |
|
|
|
@ -34,7 +36,7 @@ func (w *fakeResponseWriter) WriteHeader(statusCode int) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func serveFastCGI(c net.Conn, connFactory gofast.ConnFactory, u *url.URL, filePath string) { |
|
|
|
|
func serveFastCGI(c *tls.Conn, connFactory gofast.ConnFactory, u *url.URL, filePath string) { |
|
|
|
|
header := map[string][]string{ |
|
|
|
|
"Accept": {"*/*"}, |
|
|
|
|
"Host": {u.Hostname()}, |
|
|
|
@ -73,6 +75,12 @@ func serveFastCGI(c net.Conn, connFactory gofast.ConnFactory, u *url.URL, filePa
|
|
|
|
|
req.Params["SCRIPT_FILENAME"] = filePath |
|
|
|
|
req.Params["SCRIPT_NAME"] = filepath.Base(filePath) |
|
|
|
|
|
|
|
|
|
certLabel := 'A' |
|
|
|
|
clientCerts := c.ConnectionState().PeerCertificates |
|
|
|
|
for i := 0; i < len(clientCerts) && i < 26; i++ { |
|
|
|
|
req.Params["CLIENT_CERT_"+string(certLabel+rune(i))] = fmt.Sprintf("%x", sha1.Sum(clientCerts[i].Raw)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
w := newFakeResponseWriter(c) |
|
|
|
|
|
|
|
|
|
client, err := gofast.SimpleClientFactory(connFactory, 0)() |
|
|
|
|