THRIFT-3877: fix py/py3 server, java client with http transport
The java TestClient asks the server to runa oneway request that
sleeps for 3 seconds. If the java TestClient sees the duration
of the call exceed one second, it fails the test. This means the
server did not participate in the "fire and forget" dynamics of
ONEWAY requests. In this case the THttpServer was processing the
RPC before sending the transport response. The fix was to enhance
the TProcessor so that the THttpServer has an opportunity to inspect
the message header before processing the RPC.
This is partly due to the violation of the THttpServer in the
layered architecture. It is essentially implementing a combined
server and transport, whereas there should be a distinct server,
protocol, and transport separation. Many languages seem to have
this problem where HTTP was introduced.
diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py
index 00941d8..c390cbb 100644
--- a/lib/py/src/Thrift.py
+++ b/lib/py/src/Thrift.py
@@ -72,6 +72,18 @@
"""Base class for processor, which works on two streams."""
def process(self, iprot, oprot):
+ """
+ Process a request. The normal behvaior is to have the
+ processor invoke the correct handler and then it is the
+ server's responsibility to write the response to oprot.
+ """
+ pass
+
+ def on_message_begin(self, func):
+ """
+ Install a callback that receives (name, type, seqid)
+ after the message header is read.
+ """
pass