Author: tian
Date: Mon May  8 11:15:53 2017
New Revision: 2292

URL: http://svn.gna.org/viewcvs/gcstar?rev=2292&view=rev
Log:
Support https for plugins

Modified:
    trunk/gcstar/lib/gcstar/GCMainWindow.pm
    trunk/gcstar/lib/gcstar/GCPlugins/GCPluginsBase.pm
    trunk/gcstar/lib/gcstar/GCPlugins/GCbuildingtoys/GCBrickset.pm
    trunk/gcstar/lib/gcstar/GCUtils.pm

Modified: trunk/gcstar/lib/gcstar/GCMainWindow.pm
URL: 
http://svn.gna.org/viewcvs/gcstar/trunk/gcstar/lib/gcstar/GCMainWindow.pm?rev=2292&r1=2291&r2=2292&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCMainWindow.pm     (original)
+++ trunk/gcstar/lib/gcstar/GCMainWindow.pm     Mon May  8 11:15:53 2017
@@ -1308,7 +1308,7 @@
             $suffix ||= $self->{defaultPictureSuffix};
             my $picture = $self->getUniqueImageFileName($suffix, $title);
     
-            if ($picUrl =~ m|^http://|)
+            if ($picUrl =~ m|^https?://|)
             {
                 $self->setWaitCursor($self->{lang}->{StatusGetImage});
                 GCUtils::downloadFile($picUrl, $picture, $self);

Modified: trunk/gcstar/lib/gcstar/GCPlugins/GCPluginsBase.pm
URL: 
http://svn.gna.org/viewcvs/gcstar/trunk/gcstar/lib/gcstar/GCPlugins/GCPluginsBase.pm?rev=2292&r1=2291&r2=2292&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCPlugins/GCPluginsBase.pm  (original)
+++ trunk/gcstar/lib/gcstar/GCPlugins/GCPluginsBase.pm  Mon May  8 11:15:53 2017
@@ -29,6 +29,7 @@
     package GCPluginParser;
     use base qw(HTML::Parser);
     use LWP::Simple qw($ua);
+    use LWP::Protocol::https;
     use HTTP::Cookies::Netscape;
     use URI::Escape;
     use HTML::Entities;
@@ -43,6 +44,7 @@
         my $self  = $class->SUPER::new();
 
         $ua->agent('Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) 
Gecko/20041111 Firefox/1.0');
+        $ua->ssl_opts(verify_hostname => 0);
         $ua->default_header('Accept-Encoding' => 'x-gzip');
         $ua->default_header('Accept' => 'text/html');
         $self->{ua} = $ua;
@@ -137,7 +139,9 @@
             }
             else
             {
+               print "GETTING $url\n";
                 $response = $ua->get($url);
+                print "GOT: ",$response->code,"\n";
             }
             
                        #UnclePetros 03/07/2011:
@@ -150,7 +154,9 @@
             }
             
             eval {
+               print "GETTING result\n";
                 $result = $response->decoded_content;
+               print "RESULT : $result\n";
             };
             if ($debugPhase == 1)
             {

Modified: trunk/gcstar/lib/gcstar/GCPlugins/GCbuildingtoys/GCBrickset.pm
URL: 
http://svn.gna.org/viewcvs/gcstar/trunk/gcstar/lib/gcstar/GCPlugins/GCbuildingtoys/GCBrickset.pm?rev=2292&r1=2291&r2=2292&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCPlugins/GCbuildingtoys/GCBrickset.pm      
(original)
+++ trunk/gcstar/lib/gcstar/GCPlugins/GCbuildingtoys/GCBrickset.pm      Mon May 
 8 11:15:53 2017
@@ -83,7 +83,7 @@
                 if $self->{currentAttr};
             if ($self->{currentAttr} eq 'internalId')
             {
-                $self->{itemsList}[$self->{itemIdx}]->{url} = 
'http://brickset.com/api/v2.asmx/getSet?apiKey=UthW-nzee-P8f6&userHash=&setID='.$origtext;
+                $self->{itemsList}[$self->{itemIdx}]->{url} = 
'https://brickset.com/api/v2.asmx/getSet?apiKey=UthW-nzee-P8f6&userHash=&setID='.$origtext;
             }
         }
         else
@@ -101,7 +101,7 @@
     sub getAdditionalImages
     {
         my $self = shift;
-        my $url = 
'http://brickset.com/api/v2.asmx/getAdditionalImages?apiKey=UthW-nzee-P8f6&setID='.$self->{curInfo}->{internalId};
+        my $url = 
'https://brickset.com/api/v2.asmx/getAdditionalImages?apiKey=UthW-nzee-P8f6&setID='.$self->{curInfo}->{internalId};
         $self->{parsingTips} = 1;
         my $xml = $self->loadPage($url, 0, 1);
         my $xs = XML::Simple->new;
@@ -172,7 +172,8 @@
     {
         my ($self, $word) = @_;
         $word =~ s/\+/ /g;
-        return 
'http://brickset.com/api/v2.asmx/getSets?apiKey=UthW-nzee-P8f6&userHash=&theme=&subtheme=&year=&owned=&wanted=&orderby=YearFromDESC&pageSize=200&pageNumber=&userName=&setNumber=&query='.$word;
+        return 
'https://brickset.com/api/v2.asmx/getSets?apiKey=UthW-nzee-P8f6&userHash=&theme=&subtheme=&year=&owned=&wanted=&orderby=YearFromDESC&pageSize=200&pageNumber=&userName=&setNumber=&query='.$word;
+       
         #return 'http://brickset.com/sets?query='.$word;
     }
     
@@ -184,7 +185,7 @@
         {
             if ($url =~ /internalID=(\d*)/)
             {
-                return 
'http://brickset.com/api/v2.asmx/getSet?apiKey=UthW-nzee-P8f6&userHash=&setID='.$1;
+                return 
'https://brickset.com/api/v2.asmx/getSet?apiKey=UthW-nzee-P8f6&userHash=&setID='.$1;
             }
         }
         else

Modified: trunk/gcstar/lib/gcstar/GCUtils.pm
URL: 
http://svn.gna.org/viewcvs/gcstar/trunk/gcstar/lib/gcstar/GCUtils.pm?rev=2292&r1=2291&r2=2292&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCUtils.pm  (original)
+++ trunk/gcstar/lib/gcstar/GCUtils.pm  Mon May  8 11:15:53 2017
@@ -509,6 +509,7 @@
 }
 
 use LWP::UserAgent;
+use LWP::Protocol::https;
 sub downloadFile
 {
     my ($url, $dest, $settings) = @_;
@@ -517,6 +518,7 @@
     $browser->cookie_jar(HTTP::Cookies::Netscape->new(
         'file' => $settings->{options}->cookieJar));
     $browser->agent($settings->{agent});
+    $browser->ssl_opts(verify_hostname => 0);
     $browser->default_headers->referer($url);
     $browser->get($url, ':content_file' => $dest);
 }


_______________________________________________
GCstar-commits mailing list
[email protected]
https://mail.gna.org/listinfo/gcstar-commits

Reply via email to