From 82180643f4886d47816cf654f2ee46114e9c296f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 17 Dec 2011 23:47:22 +0100 Subject: 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 section in 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. --- tests/server/util.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'tests/server/util.c') 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, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , 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; -- cgit v1.2.3