diff --git a/CHANGES b/CHANGES index 9f77abcdfd1..66cb7e3d65f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.0.0 + *) [TS-2589] Don't hold up the response until the server starts sending + content + *) [TS-2563] Always set the SSL default verify paths. Author: Wei Sun diff --git a/plugins/experimental/metalink/test/headers b/plugins/experimental/metalink/test/headers new file mode 100755 index 00000000000..0d3a93d4f31 --- /dev/null +++ b/plugins/experimental/metalink/test/headers @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +print '''1..1 headers +# The response isn't held up until the server starts sending content''' + +from twisted.internet import error, protocol, reactor, tcp +from twisted.web import http + +def callback(): + print 'not ok 1 - No response yet' + + reactor.stop() + +reactor.callLater(1, callback) + +class factory(http.HTTPFactory): + class protocol(http.HTTPChannel): + class requestFactory(http.Request): + def requestReceived(ctx, method, target, version): + + ctx.client = None + ctx.clientproto = version + + ctx.write('') + +server = tcp.Port(0, factory()) +server.startListening() + +print '# Listening on {0}:{1}'.format(*server.socket.getsockname()) + +class factory(protocol.ClientFactory): + def clientConnectionFailed(ctx, connector, reason): + + print 'Bail out!' + reason.printTraceback() + + reactor.stop() + + class protocol(http.HTTPClient): + def connectionLost(ctx, reason): + try: + reactor.stop() + + except error.ReactorNotRunning: + pass + + else: + print 'not ok 1 - Did the proxy crash? (The client connection closed.)' + + connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname())) + + def handleStatus(ctx, version, status, message): + print 'ok 1 - Got the response status' + + reactor.stop() + +tcp.Connector('localhost', 8080, factory(), 30, None, reactor).connect() + +reactor.run() diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc index ca2f60cf100..0fc6c77d84f 100644 --- a/proxy/http/HttpTunnel.cc +++ b/proxy/http/HttpTunnel.cc @@ -891,8 +891,7 @@ HttpTunnel::producer_run(HttpTunnelProducer * p) p->chunked_handler.dechunked_reader->consume(p->chunked_handler.skip_bytes); // If there is data to process in the buffer, do it now - if (p->chunked_handler.dechunked_reader->read_avail()) - producer_handler(VC_EVENT_READ_READY, p); + producer_handler(VC_EVENT_READ_READY, p); } else if (p->do_dechunking || p->do_chunked_passthru) { // remove the dechunked reader marker so that it doesn't act like a buffer guard if (p->do_dechunking) @@ -912,9 +911,8 @@ HttpTunnel::producer_run(HttpTunnelProducer * p) //p->chunked_handler.chunked_reader->consume( //p->chunked_handler.skip_bytes); - if (p->chunked_handler.chunked_reader->read_avail()) { - producer_handler(VC_EVENT_READ_READY, p); - } else if (sm->redirection_tries > 0 && p->vc_type == HT_HTTP_CLIENT) { // read_avail() == 0 + producer_handler(VC_EVENT_READ_READY, p); + if (!p->chunked_handler.chunked_reader->read_avail() && sm->redirection_tries > 0 && p->vc_type == HT_HTTP_CLIENT) { // read_avail() == 0 // [bug 2579251] // Ugh, this is horrible but in the redirect case they are running a the tunnel again with the // now closed/empty producer to trigger PRECOMPLETE. If the POST was chunked, producer_n is set