Moving charon to libcharon.
[strongswan.git] / src / libcharon / plugins / unit_tester / tests / test_curl.c
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include <daemon.h>
17 #include <sys/types.h>
18 #include <sys/socket.h>
19 #include <netdb.h>
20
21 /*******************************************************************************
22 * curl get test
23 ******************************************************************************/
24
25 bool test_curl_get()
26 {
27 chunk_t chunk;
28
29 if (lib->fetcher->fetch(lib->fetcher, "http://www.strongswan.org",
30 &chunk, FETCH_END) != SUCCESS)
31 {
32 return FALSE;
33 }
34 free(chunk.ptr);
35
36 if (lib->fetcher->fetch(lib->fetcher, "http://www.google.com",
37 &chunk, FETCH_END) != SUCCESS)
38 {
39 return FALSE;
40 }
41 free(chunk.ptr);
42 return TRUE;
43 }
44