Created
January 24, 2013 18:48
-
-
Save Meyermagic/4626358 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) | |
var url string = "http://repo.bukkit.org/index.html" | |
func main() { | |
flag.StringVar(&url, "url", url, "URL to test against") | |
flag.Parse() | |
resp, err := http.Get(url) | |
//defer resp.Body.Close() | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Printf("%#v\n", resp) | |
if resp.Request != nil { | |
fmt.Printf("%#v\n", resp.Request) | |
} | |
_, err = ioutil.ReadAll(resp.Body) | |
if err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fails with "use of closed network connection" on:
http://217.19.223.2:20001
http://localhost:8080/_ah/admin/datastore
(my local appengine development server)http://repo.bukkit.org/index.html
and succeeds without error on all other domains I've tested, notably:
http://www.example.com
http://a.tiles.mapbox.com/v3/marker/pin-l-bicycle+94eeff.png
In all the "fail" URLs above, curl -v will report
In the two notable "succeed" URLs above, curl -v will, in addition to the previous message, report
The failure case, then, seems to be HTTP 1.0 servers that do not report
Connection: Keep-Alive
.