Commit Graph

105 Commits

Author SHA1 Message Date
Bryan Duxbury
b7887b860b THRIFT-789. Files missing proper Apache license header
Added the Apache license header to a bunch of files that were missing it.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@953167 13f79535-47bb-0310-9956-ffa450edef68
2010-06-09 21:30:54 +00:00
Bryan Duxbury
cb6d9708e2 THRIFT-438. py: Add support for Twisted.web in servers and clients
This patch adds a Twisted.web resource that can be used for processing incoming Thrift requests over HTTP

Patch: Esteve Fernandez

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939413 13f79535-47bb-0310-9956-ffa450edef68
2010-04-29 18:14:54 +00:00
David Reiss
c548b3dd63 THRIFT-475. python: Eliminate DeprecationWarning
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920661 13f79535-47bb-0310-9956-ffa450edef68
2010-03-09 05:19:18 +00:00
David Reiss
ff3d249d41 THRIFT-658. python: Add THttpClient.setTimeout()
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920660 13f79535-47bb-0310-9956-ffa450edef68
2010-03-09 05:19:16 +00:00
David Reiss
6acc269d18 THRIFT-695. python: [de]serialize convenience functions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@916508 13f79535-47bb-0310-9956-ffa450edef68
2010-02-26 00:56:02 +00:00
Todd Lipcon
f5dea4c7f3 THRIFT-637. python: Fix mixing of oneway and regular requests in TNonblockingServer
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@886646 13f79535-47bb-0310-9956-ffa450edef68
2009-12-03 01:18:44 +00:00
David Reiss
034c49f0fc THRIFT-612. python: Fix exception bug in TFramedTransport.cstringio_refill
readFrame was being called without "self."

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@830673 13f79535-47bb-0310-9956-ffa450edef68
2009-10-28 17:07:14 +00:00
Esteve Fernandez
bff2a35adf THRIFT-586. python: TSocket incorrectly sets the exception type when an end of file error occurs
TTransportException's type was set to "Transport not open" in some cases, which should
be its message.
Use named arguments and set the type for TTransportException to END_OF_FILE in TSocket#read
and TSocket#write.

reviewer: dreiss



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@818429 13f79535-47bb-0310-9956-ffa450edef68
2009-09-24 10:22:00 +00:00
Esteve Fernandez
d3571c2ace THRIFT-535. py: Twisted Thrift protocol max length is too small (fix off-by-one error in MAX_LENGTH)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@795187 13f79535-47bb-0310-9956-ffa450edef68
2009-07-17 18:35:52 +00:00
Esteve Fernandez
c5a7c151e1 THRIFT-535. py: Twisted Thrift protocol max length is too small
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@795176 13f79535-47bb-0310-9956-ffa450edef68
2009-07-17 18:18:19 +00:00
David Reiss
a043be31fc THRIFT-495. python: Raise a TTransportException if TSocket is not open
Previously, TSocket.write would raise an AttributeError if the transport
had not been opened.  A TTransportException with the code set to
NOT_OPEN is more appropriate.  The cost of the check should be
negligible, since TSocket.write is already fairly expensive (it does a
system call).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@773762 13f79535-47bb-0310-9956-ffa450edef68
2009-05-12 02:17:43 +00:00
David Reiss
16514d0a72 THRIFT-494. python: Update meta-information in setup.py
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@773306 13f79535-47bb-0310-9956-ffa450edef68
2009-05-10 05:14:44 +00:00
Bryan Duxbury
def30a6072 THRIFT-387. Add appropriate Apache header to all code files
This hits all the documentation and some misc code files that have avoided the license up to this point.



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@763048 13f79535-47bb-0310-9956-ffa450edef68
2009-04-08 00:19:37 +00:00
David Reiss
deda141392 THRIFT-388. Create a "ONEWAY" message type that is an alias for "CALL"
Pave the way for a new message type for oneway function calls.
For now, just define the constant in all languages and make
server implementations treat it the same way as a normal call.
Only C++ and Erlang currently check the message type (on the
server side).

