diff options
author | lloyd <[email protected]> | 2010-02-14 05:42:50 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-14 05:42:50 +0000 |
commit | 508ccf7deb5ae8acb05d3514067bf3d0cc504a62 (patch) | |
tree | 56c0002503c01af255193aca762415875775170d /doc/examples | |
parent | 1e596a25e32c3106b3d6e2aceb64a270a8b30713 (diff) |
Various minor SSL fixes
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/tls_client.cpp | 14 | ||||
-rw-r--r-- | doc/examples/tls_server.cpp | 2 |
2 files changed, 6 insertions, 10 deletions
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<Botan::RandomNumberGenerator> 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"); |