Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-06 Thread Cory Benfield
> On 6 May 2017, at 20:09, Cory Benfield wrote: > > I consider this a bug in Twisted: I’ll open a ticket. This is now Twisted ticket #9132: https://twistedmatrix.com/trac/ticket/9132 ___ Twisted-Python mai

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-06 Thread Cory Benfield
> On 5 May 2017, at 12:38, Phil Mayers wrote: > >> As a third note, your code does not handle the possibility that >> original._transport may not implement IPushProducer. While *in > > IIUC IResponse.deliverBody *does* guarantee (currently) to provide a > transport implementing IPushProducer t

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Nagy, Attila
On 05/05/2017 01:10 PM, Cory Benfield wrote: The first is that Twisted will break your code eventually. Private member attributes are not covered by Twisted’s deprecation policy, and they can be changed without warning for any reason. So you’ll need to pin your Twisted version. I feel myself

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Phil Mayers
On 05/05/17 12:40, Nagy, Attila wrote: Cool. If you're happy using private members, knock yourself out. I'm not happy with that of course. The really cool thing would be if Twisted could support this task without the need of complicated and error-prone code. I don't disagree, of course. Cory

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Nagy, Attila
On 05/05/2017 12:29 PM, Phil Mayers wrote: On 05/05/17 10:41, Nagy, Attila wrote: What possible side effects do you see here? What problems could it cause? So far I've tried to copy a lot of files in parallel, arbitrarily drop connections. Everything seems OK. The file is either transferred in

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Phil Mayers
On 05/05/17 12:10, Cory Benfield wrote: As a second note, you may lock yourself out of HTTP/2. HTTP/2 is not guaranteed to give you access to a raw transport object (though it FWIW this kind of thing was, more or less, what I was thinking. It seems unlikely that stealing the TCP connection fr

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Cory Benfield
> On 5 May 2017, at 10:41, Nagy, Attila wrote: > > On 05/05/2017 10:26 AM, Phil Mayers wrote: >> On 04/05/17 16:30, Nagy, Attila wrote: >> >>> I would like to use the simplest (and correct of course) solution. >>> Juggling with buffering/data by hand seems even more risky to me. >> >> The prob

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Phil Mayers
On 05/05/17 10:41, Nagy, Attila wrote: What possible side effects do you see here? What problems could it cause? So far I've tried to copy a lot of files in parallel, arbitrarily drop connections. Everything seems OK. The file is either transferred in its entirety or (in case of dropped connec

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Nagy, Attila
On 05/05/2017 10:26 AM, Phil Mayers wrote: On 04/05/17 16:30, Nagy, Attila wrote: I would like to use the simplest (and correct of course) solution. Juggling with buffering/data by hand seems even more risky to me. The problem with the approach you've outlined is that it treats the transport

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-05 Thread Phil Mayers
On 04/05/17 16:30, Nagy, Attila wrote: I would like to use the simplest (and correct of course) solution. Juggling with buffering/data by hand seems even more risky to me. The problem with the approach you've outlined is that it treats the transport (a private member) in ways that I suspect a

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-04 Thread Manish Tomar
Have you looked at http://treq.readthedocs.io/en/latest/howto.html#handling-streaming-responses ? Regards, Manish On Thu, May 4, 2017 at 5:04 AM, Nagy, Attila wrote: > Hi, > > I would like to copy a file between two HTTP servers in the most efficient > manner, which probably means a streaming d

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-04 Thread Nagy, Attila
On 05/04/2017 04:48 PM, Phil Mayers wrote: On 04/05/17 14:32, Nagy, Attila wrote: Are there any problems with this approach? You're poking at a private member of the .original IResponse there, and moreover the transport object which seems risky. I would like to use the simplest (and correct

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-04 Thread Phil Mayers
On 04/05/17 14:32, Nagy, Attila wrote: Are there any problems with this approach? You're poking at a private member of the .original IResponse there, and moreover the transport object which seems risky. The single treq.collect call to consumer.write will also not necessarily respect the co

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-04 Thread Nagy, Attila
On 05/04/2017 03:04 PM, Phil Mayers wrote: On 04/05/17 13:04, Nagy, Attila wrote: Hi, I would like to copy a file between two HTTP servers in the most efficient manner, which probably means a streaming down/upload (GET/PUT) with the producer/consumer scheme. Can this be done easily, could s

Re: [Twisted-Python] HTTP PUT a GET's streaming response with treq

2017-05-04 Thread Phil Mayers
On 04/05/17 13:04, Nagy, Attila wrote: Hi, I would like to copy a file between two HTTP servers in the most efficient manner, which probably means a streaming down/upload (GET/PUT) with the producer/consumer scheme. Can this be done easily, could somebody write a simple example? I guess it