curl-and-python

Re: pycurl`s curl.Curl interface wrong behaviour

From: Dima Tisnek via curl-and-python <curl-and-python_at_cool.haxx.se>
Date: Tue, 20 Sep 2016 10:14:38 +0200

Your concern seems legit.
Open an issue at https://github.com/pycurl/pycurl/issues

On 20 September 2016 at 09:30, Sergey A <sergb95_at_list.ru> wrote:
> В Mon, 19 Sep 2016 15:32:56 +0200
> Dima Tisnek <dimaqq_at_gmail.com> пишет:
>
>> Indeed, it looks like `Curl` is designed to be a throw-away object.
>>
>> If it were intended for reuse, I'd expect to see all the default
>> settings in own method, which is called from {init, get, post}.
>>
>> On 19 September 2016 at 15:04, Cepгей А via curl-and-python
>> <curl-and-python_at_cool.haxx.se> wrote:
>> > Hello,
>> > There is a bug in pycurl`s curl module. When using
>> > curl.Curl requests subsequently, curl.Curl.__request returns the
>> > current request` body, inculing the previous bodies. The cause is
>> > about wrong handling of curl.Curl`s internal StringIO buffer. It
>> > can be fixed by adding these two lines to curl.Curl`s __request
>> > function:
>> >
>> > self.payload_io.seek(0)
>> > self.payload_io.truncate()
>> >
>> > I`m running Python 2.7 ,PycURL/7.43.0 libcurl/7.50.1 on Debian Sid.
>> >
>> > _______________________________________________
>> > https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>
> They didn`t tell that it is a throwaway thing. I think is`s just a
> quick and simple interface to the pycurl library. Which can and should
> be reused. Currently, the fact that __request does not clear the buffer
> prevents it from being reused. However, I don`t think all the defaults
> should be called from requests. Just one time, during the
> instantiation, because you`ll have to redefine the options in some
> cases.
>
> As I recall, the whole thing (multiple requests) was working alright a
> while ago. Did something change? If not, would anyone care to patch it?

_______________________________________________
https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2016-09-20