{"action":"opened","issue":{"url":"https://api.github.com/repos/SlyMarbo/spdy/issues/82","labels_url":"https://api.github.com/repos/SlyMarbo/spdy/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/SlyMarbo/spdy/issues/82/comments","events_url":"https://api.github.com/repos/SlyMarbo/spdy/issues/82/events","html_url":"https://github.com/SlyMarbo/spdy/issues/82","id":69706524,"number":82,"title":"Data is not sent if message is near to or larger than window","user":{"login":"rnapier","id":429858,"avatar_url":"https://avatars.githubusercontent.com/u/429858?v=3","gravatar_id":"","url":"https://api.github.com/users/rnapier","html_url":"https://github.com/rnapier","followers_url":"https://api.github.com/users/rnapier/followers","following_url":"https://api.github.com/users/rnapier/following{/other_user}","gists_url":"https://api.github.com/users/rnapier/gists{/gist_id}","starred_url":"https://api.github.com/users/rnapier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnapier/subscriptions","organizations_url":"https://api.github.com/users/rnapier/orgs","repos_url":"https://api.github.com/users/rnapier/repos","events_url":"https://api.github.com/users/rnapier/events{/privacy}","received_events_url":"https://api.github.com/users/rnapier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-20T23:51:22Z","updated_at":"2015-04-20T23:51:22Z","closed_at":null,"body":"If the size of the data sent by an HTTP Handler is within 15 bytes of the window size, then the data will be sent, but no FIN, which will cause the client to hang.\r\n\r\nIf the size of the data sent by an HTTP Handler is greater than the window size, then no data will be sent.\r\n\r\nclient.go\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"io/ioutil\"\r\n\r\n\t\"github.com/SlyMarbo/spdy\" // This adds SPDY support to net/http\r\n)\r\n\r\nfunc main() {\r\n\tspdy.EnableDebugOutput()\r\n\tclient := spdy.NewClient(true)\r\n\tres, err := client.Get(\"https://localhost:10443/\")\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\tdefer res.Body.Close()\r\n\r\n\tbytes, err := ioutil.ReadAll(res.Body)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tfmt.Printf(\"Received: %s\\n\", bytes)\r\n}\r\n```\r\n\r\nserver.go\r\n\r\n```\r\n// openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes -batch\r\n\r\npackage main\r\n\r\nimport (\r\n\t\"bytes\"\r\n\t\"log\"\r\n\t\"net/http\"\r\n\r\n\t\"github.com/SlyMarbo/spdy\"\r\n\t\"github.com/SlyMarbo/spdy/common\"\r\n)\r\n\r\nfunc httpHandler(w http.ResponseWriter, req *http.Request) {\r\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\r\n\t// w.Write(bytes.Repeat([]byte(\"X\"), common.DEFAULT_INITIAL_CLIENT_WINDOW_SIZE-16)) // Works\r\n\tw.Write(bytes.Repeat([]byte(\"X\"), common.DEFAULT_INITIAL_CLIENT_WINDOW_SIZE-15)) // Hangs (no FIN is sent)\r\n\t// w.Write(bytes.Repeat([]byte(\"X\"), common.DEFAULT_INITIAL_CLIENT_WINDOW_SIZE)) // Sends FIN, but no data\r\n}\r\n\r\nfunc main() {\r\n\tspdy.EnableDebugOutput()\r\n\thttp.HandleFunc(\"/\", httpHandler)\r\n\tlog.Printf(\"About to listen on 10443. Go to https://127.0.0.1:10443/\")\r\n\terr := spdy.ListenAndServeTLS(\":10443\", \"cert.pem\", \"key.pem\", nil)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}\r\n```\r\n"}}