diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-12-17 23:47:22 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-01-03 15:01:22 +0100 |
commit | 82180643f4886d47816cf654f2ee46114e9c296f (patch) | |
tree | ee7b55634dbeca7fd641397a6c10dd360cc602d4 /tests/server/util.c | |
parent | 585b89a6c3640af5a1ca963eeafc7d0d82408f00 (diff) |
test proxy supports CONNECT
There's a new 'http-proxy' server for tests that runs on a separate port
and lets clients do HTTP CONNECT to other ports on the same host to
allow us to test HTTP "tunneling" properly.
Test cases now have a <proxy> section in <verify> to check that the
proxy protocol part matches correctly.
Test case 80, 83, 95, 275, 503 and 1078 have been converted. Test 1316
was added.
Diffstat (limited to 'tests/server/util.c')
-rw-r--r-- | tests/server/util.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/server/util.c b/tests/server/util.c index 52802a82c..602f11e14 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -61,6 +61,33 @@ const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }}; #endif +/* This function returns a pointer to STATIC memory. It converts the given + * binary lump to a hex formatted string usable for output in logs or + * whatever. + */ +char *data_to_hex(char *data, size_t len) +{ + static char buf[256*3]; + size_t i; + char *optr = buf; + char *iptr = data; + + if(len > 255) + len = 255; + + for(i=0; i < len; i++) { + if((data[i] >= 0x20) && (data[i] < 0x7f)) + *optr++ = *iptr++; + else { + sprintf(optr, "%%%02x", *iptr++); + optr+=3; + } + } + *optr=0; /* in case no sprintf() was used */ + + return buf; +} + void logmsg(const char *msg, ...) { va_list ap; |