From 508ccf7deb5ae8acb05d3514067bf3d0cc504a62 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 14 Feb 2010 05:42:50 +0000 Subject: Various minor SSL fixes --- doc/examples/tls_client.cpp | 14 +++++--------- doc/examples/tls_server.cpp | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'doc/examples') diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp index 20fde6354..9e6b510f2 100644 --- a/doc/examples/tls_client.cpp +++ b/doc/examples/tls_client.cpp @@ -21,27 +21,23 @@ int main() { LibraryInitializer init; - Unix_Socket sock("randombit.net", 443); + Unix_Socket sock("www.randombit.net", 443); std::auto_ptr rng( Botan::RandomNumberGenerator::make_rng()); TLS_Client tls(*rng, sock); - printf("Connection open\n"); + std::string http_command = "GET /bitbashing\r\n"; + tls.write((const byte*)http_command.c_str(), http_command.length()); while(true) { if(tls.is_closed()) break; - std::string str; - std::getline(std::cin, str); - str += "\n"; - tls.write((const byte*)str.c_str(), str.length()); - - byte buf[4096] = { 0 }; - tls.read(buf, sizeof(buf)); + byte buf[16+1] = { 0 }; + u32bit got = tls.read(buf, sizeof(buf)-1); printf("%s", buf); fflush(0); } diff --git a/doc/examples/tls_server.cpp b/doc/examples/tls_server.cpp index d5cb77a84..72212de0f 100644 --- a/doc/examples/tls_server.cpp +++ b/doc/examples/tls_server.cpp @@ -37,7 +37,7 @@ int main() X509_Certificate cert = X509::create_self_signed_cert(options, key, "SHA-1", *rng); - Unix_Server_Socket listener(4433); + Unix_Server_Socket listener(4434); printf("Now listening...\n"); -- cgit v1.2.3