You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2014/03/29 00:31:25 UTC

[03/13] git commit: TS-2675: metalink: Simpler to drop http.HTTPClient where not needed and minor edits

TS-2675: metalink: Simpler to drop http.HTTPClient where not needed and minor edits


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/54316fd3
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/54316fd3
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/54316fd3

Branch: refs/heads/master
Commit: 54316fd36451b15b209946e99f38cc6d74727280
Parents: d25edd9
Author: Jack Bates <ja...@nottheoilrig.com>
Authored: Thu Mar 13 13:43:10 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Mar 28 16:23:54 2014 -0700

----------------------------------------------------------------------
 plugins/experimental/metalink/metalink.cc       |  2 +-
 .../experimental/metalink/test/chunkedEncoding  | 38 +++++++++---------
 .../metalink/test/chunkedEncodingDisconnect     | 40 +++++++++----------
 .../experimental/metalink/test/clientDisconnect | 41 +++++++++----------
 .../experimental/metalink/test/contentLength    | 38 +++++++++---------
 .../metalink/test/contentLengthDisconnect       | 40 +++++++++----------
 .../test/finalChunkedEncodingDisconnect         | 42 ++++++++++----------
 plugins/experimental/metalink/test/http09       | 38 +++++++++---------
 plugins/experimental/metalink/test/longer       | 40 +++++++++----------
 plugins/experimental/metalink/test/notModified  | 34 ++++++++--------
 .../test/shortChunkedEncodingDisconnect         | 38 +++++++++---------
 .../metalink/test/shortClientDisconnect         | 41 +++++++++----------
 .../metalink/test/shortContentLengthDisconnect  | 38 +++++++++---------
 plugins/experimental/metalink/test/zero         | 34 ++++++++--------
 14 files changed, 247 insertions(+), 257 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/metalink.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/metalink.cc b/plugins/experimental/metalink/metalink.cc
index e604272..5def165 100644
--- a/plugins/experimental/metalink/metalink.cc
+++ b/plugins/experimental/metalink/metalink.cc
@@ -292,7 +292,7 @@ vconn_write_ready(TSCont contp, void * /* edata ATS_UNUSED */)
   }
 
   /* Avoid failed assert "sdk_sanity_check_iocore_structure(readerp) ==
-   * TS_SUCCESS" in TSIOBufferReaderAvail() if the client or server disconnects
+   * TS_SUCCESS" in TSIOBufferReaderAvail() if the client or origin disconnect
    * or the content length is zero */
   TSIOBufferReader readerp = TSVIOReaderGet(input_viop);
   if (readerp) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/chunkedEncoding
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/chunkedEncoding b/plugins/experimental/metalink/test/chunkedEncoding
index ece4768..7a2ed37 100755
--- a/plugins/experimental/metalink/test/chunkedEncoding
+++ b/plugins/experimental/metalink/test/chunkedEncoding
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 chunkedEncoding
 # The proxy forwards the final chunk at the end of a chunked response'''
@@ -43,10 +43,10 @@ class factory(http.HTTPFactory):
         # headers, it may send a Content-Length header vs. a chunked response
         reactor.callLater(1, ctx.finish)
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -67,7 +67,7 @@ class factory(protocol.ClientFactory):
       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()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -76,11 +76,11 @@ class factory(protocol.ClientFactory):
         # No hope of a final chunk now
         reactor.stop()
 
-    # Avoid calling undefined handleResponse() at the end of the content (if
+    # Avoid calling undefined handleResponse() at the end of the message (if
     # the proxy sent a Content-Length header vs. a chunked response).
     # (Override connectionLost() when the proxy crashes or stop the reactor.)
     #
