Ticket #25128: helpful-dns-2.diff

File helpful-dns-2.diff, 1.3 KB (added by ryandesign (Ryan Carsten Schmidt), 14 years ago)

revised patch, tested on Tiger, Leopard, & Snow Leopard

  • src/port1.0/portfetch.tcl

     
    492492                        file delete -force "${distpath}/${distfile}.TMP"
    493493
    494494                        # Continue on to try the next mirror, if any
     495                    } elseif {".html" != [file extension ${distfile}] &&
     496                        "text/html" == [strsed [exec [findBinary file $portutil::autoconf::file_path] ${distpath}/${distfile} --brief --mime] {s/;.*$//}]} {
     497                        # file --mime-type would be preferable to file --mime and strsed, but is only available as of Snow Leopard
     498
     499                        # We got an HTML file, though the distfile name does not suggest that one was
     500                        # expected. Probably a helpful DNS server sent us to its search results page
     501                        # instead of admitting that the server we asked for doesn't exist.
     502                        ui_debug [msgcat::mc "Fetching failed because we received an HTML page instead of the distfile"]
     503                        file delete -force "${distpath}/${distfile}"
     504
     505                        # Continue on to try the next mirror, if any
    495506                    } else {
    496507
    497508                        # Successful fetch