{"action":"opened","issue":{"url":"https://api.github.com/repos/VBA-tools/VBA-Web/issues/337","repository_url":"https://api.github.com/repos/VBA-tools/VBA-Web","labels_url":"https://api.github.com/repos/VBA-tools/VBA-Web/issues/337/labels{/name}","comments_url":"https://api.github.com/repos/VBA-tools/VBA-Web/issues/337/comments","events_url":"https://api.github.com/repos/VBA-tools/VBA-Web/issues/337/events","html_url":"https://github.com/VBA-tools/VBA-Web/issues/337","id":319720687,"number":337,"title":"VBA-Web and HTTP timeouts","user":{"login":"RichardWein","id":6687630,"avatar_url":"https://avatars2.githubusercontent.com/u/6687630?v=4","gravatar_id":"","url":"https://api.github.com/users/RichardWein","html_url":"https://github.com/RichardWein","followers_url":"https://api.github.com/users/RichardWein/followers","following_url":"https://api.github.com/users/RichardWein/following{/other_user}","gists_url":"https://api.github.com/users/RichardWein/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardWein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardWein/subscriptions","organizations_url":"https://api.github.com/users/RichardWein/orgs","repos_url":"https://api.github.com/users/RichardWein/repos","events_url":"https://api.github.com/users/RichardWein/events{/privacy}","received_events_url":"https://api.github.com/users/RichardWein/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-02T21:35:39Z","updated_at":"2018-05-02T21:35:39Z","closed_at":null,"author_association":"NONE","body":"Hi. I'm unclear about how VBA-Web handles timeouts.\r\n\r\nI see that VBA-Web uses WinHttp's SetTimeouts to set timeouts. I've tried leaving the default setting (which seems to be 5000 ms), and I've also tried setting my own timeout with WebClient.TimeoutMs.\r\n\r\nIf I set a timeout of 1 ms, I seem to get timeouts about 1 time in 10 requests (with one particular API). This shows that the timeout setting is having some effect, but I would have expected it to timeout every time, though I don't really know whether responses in under 1 ms are possible. In this case, however, the responses are in the region of 30,000 characters, and 30,000 characters in 1 ms implies a rate of at least 30 MB/s. My internet connection is not that fast!\r\n\r\nI note that Web-VBA uses WinHttp asynchronously, checking progress with a loop:\r\n\r\n```\r\n    web_Http.Send request.Body\r\n    web_Http.WaitForResponse\r\n    Do While Not web_Http.WaitForResponse(0.025)\r\n        VBA.DoEvents\r\n    Loop\r\n```\r\n\t\r\nI don't fully understand this. Does WaitForResponse respect the timeout set by SetTimeouts as well as its own timeout (0.025)?\r\n\r\nI'll mention one other bit of information, although it turned out to be a red herring. When I make a request while disconnected from the internet, VBA-Web reports this as an HTTP 408 timeout error. I found this confusing, because the error occurs immediately, not after a timeout period. But it turned out that this result has nothing to do with a timeout. From stepping through the code, I can see that the error occurs on the first WaitForResponse call, and WinHttp returns an error 12007, \"The server name cannot be resolved\". It's just VBA-Web that decides to report this as an HTTP 408 error.\r\n\r\nAny thoughts?"}}
{"actor":{"display_login":"RichardWein"}}