There is a little bit of redundancy in the Erlang code, but
the alternative is a bit gross, and this split-up will be
necessary eventually when we start handling one-way calls
differently.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761389 13f79535-47bb-0310-9956-ffa450edef68
2009-04-02 19:22:31 +00:00
David Reiss
ea2cba8ba8 THRIFT-387. Add license headers to a bunch of files
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@760189 13f79535-47bb-0310-9956-ffa450edef68
2009-03-30 21:35:00 +00:00
David Reiss
2aa289072b THRIFT-154. python: Make THttpClient take a URL in its constructor
Support https in the process.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758532 13f79535-47bb-0310-9956-ffa450edef68
2009-03-26 06:22:18 +00:00
David Reiss
d73255d1ac THRIFT-329. python: Make TServerSocket.close() work properly
Changing the order of inheritance makes "close" refer to the
(correct) TSocketBase method, rather than the (stub)
TServerTransportBase method.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758072 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 22:51:02 +00:00
David Reiss
a528f54eeb THRIFT-360. python: Make fastbinary skip struct fields with the wrong type
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758071 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 22:48:40 +00:00
David Reiss
7c1f6f8e33 THRIFT-155. python: Reopen THttpClient on a flush
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757996 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:10:24 +00:00
David Reiss
6ce401dd55 THRIFT-136. s/async/oneway/ in misc places
This is mostly an internal-only change.
It affects docstrings, messages, variables, test cases, etc.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757992 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:01:58 +00:00
David Reiss
c51986f438 THRIFT-136. s/async/oneway/ in comments
This is an internal-only change.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757990 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 20:01:25 +00:00
Kevin Clark
127d01cb06 THRIFT-391. py: Fix memory leak in fastbinary
Author: Alexander Shigin

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757634 13f79535-47bb-0310-9956-ffa450edef68
2009-03-24 01:40:56 +00:00
David Reiss
4980910100 THRIFT-362. python: Detect endianness on Solaris
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755776 13f79535-47bb-0310-9956-ffa450edef68
2009-03-18 23:14:13 +00:00
Kevin Clark
e8d3c47944 THRIFT-148. py: One more time, reapply the most *recent* patch
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@749795 13f79535-47bb-0310-9956-ffa450edef68
2009-03-03 22:13:46 +00:00
Kevin Clark
e43f7e0925 THRIFT-148. py: Add un-commited file missing from 749510
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@749786 13f79535-47bb-0310-9956-ffa450edef68
2009-03-03 22:03:57 +00:00
David Reiss
b139f64448 THRIFT-325. Remove a bunch of uses of the old command line format
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745242 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:28:46 +00:00
David Reiss
fdd8b5ab01 THRIFT-340. python: Detect endianness properly on FreeBSD
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745223 13f79535-47bb-0310-9956-ffa450edef68
2009-02-17 20:06:08 +00:00
David Reiss
0b7d6fa5ee THRIFT-314. Purge reflection.limited
This was a feature designed to allow a Thrift server to report
information about its interface.  However, the feature has
significant design problems, and is presence is currently causing
confusion without doing any good.  Therefore, it is being removed.
It will always be in source control if and when we are ready to
come back to it.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@741824 13f79535-47bb-0310-9956-ffa450edef68
2009-02-07 02:36:35 +00:00
David Reiss
f78ec2bc66 THRIFT-195. python: Add a simple THttpServer
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739638 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 21:59:32 +00:00
David Reiss
1fe17774eb python: Add TFileObjectTransport
TFileObjectTransport is a Thrift transport that wraps a
Python-style file-like object.  This is necessary to add
methods like isOpen and readAll.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739637 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 21:59:27 +00:00
David Reiss
4c591c95a5 THRIFT-212. python: Make TFramedTransport implement CReadableTransport
This involved adding a few methods to provide lower-level access to the
internal read buffer.  This will allow us to use TBinaryProtocolAccelerated
with TFramedTransport.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739632 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 21:39:25 +00:00
David Reiss
647d30d218 python: Make TFramedTransport use a cStringIO for reading
Tested by running a client against a framed-transport server.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739631 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 21:39:20 +00:00
David Reiss
fb695b77d3 python: Eliminate the option of TFramedTransport to not frame
We've done this in a few other languages.  All the tests still pass.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739630 13f79535-47bb-0310-9956-ffa450edef68
2009-01-31 21:39:16 +00:00
David Reiss
74421273ad THRIFT-67. python: Add TNonblockingServer
This TNonblockingServer is very similar to the C++ implementation.
It assumes the framed transport, but it uses select instead of libevent.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@712306 13f79535-47bb-0310-9956-ffa450edef68
2008-11-07 23:09:31 +00:00
Mark Slee
4f1bbc7e8a THRIFT-170: Buffered transports leave data in write buffer on failed flush
Reviewed By: mcslee



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@704714 13f79535-47bb-0310-9956-ffa450edef68
2008-10-14 22:05:11 +00:00
David Reiss
58434e6988 THRIFT-108. python: Fix call to PyDict_Next in fastbinary.c
The position parameter is supposed to be a Py_ssize_t*, not an int*.
This was probably just an oversight in the original patch, and it
was preventing maps from serializing properly on x86-64.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@702640 13f79535-47bb-0310-9956-ffa450edef68
2008-10-07 21:08:10 +00:00
David Reiss
e29995e75b THRIFT-48. python: Make TServerSocket work with Unix-domain sockets
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@681467 13f79535-47bb-0310-9956-ffa450edef68
2008-07-31 20:15:17 +00:00
David Reiss
0ee93eaa46 THRIFT-93. Remove unnecessary shebang lines from Python libraries
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@678529 13f79535-47bb-0310-9956-ffa450edef68
2008-07-21 19:03:11 +00:00
Kevin Clark
1e0744d7a2 rb: Make TServer.py Python 2.4 compatible [THRIFT-44]
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@671337 13f79535-47bb-0310-9956-ffa450edef68
2008-06-24 20:46:32 +00:00
David Reiss
b04df765b5 Change Python servers to use the standard logging module.
Previously Thrift was using `print` to report errors.  Thrift is infrastructure
and should not impose its error logging mechanism on the apps that use it.  For
example, [elided] uses the logging module to send logs to a particular file.

