Skip to content

Commit

Permalink
Fixed README.md examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephP91 committed Feb 29, 2020
1 parent ae75e46 commit 01abd95
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ int main(int argc, const char **argv) {
try {
// Execute the request.
easy.perform();
} catch (curl_easy_exception error) {

} catch (curl_easy_exception &error) {
// If you want to get the entire error stack we can do:
curlcpp_traceback errors = error.get_traceback();
// Otherwise we could print the stack like this:
Expand Down Expand Up @@ -102,7 +103,8 @@ int main(int argc, const char **argv) {
try {
// Execute the request.
easy.perform();
} catch (curl_easy_exception error) {
} catch (curl_easy_exception &error) {
// If you want to get the entire error stack we can do:
curlcpp_traceback errors = error.get_traceback();
// Otherwise we could print the stack like this:
Expand All @@ -111,6 +113,7 @@ int main(int argc, const char **argv) {
// Retrieve information about curl current session.
auto x = easy.get_info<CURLINFO_CONTENT_TYPE>();
// Print out content type
std::cout << x.get() << std::endl;
return 0;
Expand Down Expand Up @@ -155,7 +158,8 @@ int main(int argc, const char * argv[]) {
easy.add<CURLOPT_HTTPPOST>(form.get());
// Execute the request.
easy.perform();
} catch (curl_easy_exception error) {

} catch (curl_easy_exception &error) {
// If you want to get the entire error stack we can do:
curlcpp_traceback errors = error.get_traceback();
// Otherwise we could print the stack like this:
Expand Down Expand Up @@ -202,7 +206,8 @@ int main(int argc, const char * argv[]) {
try {
// Execute the request
easy.perform();
} catch (curl_easy_exception error) {
} catch (curl_easy_exception &error) {
// If you want to get the entire error stack we can do:
curlcpp_traceback errors = error.get_traceback();
// Otherwise we could print the stack like this:
Expand Down Expand Up @@ -247,7 +252,8 @@ int main() {
try {
// Execute the request.
easy.perform();
} catch (curl_easy_exception error) {

} catch (curl_easy_exception &error) {
// If you want to get the entire error stack we can do:
curlcpp_traceback errors = error.get_traceback();
// Otherwise we could print the stack like this:
Expand Down Expand Up @@ -295,7 +301,8 @@ int main(int argc, const char * argv[]) {
easy.add<CURLOPT_CONNECT_ONLY>(true);
// Execute the request.
easy.perform();
} catch (curl_easy_exception error) {

} catch (curl_easy_exception &error) {
// If you want to get the entire error stack we can do:
curlcpp_traceback errors = error.get_traceback();
// Otherwise we could print the stack like this:
Expand All @@ -307,6 +314,7 @@ int main(int argc, const char * argv[]) {
sender.send(request);
// Prints che sent bytes number.
cout<<"Sent bytes: "<<sender.get_sent_bytes()<<endl;

for(;;) {
// You should wait here to check if socket is ready to receive
try {
Expand All @@ -316,7 +324,8 @@ int main(int argc, const char * argv[]) {
receiver.receive(easy);
// Prints the received bytes number.
cout<<"Receiver bytes: "<<receiver.get_received_bytes()<<endl;
} catch (curl_easy_exception error) {

} catch (curl_easy_exception &error) {
// If any errors occurs, exit from the loop
break;
}
Expand Down

0 comments on commit 01abd95

Please sign in to comment.