URL hangs on windows after multiple requests

I’m trying to get to the bottom of this one, but URL seems to stop working after a while. I’m working with a 16 second timeout, sending multiple requests in series on a background thread, creating a new URL object each time, and after half a dozen or so requests it just times out.

Specifically HttpSendRequestEx returns 12002.

I’m still looking into it, but has anyone seen this before?

Let me narrow this down, after receiving a 40x response it seems to lock up…

Ok, turns out that it’s a bug at my end, of course.


  1. Use smart pointers even for the most stupidly simple functions that couldn’t go wrong.
  2. Windows only allows 2 HTTP/1.1 sessions at once from an application, and just returns a timeout if that limit is exceeded and doesn’t resolve itself.