PATCH: Fix for crash-on-startup issues for non-US issues

I have found that the recent XBMC revisions (specifically r10624 and r10626 that I've tried) have a bug in the connection test which causes XBMC to crash if you are outside of the US. The problem specifically is that the HTTP library tries to follow redirects in HEAD requests, causing what I think might be a null pointer issue.

Outside of the US, automatically redirects to the local version of Google.

This patch makes it so that the HTTP library will NOT follow redirects in HEAD requests, and updates Google's IP address so it is current.

Index: xbmc/utils/HTTP.cpp
--- xbmc/utils/HTTP.cpp (revision 10626)
+++ xbmc/utils/HTTP.cpp (working copy)
@@ -280,7 +280,7 @@
   CStdString strURL = "";
   if (!checkDNS)
-    strURL = ""; // ip
+    strURL = ""; // IP address
   int status = Open(strURL, "HEAD", NULL);

@@ -926,7 +926,6 @@
     case 302:
       // 302 Found - auto redirect if this is a GET
       //Post redirect has to work for scrapers
-      //CanHandle = !stricmp(verb, "GET");
       CanHandle = true;
     case 303:
@@ -941,8 +940,10 @@

-    if (!CanHandle)
+    // pass through HEAD requests, as we assume that if you did a head request
+    // you don't want to follow redirects etc.
+    if (!CanHandle || !stricmp(verb, "HEAD"))
       CLog::Log(LOGERROR, "Server returned: %d %s", status, strReason.c_str());
       return status; // unhandlable

(pastebin link for if the forum decides to eat my code)
Thanks for the patch, it was applied in 10643.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Please read and follow the forum rules.
For troubleshooting and bug reporting, please make sure you read this first.

[Image: badge.gif]
Thread Rating:
  • 0 Vote(s) - 0 Average

Logout Mark Read Team Forum Stats Members Help
PATCH: Fix for crash-on-startup issues for non-US issues00