fixed Content-Length handling for protocol upgrade

This commit is contained in:
hyung-hwan 2014-10-08 16:57:18 +00:00
parent 0ae76bd5ed
commit 0cee2a3614

View File

@ -796,6 +796,13 @@ static int proxy_htrd_peek_peer_output (qse_htrd_t* htrd, qse_htre_t* res)
if (qse_htre_getscodeval(res) == 101) if (qse_htre_getscodeval(res) == 101)
{ {
if (proxy->resflags & PROXY_RES_PEER_LENGTH)
{
/* the response to 'Upgrade' must not contain contents */
if (proxy->peer_output_length > 0) goto no_upgrade;
else proxy->resflags &= ~PROXY_RES_PEER_LENGTH;
}
/* Unlike raw proxying entasked for CONNECT for which disconnection /* Unlike raw proxying entasked for CONNECT for which disconnection
* is supposed to be scheduled by the caller, protocol upgrade * is supposed to be scheduled by the caller, protocol upgrade
* can be requested over a normal http stream. A stream whose * can be requested over a normal http stream. A stream whose
@ -806,6 +813,7 @@ static int proxy_htrd_peek_peer_output (qse_htrd_t* htrd, qse_htre_t* res)
} }
else else
{ {
no_upgrade:
/* the update request is not granted. restore the reader /* the update request is not granted. restore the reader
* to the original state so that HTTP packets can be handled * to the original state so that HTTP packets can be handled
* later on. */ * later on. */