Feature #946

Reveal headers in httpGet request without loading file

Added by Fábio Ferreira almost 9 years ago. Updated almost 9 years ago.

Status:FixedStart date:04/24/2012
Priority:NormalDue date:
Assignee:Andreas Smas% Done:

100%

Category:Plugins
Target version:3.6

Description

Some few websites, like Videofriender requires that we get the headers of a video link (for example: http://46.23.67.117/videos/0076/0243/3df89258ae43c931cfb0da8e4c04a791cf83929d.mkv) so we can parse a better video link. The problem is that Showtime by default will download this file (there are no redirections in this link, it is a direct one) when it shouldn't because it has about 900Mb, we only need the headers, like peek at the server and close immediately the request without downloading it. In this case I would need headers.etag

Associated revisions

Revision 496f1705
Added by Andreas Smas almost 9 years ago

js: Add support for HEAD requests in showtime.httpGet

Fixes #946

Change included in version 3.5.158

History

#1 Updated by Andreas Smas almost 9 years ago

  • Status changed from New to Accepted
  • Priority changed from High to Normal

I'll implement the HEAD request, working like this:

[email protected]:~$ curl -v -X HEAD http://46.23.67.117/videos/0076/0243/3df89258ae43c931cfb0da8e4c04a791cf83929d.mkv
* About to connect() to 46.23.67.117 port 80 (#0)
*   Trying 46.23.67.117... connected
* Connected to 46.23.67.117 (46.23.67.117) port 80 (#0)
> HEAD /videos/0076/0243/3df89258ae43c931cfb0da8e4c04a791cf83929d.mkv HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 46.23.67.117
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Wed, 25 Apr 2012 01:28:59 GMT
< Server: Apache/2.2.3 (CentOS)
< Last-Modified: Thu, 27 Oct 2011 05:53:18 GMT
< ETag: "f530017-3825d98d-4b04163a58f80" 
< Accept-Ranges: bytes
< Content-Length: 942004621
< Connection: close
< Content-Type: text/plain; charset=UTF-8
< 
* transfer closed with 942004621 bytes remaining to read
* Closing connection #0
curl: (18) transfer closed with 942004621 bytes remaining to read
[email protected]:~$ 

#2 Updated by Andreas Smas almost 9 years ago

Here we go:

var v = showtime.httpGet('http://zebes.lonelycoder.com/', null, null, 
    {debug:true, headRequest: true});

showtime.print('result: ' + v);

As you can see, no output. Headers are there though.

#3 Updated by Andreas Smas almost 9 years ago

  • Status changed from Accepted to Fixed
  • % Done changed from 0 to 100

Also available in: Atom PDF