pike.git
/
lib
/
modules
/
SSL.pmod
/
https.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/SSL.pmod/https.pike:45:
if (message) { werror("ALERT [%s: %d:%d]: %s", SSL.Constants.fmt_version(version), level, description, message); } return ::alert_factory(con, level, description, version, message); } } #ifndef HTTPS_CLIENT
-
SSL.
sslport
port;
+
SSL.
Port
port;
void my_accept_callback(object f) { Conn(port->accept()); } #endif class Conn { object sslfile;
pike.git/lib/modules/SSL.pmod/https.pike:104:
} } class Client { constant request = "HEAD / HTTP/1.0\r\n" "Host: " HOST ":" + PORT + "\r\n" "\r\n";
-
SSL.
sslfile
ssl;
+
SSL.
File
ssl;
int sent; void write_cb() { int bytes = ssl->write(request[sent..]); if (bytes > 0) { sent += bytes; } else if (sent < 0) { exit(17, "Failed to write data: %s\n", strerror(ssl->errno())); }
pike.git/lib/modules/SSL.pmod/https.pike:136:
{ exit(0, "Connection closed.\n"); } protected void create(Stdio.File con) { SSL.Context ctx = MyContext(); // Make sure all cipher suites are available. ctx->preferred_suites = ctx->get_suites(-1, 2); werror("Starting\n");
-
ssl = SSL.
sslfile
(con, ctx);
+
ssl = SSL.
File
(con, ctx);
ssl->connect(); ssl->set_nonblocking(got_data, write_cb, con_closed); } } string common_name; void make_certificate(SSL.Context ctx, Crypto.Sign key, void|Crypto.Hash hash) { mapping attrs = ([ "organizationName" : "Test",
pike.git/lib/modules/SSL.pmod/https.pike:213:
make_certificate(ctx, key, Crypto.SHA1); #endif // Make sure all cipher suites are available. ctx->preferred_suites = ctx->get_suites(CIPHER_BITS, KE_MODE); SSL3_DEBUG_MSG("Cipher suites:\n%s", .Constants.fmt_cipher_suites(ctx->preferred_suites)); SSL3_DEBUG_MSG("Certs:\n%O\n", ctx->cert_pairs);
-
port = SSL.
sslport
(ctx);
+
port = SSL.
Port
(ctx);
werror("Starting\n"); if (!port->bind(PORT, my_accept_callback)) { Stdio.perror(""); return 17; } else { werror("Listening on port %d.\n", PORT); return -17; } #endif }