opscode/ibrowse — pull request #2 by sdelano (2013-06-20 21:42:36+00:00)
Title: Handle HTTP Connection Closing

When a connection is closed by the HTTP upstream, `ibrowse` continues to use the connection for future requests.

```
2> ibrowse:set_dest("localhost", 4567, [{max_sessions, 1}]).
ok
3> ibrowse:send_req("http://localhost:4567", [], get).
{ok,"200",
[{"Content-Type","text/html;charset=utf-8"},
{"Connection","close"},
{"Content-Length","40"},
{"X-XSS-Protection","1; mode=block"},
{"X-Content-Type-Options","nosniff"},
{"X-Frame-Options","SAMEORIGIN"},
{"Server","thin 1.5.1 codename Straight Razor"}],
"I'm going to close the connection on you"}
4> ibrowse:send_req("http://localhost:4567", [], get).
{error,connection_closing}
```

With this patch, ibrowse recreates a new connection on the next request.

```
2> ibrowse:set_dest("localhost", 4567, [{max_sessions, 1}]).
ok
3> ibrowse:send_req("http://localhost:4567", [], get).
{ok,"200",
[{"Content-Type","text/html;charset=utf-8"},
{"Connection","close"},
{"Content-Length","40"},
{"X-XSS-Protection","1; mode=block"},
{"X-Content-Type-Options","nosniff"},
{"X-Frame-Options","SAMEORIGIN"},
{"Server","thin 1.5.1 codename Straight Razor"}],
"I'm going to close the connection on you"}
4> ibrowse:send_req("http://localhost:4567", [], get).
{ok,"200",
[{"Content-Type","text/html;charset=utf-8"},
{"Connection","close"},
{"Content-Length","40"},
{"X-XSS-Protection","1; mode=block"},
{"X-Content-Type-Options","nosniff"},
{"X-Frame-Options","SAMEORIGIN"},
{"Server","thin 1.5.1 codename Straight Razor"}],
"I'm going to close the connection on you"}
```