-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample3.cc
More file actions
73 lines (66 loc) · 1.58 KB
/
example3.cc
File metadata and controls
73 lines (66 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
*************************************************************
* @file example1.cpp
* @brief Breve descripción
* Pequeña documentación del archivo
*
*
*
*
*
* @author Gaspar Fernández <blakeyed@totaki.com>
* @version
* @date 07 sep 2014
* Historial de cambios:
*
*
*
*
*
*
*
*************************************************************/
#include "glove.hpp"
#include <iostream>
#include <ctime>
#include <vector>
#include <unistd.h>
using namespace std;
int main(int argc, char *argv[])
{
Glove g;
try
{
/* cout << g.buffer_size(123)<<endl; */
cout << g.buffer_size(321)<<endl;
g.timeout_when_data(false);
/* g.buffer_size(16384); */
g.remove_exceptions (Glove::EXCEPTION_DISCONNECTED);
g.timeout(0.5);
vector<Glove::hostinfo> v = Glove::resolveHost(argv[1]);
for (auto i = v.begin(); i != v.end(); ++i)
{
cout << "HOST: "<<i->host<<"; IP: "<<i->ip_address<<endl;
}
// g.set_ssltimeout(false);
g.connect(argv[1], 443);
g.send("GET / HTTP/1.1\r\n");
g.send("Host: ");
g.send(argv[1]);
g.send("\r\n\r\n");
cout << "SucceSS: "<<g.receive()<<endl;
g.send("GET / HTTP/1.1\r\n\r\n");
cout << "END" << endl;
cout << "Service: "<<g.get_service() << std::endl;
#if ENABLE_OPENSSL
cout << g.debugCipherInfo();
cout << "Verify: "<<g.getSSLVerifyState()<<" - "<<g.getSSLVerifyString()<<std::endl;
cout << g.debugCertificatesInfo()<<endl;
#endif
}
catch (GloveException& e)
{
cout << "Exception: "<<e.what() << endl;
}
return 0;
}