Thriftpy / thriftpy2

Pure python approach of Apache Thrift.
MIT License
572 stars 91 forks source link

Keep http connection open for long-time #208

Open orinciog opened 1 year ago

orinciog commented 1 year ago

Hi!

I'm using thriftpy2 to connect to a hbase thrift server, which has enabled http mode. We need long-lived connections to our http server in order to save time.

I saw a couple of lines in http.py which prevents to do this:

if self.isOpen():
    self.close()
self.open()

Basically these lines prevent to use headers such as Connection: keep-alive or use low-level socket keep-alive, because they close the underlining socket before a request.

Can I submit a PR to opt-out for those lines? Thank you.

ethe commented 1 year ago

Yes, we are glad to submit a PR to support it, thank you.