-    # The data that was already received will be processed (the end of the
+    # Data that was already received will be processed (the end of the
     # headers), then shutdown events will fire (connections will be closed),
     # and then finally the reactor will grind to a halt.
     def handleResponseEnd(ctx):

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/chunkedEncodingDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/chunkedEncodingDisconnect b/plugins/experimental/metalink/test/chunkedEncodingDisconnect
index 3c0210b..91593d0 100755
--- a/plugins/experimental/metalink/test/chunkedEncodingDisconnect
+++ b/plugins/experimental/metalink/test/chunkedEncodingDisconnect
@@ -1,24 +1,24 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 chunkedEncodingDisconnect
 # The proxy closes the client connection and doesn't send a final chunk if the
-# server disconnects without sending one'''
+# origin disconnects without sending one'''
 
 from twisted.internet import error, protocol, reactor, tcp
 from twisted.web import http
@@ -40,15 +40,15 @@ class factory(http.HTTPFactory):
 
         ctx.write('chunkedEncodingDisconnect')
 
-        # If the server disconnects before the proxy sends the response
+        # If the origin disconnects before the proxy sends the response
         # headers, the proxy may send a Content-Length header vs. a chunked
         # response
         reactor.callLater(1, ctx.transport.loseConnection)
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -69,7 +69,7 @@ class factory(protocol.ClientFactory):
       else:
         print 'ok 1 - The client connection closed'
 
-    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -78,7 +78,7 @@ class factory(protocol.ClientFactory):
         # Who cares what happens now?
         reactor.stop()
 
-    # Avoid calling undefined handleResponse() at the end of the content (if
+    # Avoid calling undefined handleResponse() at the end of the message (if
     # the proxy sent a Content-Length header vs. a chunked response).
     # (Override connectionLost() when the proxy closes the client connection or
     # stop the reactor.)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/clientDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/clientDisconnect b/plugins/experimental/metalink/test/clientDisconnect
index b8ee3da..b9ff984 100755
--- a/plugins/experimental/metalink/test/clientDisconnect
+++ b/plugins/experimental/metalink/test/clientDisconnect
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 clientDissconnect
 # The proxy doesn't crash if the client disconnects prematurely'''
@@ -64,10 +64,10 @@ class factory(http.HTTPFactory):
 
         reactor.callLater(1, callback)
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -77,18 +77,13 @@ class factory(protocol.ClientFactory):
 
     reactor.stop()
 
-  class protocol(http.HTTPClient):
+  class protocol(protocol.Protocol):
     def connectionMade(ctx):
-      ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+      ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
       # Disconnect after the proxy sends the response headers
       reactor.callLater(1, ctx.transport.loseConnection)
 
-    # Avoid calling undefined handleResponse() at the end of the content or
-    # when the connection closes
-    def handleResponseEnd(ctx):
-      pass
-
 tcp.Connector('localhost', 8080, factory(), 30, None, reactor).connect()
 
 reactor.run()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/contentLength
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/contentLength b/plugins/experimental/metalink/test/contentLength
index c3005ac..92708e7 100755
--- a/plugins/experimental/metalink/test/contentLength
+++ b/plugins/experimental/metalink/test/contentLength
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 contentLength
 # The proxy forwards the Content-Length header to the client'''
@@ -40,10 +40,10 @@ class factory(http.HTTPFactory):
         ctx.setHeader('Content-Length', 13)
         ctx.write('contentLength')
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -64,7 +64,7 @@ class factory(protocol.ClientFactory):
       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()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleEndHeaders(ctx):
       try:
@@ -85,10 +85,10 @@ class factory(protocol.ClientFactory):
 
         reactor.stop()
 
-    # Avoid calling undefined handleResponse() at the end of the content.
+    # Avoid calling undefined handleResponse() at the end of the message.
     # (Override connectionLost() when the proxy crashes or stop the reactor.)
     #
