xref: /aosp_15_r20/external/sandboxed-api/oss-internship-2020/curl/examples/README.md (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1*ec63e07aSXin Li# LibCurl Sandbox Examples
2*ec63e07aSXin Li
3*ec63e07aSXin LiEach example in this folder is the sandboxed version of a code snippet from
4*ec63e07aSXin Li[this page](https://curl.haxx.se/libcurl/c/example.html) on curl's website.
5*ec63e07aSXin LiThese examples perform some basic tasks using libcurl, and can be useful both to
6*ec63e07aSXin Liunderstand how to use LibCurl Sandbox, but also to get an idea of how regular
7*ec63e07aSXin Liand sandboxed code compare to each other.
8*ec63e07aSXin Li
9*ec63e07aSXin LiThis is the list of the examples:
10*ec63e07aSXin Li
11*ec63e07aSXin Li-   **example1**: sandboxed version of
12*ec63e07aSXin Li    [simple.c](https://curl.haxx.se/libcurl/c/simple.html). Really simple HTTP
13*ec63e07aSXin Li    request, downloads and prints out the page at
14*ec63e07aSXin Li    [example.com](http://example.com).
15*ec63e07aSXin Li-   **example2**: sandboxed version of
16*ec63e07aSXin Li    [getinmemory.c](https://curl.haxx.se/libcurl/c/getinmemory.html). Same HTTP
17*ec63e07aSXin Li    request as example1. The difference is that this example uses a callback to
18*ec63e07aSXin Li    save the page directly in memory. Only the page size is printed out.
19*ec63e07aSXin Li-   **example3**: sandboxed version of
20*ec63e07aSXin Li    [simplessl.c](https://curl.haxx.se/libcurl/c/simplessl.html). HTTPS request
21*ec63e07aSXin Li    of the [example.com](https://example.com) page, using SSL authentication.
22*ec63e07aSXin Li    This script takes 4 arguments (SSL certificates file, SSL keys file, SSL
23*ec63e07aSXin Li    keys password and CA certificates files), and prints out the page.
24*ec63e07aSXin Li-   **example4**: sandboxed version of
25*ec63e07aSXin Li    [multi-poll.c](https://curl.haxx.se/libcurl/c/multi-poll.html). Same HTTP
26*ec63e07aSXin Li    request as example1, with the addition of a polling method that can be used
27*ec63e07aSXin Li    to track the status of the request. The page is printed out after it is
28*ec63e07aSXin Li    downloaded.
29*ec63e07aSXin Li-   **example5**: sandboxed version of
30*ec63e07aSXin Li    [multithread.c](https://curl.haxx.se/libcurl/c/multithread.html). Four HTTP
31*ec63e07aSXin Li    request of the pages [example.com](http://example.com),
32*ec63e07aSXin Li    [example.edu](http://example.edu), [example.net](http://example.net) and
33*ec63e07aSXin Li    [example.org](http://example.org), performed at the same time using
34*ec63e07aSXin Li    libcurl's multithreading methods. The pages are printed out.
35*ec63e07aSXin Li-   **example6**: sandboxed version of
36*ec63e07aSXin Li    [simple.c](https://curl.haxx.se/libcurl/c/simple.html). Performs the same
37*ec63e07aSXin Li    tasks as example1, but Sandbox API Transactions are used to show how they
38*ec63e07aSXin Li    can be used to perform a simple request.
39