I ran the unit test.  That exercises most of the error handling routines.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666364 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:38 +00:00
David Reiss
bcaa2ad0d6 Python forking server should close connection in parent.
When a function called by the forking python thrift server throws an
exception the client will hang.  This happens because the parent of the
forked process does not properly close the socket fd.

Under normal operation the server operation completes and returns a value to
the client.  However, when an exception occurs the 'end' message is never
sent to the client so the client relies on a connection close to abort the
call (this is how the threading server works I believe).

This fails with the forking server because the parent process never closes
the socket fd.  The child has closed the fd at this point, but the
connection will not actually be closed until all open instances of the fd
are closed. Since the client is waiting for a message and the server never
closes it the client is forced to wait until a read timeout occurs many
minutes later.

This diff closes the parent's copy of the socket fd immediately after the
fork occurs.

I modified my load test server to throw an exception.  The client did not hang.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666363 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:55:26 +00:00
David Reiss
665365490f Forking Python server.
The python threading model does not provide concurrency for CPU-bound
processes.  Process forking is the current recommended way of writing
scalable Python servers.

Harry Wang ran the [elided] backend with this change for 3 days and observed
no errors.  The threaded backend caused unexplained lockups under this load
after 24 hours.

I also ran a CPU-bound load test against this server with 32 concurrent
clients.  It completed 5X faster than the threaded implementation.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666359 13f79535-47bb-0310-9956-ffa450edef68
2008-06-10 22:54:49 +00:00
David Reiss
3de1c4e4d3 Use "all-local" instead of all in Makefile.am.
Summary:
Redefining an Automake rule totally blows away anything Automake puts in place.
By using all-local instead of all, we can just add to the generated rule.

Reviewed By: marc

Test Plan: make


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665499 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 17:45:03 +00:00
David Reiss
2ca456a8ae Make "make clean" rules a bit more standard.
Summary:
make-generic is some sort of internal undocumented thing.
make-local is what is supposed to be used for this stuff.
Also use $(RM) instead of "rm -f".

Reviewed By: marc

Test Plan: make clean


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665498 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 16:42:18 +00:00
David Reiss
223d6bd1ac Make "make check" work properly for Python and Java.
Summary:
The Python and Java versions of "make check" only work if "make all" has
been run.  Our automake-fu isn't strong enough to make proper dependencies,
so this hack suggested by Nitay will force the libraries to be built
before make check is run.

Test Plan: make check


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665497 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 02:03:17 +00:00
David Reiss
bc444b034e Thrift: Fix a bug in the skip function in Python's fastbinary.c
Reviewed By: mcslee

Other Notes:
Submitted by Ben Maurer (the original author).


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665479 13f79535-47bb-0310-9956-ffa450edef68
2008-02-14 20:20:08 +00:00
David Reiss
0c90f6f8af Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.

Reviewed By: mcslee

Test Plan: git diff -b

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:18:40 +00:00
dweatherford
33d8f340dc [thrift] py: TApplicationException.__str__
Summary: Now infinitely more printable than ever before!
Reviewed by: mcslee
Test Plan: except TApplicationException, inst: \n\t\t print inst
Revert: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665414 13f79535-47bb-0310-9956-ffa450edef68
2008-01-07 22:23:07 +00:00
David Reiss
832b262aca Thrift: Revamp build to use a single configure.ac.
Summary:
Ben Maurer suggested that it would make sense for Thrift to build as
a single project, with one configure.ac and multiple Makefile.am.
He was also kind enough to do the heavy lifting, and this commit
is the application of his patch (with minor modifications).
The most significant visible change from this diff is that
in order to buidl one of the thrift sub-projects (i.e.: the compiler,
the C++ library, or the Python library) you must run bootstrap.sh
and configure in the Thrift root, then make in the specific project.
Users who want to build and install the Python library but
can't run configure because they don't have Boost can simply
run setup.py directly.

Reviewed By: mcslee

Test Plan: Built Thrift from scratch.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665409 13f79535-47bb-0310-9956-ffa450edef68
2007-12-28 18:25:33 +00:00
David Reiss
c16a8f6e45 Thrift: Python support for Unix-domain sockets, and eager timeout setting.
Reviewed By: mcslee

Test Plan: Ran the test script.

Revert Plan: ok

Other Notes:
Contributed by Ben Maurer.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665394 13f79535-47bb-0310-9956-ffa450edef68
2007-12-14 23:46:47 +00:00