-    # The data that was already received will be processed (the end of the
+    # Data that was already received will be processed (the end of the
     # headers), then shutdown events will fire (connections will be closed),
     # and then finally the reactor will grind to a halt.
     def handleResponseEnd(ctx):

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/contentLengthDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/contentLengthDisconnect b/plugins/experimental/metalink/test/contentLengthDisconnect
index 2c98ae8..1627d0e 100755
--- a/plugins/experimental/metalink/test/contentLengthDisconnect
+++ b/plugins/experimental/metalink/test/contentLengthDisconnect
@@ -1,23 +1,23 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..2 contentLengthDisconnect
-# The proxy closes the client connection if the server disconnects prematurely'''
+# The proxy closes the client connection if the origin disconnects prematurely'''
 
 from twisted.internet import error, protocol, reactor, tcp
 from twisted.web import http
@@ -40,14 +40,14 @@ class factory(http.HTTPFactory):
         ctx.setHeader('Content-Length', 24)
         ctx.write('contentLengthDisconnect')
 
-        # If the server disconnects before the proxy sends the response
+        # If the origin disconnects before the proxy sends the response
         # headers, the proxy may send the wrong Content-Length header
         reactor.callLater(1, ctx.transport.loseConnection)
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -68,7 +68,7 @@ class factory(protocol.ClientFactory):
       else:
         print 'ok 2 - The client connection closed'
 
-    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -80,7 +80,7 @@ class factory(protocol.ClientFactory):
 
         print 'ok 1 - Content-Length header'
 
-    # Avoid calling undefined handleResponse() at the end of the content (if
+    # Avoid calling undefined handleResponse() at the end of the message (if
     # the proxy sent the wrong Content-Length header).  (Override
     # connectionLost() when the proxy closes the client connection or stop the
     # reactor.)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect b/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
index 9fa4093..32011bc 100755
--- a/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
+++ b/plugins/experimental/metalink/test/finalChunkedEncodingDisconnect
@@ -1,23 +1,23 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 finalChunkEncodingDisconnect
-# The proxy forwards the final chunk even if the server disconnects immediately
+# The proxy forwards the final chunk even if the origin disconnects immediately
 # afterward'''
 
 from twisted.internet import error, protocol, reactor, tcp
@@ -47,7 +47,7 @@ class factory(http.HTTPFactory):
             ctx.finish()
 
           except RuntimeError:
-            print 'not ok 1 - Did the proxy crash?  (The server connection closed.)'
+            print 'not ok 1 - Did the proxy crash?  (The origin connection closed.)'
 
             reactor.stop()
 
@@ -56,10 +56,10 @@ class factory(http.HTTPFactory):
 
         reactor.callLater(1, callback)
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -80,7 +80,7 @@ class factory(protocol.ClientFactory):
       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()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -89,11 +89,11 @@ class factory(protocol.ClientFactory):
         # No hope of a final chunk now
         reactor.stop()
 
-    # Avoid calling undefined handleResponse() at the end of the content (if
+    # Avoid calling undefined handleResponse() at the end of the message (if
     # the proxy sent a Content-Length header vs. a chunked response).
     # (Override connectionLost() when the proxy crashes or stop the reactor.)
     #
-    # The data that was already received will be processed (the end of the
+    # Data that was already received will be processed (the end of the
     # headers), then shutdown events will fire (connections will be closed),
     # and then finally the reactor will grind to a halt.
     def handleResponseEnd(ctx):

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/http09
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/http09 b/plugins/experimental/metalink/test/http09
index 9103c8d..e9f7c77 100755
--- a/plugins/experimental/metalink/test/http09
+++ b/plugins/experimental/metalink/test/http09
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 http09
 # The proxy doesn't crash on an HTTP/0.9 response'''
