curl-and-python
Re: Getting range error although the server accepts range
Date: Thu, 19 Dec 2013 18:48:37 +0100
Try fake user agent.
Also check http version.
On 19 Dec 2013 18:23, "naheed arafat" <naheedcse_at_gmail.com> wrote:
> Both of them connected to the same server. Even the Header data sent to
> the server were same. Its just the response header which is different. May
> be i'm missing any curl options settings.
> My command line curl version is- curl/7.22.0 (i686-pc-linux-gnu)
> libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
>
>
>
> On Thu, Dec 19, 2013 at 11:03 PM, Dima Tisnek <dimaqq_at_gmail.com> wrote:
>
>> re: make sure, I meant check that in your failing test you are
>> actually talking to same server. I meant that to make sure the problem
>> you are seeing is consistent.
>>
>> perhaps someone else can answer what RESUME_FROM really does?
>>
>> another possible though unlikely issue is HEADERFUNCTION, try if
>> behaviour is any different without, as seen in VERBOSE log.
>>
>> On 19 December 2013 17:53, naheed arafat <naheedcse_at_gmail.com> wrote:
>> >
>> >
>> >
>> > On Thu, Dec 19, 2013 at 1:45 AM, Dima Tisnek <dimaqq_at_gmail.com> wrote:
>> >>
>> >> enable debug, validate request header fields.
>> >>
>> >> just in case of multiple dns entries, make sure same ip address is
>> >> connected to.
>> >>
>> >
>> > Could you please explain why i need to ensure that? and how i can ensure
>> > that in my code?
>> >
>> >> command line curl(*) range seems to work:
>> >> curl -v -r 1-10
>> >> http://cache1.tinyvid.net/otaku/3237ep5-Dragon_Ball_Z.mp4
>> >> curl -v -r 54513380-
>> >> http://cache1.tinyvid.net/otaku/3237ep5-Dragon_Ball_Z.mp4
>> >>
>> >> thus, check if the request header fields ultimately generated by your
>> >> programs are any different than command line tool
>> >>
>> >
>> > Yes, The header was different from the command line tool.
>> > In response to the range request the command line tool gets 206 Partial
>> > Content but pycurl code gets 200 OK response. The content-length field
>> is
>> > also different. I tried-
>> >
>> > In the command line:
>> >
>> > curl -v -r 0-10
>> http://cache1.tinyvid.net/otaku/3237ep5-Dragon_Ball_Z.mp4
>> >
>> > The code:
>> >
>> > import pycurl
>> > import cStringIO
>> > url="http://cache1.tinyvid.net/otaku/3237ep5-Dragon_Ball_Z.mp4"
>> > def test(debug_type, debug_msg):
>> > if debug_type!=3:
>> > print "debug(%d): %s" % (debug_type, debug_msg)
>> >
>> > c=pycurl.Curl()
>> > c.setopt(pycurl.URL,url)
>> > c.setopt(c.VERBOSE,True)
>> > c.setopt(pycurl.DEBUGFUNCTION, test)
>> > c.setopt(pycurl.FOLLOWLOCATION,0)
>> > c.setopt(pycurl.NOPROGRESS,0)
>> > c.setopt(c.NOBODY, 1)
>> > header = cStringIO.StringIO()
>> > c.setopt(c.HEADERFUNCTION, header.write)
>> > c.setopt(pycurl.RANGE,"0-10")
>> > try:
>> > c.perform()
>> > except pycurl.error,e:
>> > print e
>> >
>> > Any idea why they are different?
>> >
>> > _______________________________________________
>> > http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>> >
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>>
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-12-19