maxwell / screencap

A gem to screencap webpages in ruby. Uses Phantom.js under the hood.
MIT License
179 stars 63 forks source link

There seems to be a issue when handling redirects. #23

Open PretentiousYuppieSloth-zz opened 9 years ago

PretentiousYuppieSloth-zz commented 9 years ago

I am using the code found under "usage" on the github page for screencap. It works for most of the sites. But as soon as i hit a site with a redirect to https, it throws me a error. I am not one who often posts issues like this, but i hope my limited amount of information can be of use. I will try to find a public site which will throw this error.

Thanks for an great project.

/var/lib/gems/1.9.1/gems/screencap-0.1.2/lib/screencap/phantom.rb:15:in rasterize': Could not load URL http://dialin.domain.com (Screencap::Error) from /var/lib/gems/1.9.1/gems/screencap-0.1.2/lib/screencap/fetcher.rb:24:inraster' from /var/lib/gems/1.9.1/gems/screencap-0.1.2/lib/screencap/fetcher.rb:9:in fetch' from GetSubDomains.rb:37:inblock in

' from GetSubDomains.rb:29:in each_line' from GetSubDomains.rb:29:in
'

curl -v dialin.domain.com
* About to connect() to dialin.domain.com port 80 (#0)
*   Trying x.x.x.x...
* connected
* Connected to dialin.domain.com (x.x.x.x) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.26.0
> Host: dialin.domain.com
> Accept: */*
> 
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 302 Redirect
< Content-Type: text/html; charset=UTF-8
< Location: https://dialin.domain.com/
< Server: Microsoft-IIS/8.0
< Date: Sun, 17 May 2015 10:47:47 GMT
< Content-Length: 145
< 
<head><title>Document Moved</title></head>
* Connection #0 to host dialin.domain.com left intact
<body><h1>Object Moved</h1>This document may be found <a HREF="https://dialin.domain.com/">here</a></body>* Closing connection #0