@@ -23,7 +23,7 @@ print '''1..1 http09
 #
 # The proxy crashes only after the response is complete.  It closes the client
 # connection whether it crashes or not because an HTTP/0.9 response is complete
-# only after the server closes its connection, and then the proxy normally does
+# only after the origin closes its connection, and then the proxy normally does
 # the same thing to the client connection (although it upgrades the response to
 # HTTP/1.1).  So the only way to check that the proxy didn't crash is to open
 # another connection.
@@ -46,10 +46,10 @@ class factory(protocol.Factory):
       # The proxy crashes only after the response is complete
       ctx.transport.loseConnection()
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -59,7 +59,7 @@ class factory(protocol.ClientFactory):
 
     reactor.stop()
 
-  class protocol(http.HTTPClient):
+  class protocol(protocol.Protocol):
     def connectionLost(ctx, reason):
 
       # Open another connection
@@ -77,7 +77,7 @@ class factory(protocol.ClientFactory):
 
       reactor.callLater(1, tcp.Connector('localhost', 8080, factory(), 30, None, reactor).connect)
 
-    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
 tcp.Connector('localhost', 8080, factory(), 30, None, reactor).connect()
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/longer
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/longer b/plugins/experimental/metalink/test/longer
index f08feae..259ad7d 100755
--- a/plugins/experimental/metalink/test/longer
+++ b/plugins/experimental/metalink/test/longer
@@ -1,23 +1,23 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 longer
-# The proxy doesn't choke if the server sends more content than it advertised'''
+# The proxy doesn't choke if the origin sends more content than it advertised'''
 
 # Unlike the contentLength test, don't stop the reactor at the end of the
 # headers.  Give the proxy time to choke.
@@ -43,10 +43,10 @@ class factory(http.HTTPFactory):
         ctx.setHeader('Content-Length', 1)
         ctx.write('longer')
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -67,7 +67,7 @@ class factory(protocol.ClientFactory):
       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()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -78,10 +78,10 @@ class factory(protocol.ClientFactory):
 
         reactor.stop()
 
-    # Avoid calling undefined handleResponse() at the end of the content.
+    # Avoid calling undefined handleResponse() at the end of the message.
     # (Override connectionLost() when the proxy crashes or stop the reactor.)
     #
-    # The data that was already received will be processed (the end of the
+    # Data that was already received will be processed (the end of the
     # headers), then shutdown events will fire (connections will be closed),
     # and then finally the reactor will grind to a halt.
     def handleResponseEnd(ctx):

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/notModified
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/notModified b/plugins/experimental/metalink/test/notModified
index 2854189..90c3a87 100755
--- a/plugins/experimental/metalink/test/notModified
+++ b/plugins/experimental/metalink/test/notModified
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..2 notModified
 # The proxy doesn't crash on a 304 Not Modified response'''
@@ -40,10 +40,10 @@ class factory(http.HTTPFactory):
         ctx.setResponseCode(304)
         ctx.finish()
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -64,7 +64,7 @@ class factory(protocol.ClientFactory):
       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()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleStatus(ctx, version, status, message):
       if status != '304':

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect b/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
index 526b233..3c52858 100755
--- a/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
+++ b/plugins/experimental/metalink/test/shortChunkedEncodingDisconnect
@@ -1,24 +1,24 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 shortChunkedEncodingDisconnect
 # The proxy closes the client connection and doesn't send a final chunk if the
-# server disconnects without sending one, before the proxy sends the response
+# origin disconnects without sending one, before the proxy sends the response
 # headers'''
 
 from twisted.internet import error, protocol, reactor, tcp
@@ -44,10 +44,10 @@ class factory(http.HTTPFactory):
         # Disconnect before the proxy sends the response headers
         ctx.transport.loseConnection()
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -68,7 +68,7 @@ class factory(protocol.ClientFactory):
       else:
         print 'ok 1 - The client connection closed'
 
-    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -77,7 +77,7 @@ class factory(protocol.ClientFactory):
         # Who cares what happens now?
         reactor.stop()
 
-    # Avoid calling undefined handleResponse() at the end of the content (if
+    # Avoid calling undefined handleResponse() at the end of the message (if
     # the proxy sent a Content-Length header vs. a chunked response).
     # (Override connectionLost() when the proxy closes the client connection or
     # stop the reactor.)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/shortClientDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/shortClientDisconnect b/plugins/experimental/metalink/test/shortClientDisconnect
