diff options
Diffstat (limited to 'src/net/tcp/httpconn.c')
-rw-r--r-- | src/net/tcp/httpconn.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/net/tcp/httpconn.c b/src/net/tcp/httpconn.c index 2cfca9c9..5121ff6c 100644 --- a/src/net/tcp/httpconn.c +++ b/src/net/tcp/httpconn.c @@ -252,8 +252,13 @@ int http_connect ( struct interface *xfer, struct uri *uri ) { /* Identify port */ port = uri_port ( uri, scheme->port ); - /* Look for a reusable connection in the pool */ - list_for_each_entry ( conn, &http_connection_pool, pool.list ) { + /* Look for a reusable connection in the pool. Reuse the most + * recent connection in order to accommodate authentication + * schemes that break the stateless nature of HTTP and rely on + * the same connection being reused for authentication + * responses. + */ + list_for_each_entry_reverse ( conn, &http_connection_pool, pool.list ) { /* Sanity checks */ assert ( conn->uri != NULL ); |