aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_http_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_http_common.c')
-rw-r--r--src/transport/test_http_common.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/transport/test_http_common.c b/src/transport/test_http_common.c
new file mode 100644
index 000000000..60aa3bfd3
--- /dev/null
+++ b/src/transport/test_http_common.c
@@ -0,0 +1,70 @@
1/*
2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20/**
21 * @file transport/test_transport_api.c
22 * @brief base test case for transport implementations
23 *
24 * This test case serves as a base for tcp, udp, and udp-nat
25 * transport test cases. Based on the executable being run
26 * the correct test case will be performed. Conservation of
27 * C code apparently.
28 */
29#include "platform.h"
30#include "gnunet_transport_service.h"
31#include "transport-testing.h"
32#include "plugin_transport_http_common.h"
33
34struct SplittedHTTPAddress
35{
36 char *protocoll;
37 char *host;
38 char *port;
39 char *path;
40};
41
42void
43clean (struct SplittedHTTPAddress *addr)
44{
45 if (NULL != addr)
46 {
47 GNUNET_free_non_null (addr->host);
48 GNUNET_free_non_null (addr->path);
49 GNUNET_free_non_null (addr->port);
50 GNUNET_free_non_null (addr->protocoll);
51 GNUNET_free_non_null (addr);
52 }
53}
54
55int
56main (int argc, char *argv[])
57{
58 int ret = 0;
59
60 clean(http_split_address (""));
61 clean(http_split_address ("http://"));
62 clean(http_split_address ("http://test/path"));
63 clean(http_split_address ("http://test:8999/path"));
64 clean(http_split_address ("http://1.2.3.4:8999/path"));
65 clean(http_split_address ("http://1.2.3.4:8999"));
66
67 return ret;
68}
69
70/* end of test_transport_api.c */