index 4ab6c83..6956c78 100755
--- a/plugins/experimental/metalink/test/shortClientDisconnect
+++ b/plugins/experimental/metalink/test/shortClientDisconnect
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 shortClientDisconnect
 # The proxy doesn't crash if the client disconnects before the proxy sends the
@@ -60,10 +60,10 @@ class factory(http.HTTPFactory):
 
         reactor.callLater(1, callback)
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -73,18 +73,13 @@ class factory(protocol.ClientFactory):
 
     reactor.stop()
 
-  class protocol(http.HTTPClient):
+  class protocol(protocol.Protocol):
     def connectionMade(ctx):
-      ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+      ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
       # Disconnect before the proxy sends the response headers
       ctx.transport.loseConnection()
 
-    # Avoid calling undefined handleResponse() at the end of the content or
-    # when the connection closes
-    def handleResponseEnd(ctx):
-      pass
-
 tcp.Connector('localhost', 8080, factory(), 30, None, reactor).connect()
 
 reactor.run()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/shortContentLengthDisconnect
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/shortContentLengthDisconnect b/plugins/experimental/metalink/test/shortContentLengthDisconnect
index 2e1c813..5662650 100755
--- a/plugins/experimental/metalink/test/shortContentLengthDisconnect
+++ b/plugins/experimental/metalink/test/shortContentLengthDisconnect
@@ -1,24 +1,24 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..2 shortContentLengthDisconnect
 # The proxy sends the right Content-Length header and closes the client
-# connection if the server disconnects before the proxy sends the response
+# connection if the origin disconnects before the proxy sends the response
 # headers'''
 
 from twisted.internet import error, protocol, reactor, tcp
@@ -45,10 +45,10 @@ class factory(http.HTTPFactory):
         # Disconnect before the proxy sends the response headers
         ctx.transport.loseConnection()
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -69,7 +69,7 @@ class factory(protocol.ClientFactory):
       else:
         print 'ok 2 - The client connection closed'
 
-    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*server.socket.getsockname()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleHeader(ctx, k, v):
       if k.lower() == 'content-length':
@@ -81,7 +81,7 @@ class factory(protocol.ClientFactory):
 
         print 'ok 1 - Content-Length header'
 
-    # Avoid calling undefined handleResponse() at the end of the content (if
+    # Avoid calling undefined handleResponse() at the end of the message (if
     # the proxy sent the wrong Content-Length header).  (Override
     # connectionLost() when the proxy closes the client connection or stop the
     # reactor.)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/54316fd3/plugins/experimental/metalink/test/zero
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/test/zero b/plugins/experimental/metalink/test/zero
index 6d42d56..3605a2b 100755
--- a/plugins/experimental/metalink/test/zero
+++ b/plugins/experimental/metalink/test/zero
@@ -1,20 +1,20 @@
 #!/usr/bin/env python
 
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership.  The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License.  You may obtain a copy of the
+# License at
 #
-#      http://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.  See the License for the specific language governing
+# permissions and limitations under the License.
 
 print '''1..1 zero
 # The proxy doesn't crash if the Content-Length is zero'''
@@ -40,10 +40,10 @@ class factory(http.HTTPFactory):
         ctx.setHeader('Content-Length', 0)
         ctx.finish()
 
-server = tcp.Port(0, factory())
-server.startListening()
+origin = tcp.Port(0, factory())
+origin.startListening()
 
-print '# Listening on {0}:{1}'.format(*server.socket.getsockname())
+print '# Listening on {0}:{1}'.format(*origin.socket.getsockname())
 
 class factory(protocol.ClientFactory):
   def clientConnectionFailed(ctx, connector, reason):
@@ -64,7 +64,7 @@ class factory(protocol.ClientFactory):
       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()))
+    connectionMade = lambda ctx: ctx.transport.write('GET {0}:{1} HTTP/1.1\r\n\r\n'.format(*origin.socket.getsockname()))
 
     def handleEndHeaders(ctx):
       try: