changeset 299:0c2b6f1b1fc0 draft

Update websites used for GetMyExternalIP git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@180 1a98c847-1fd6-4fd8-948a-caf3550aa51b
author gavinandresen <gavinandresen@1a98c847-1fd6-4fd8-948a-caf3550aa51b>
date Mon, 15 Nov 2010 21:37:33 +0000
parents 0adf5936e929
children 015d5de83339
files net.cpp serialize.h
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/net.cpp
+++ b/net.cpp
@@ -128,7 +128,7 @@
     string strLine;
     while (RecvLine(hSocket, strLine))
     {
-        if (strLine.empty())
+        if (strLine.empty()) // HTTP response is separated from headers by blank line
         {
             loop
             {
@@ -137,6 +137,8 @@
                     closesocket(hSocket);
                     return false;
                 }
+                if (pszKeyword == NULL)
+                    break;
                 if (strLine.find(pszKeyword) != -1)
                 {
                     strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
@@ -176,26 +178,26 @@
     {
         if (nHost == 1)
         {
-            addrConnect = CAddress("70.86.96.218:80"); // www.ipaddressworld.com
+            addrConnect = CAddress("72.233.89.199:80"); // www.whatismyip.com
 
             if (nLookup == 1)
             {
-                struct hostent* phostent = gethostbyname("www.ipaddressworld.com");
+                struct hostent* phostent = gethostbyname("www.whatismyip.com");
                 if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
                     addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
             }
 
-            pszGet = "GET /ip.php HTTP/1.1\r\n"
-                     "Host: www.ipaddressworld.com\r\n"
-                     "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
+            pszGet = "GET /automation/n09230945.asp HTTP/1.1\r\n"
+                     "Host: www.whatismyip.com\r\n"
+                     "User-Agent: Bitcoin/1.0 (see www.bitcoin.org)\r\n"
                      "Connection: close\r\n"
                      "\r\n";
 
-            pszKeyword = "IP:";
+            pszKeyword = NULL; // Returns just IP address
         }
         else if (nHost == 2)
         {
-            addrConnect = CAddress("208.78.68.70:80"); // checkip.dyndns.org
+            addrConnect = CAddress("91.198.22.70:80"); // checkip.dyndns.org
 
             if (nLookup == 1)
             {
--- a/serialize.h
+++ b/serialize.h
@@ -22,7 +22,7 @@
 class CAutoFile;
 static const unsigned int MAX_SIZE = 0x02000000;
 
-static const int VERSION = 31500;
+static const int VERSION = 31501;
 static const char* pszSubVer = "";