cURL / Mailing Lists / curl-library / Single Mail

curl-library

Introducing HTTP CONNECT support in tests/server/sws

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 3 Jan 2012 23:09:43 +0100 (CET)

Hi friends,

I thought I'd just shortly explain how the new support for HTTP CONNECT in the
test suite's HTTP server (sws) works and how to make test cases that use it.

As usual, don't hesitate to just ask if there's something missing. It is
probably just me not explaining properly...

The code:

  The actual changes to make this happen will be merged in and pushed to the
  git repo within shortly after I've sent off this email.

How it works:

  sws has a new command line option called --connect that takes an IPv4 address
  of the host to connect to when a HTTP CONNECT is found in an incoming
  request. It then uses the port number from the live CONNECT and proceeds
  like a "real" proxy would. So using a host like "example.com:8999" with
  --conect 127.0.0.1 will have sws connect to port 8999 on the localhost.

  sws makes sure to wait a second before it starts tunneling data back and
  forth so that the CONNECT response body will be properly "separated" to the
  client.

  While tunneling, sws is made to accept a second connect and pass that through
  as well. This allows passive FTP to work fine as well through this proxy.

  When doing CONNECT to an HTTP server, we run two different sws instances so
  that there's one "simple" server and one working as proxy. They then also
  produce different log files in tests/log/

How to use in tests:

  The new proxy server is called 'http-proxy' when used within the <server>
  tag and must be there when CONNECT is tested.

  %PROXYPORT is the variable for the port number where the CONNECT proxy runs
  so "-p -x %HOSTIP:%PROXYPORT" is commonly seen in these test command lines.

  To verify the CONNECT request itself as it is now separated from the
  <protocol> part within <verify>, there's now a <proxy> section there that is
  used to verify the proxy request.

  runtests.pl adds a 'P' in the short sequence of single-letter flags on the
  left shown for each test that's run if the proxy protocol chunk was verified.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-03