)]}'
{
  "commit": "208dce2707842ca3c670a08d69352a7602e4fcab",
  "tree": "c829a45982110c4f46004897c74e00f99fa769e0",
  "parents": [
    "3a9254f16eda7a4c5d2260039ff23456a0a34de4"
  ],
  "author": {
    "name": "David Benjamin",
    "email": "davidben@google.com",
    "time": "Wed May 13 16:53:35 2026 -0400"
  },
  "committer": {
    "name": "boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "email": "boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Mon Jun 01 13:59:23 2026 -0700"
  },
  "message": "Fix non-blocking connect completion check in BIO.\n\nPreviously, we polled getsockopt(SO_ERROR) to check if a non-blocking connect\nhad completed, but this isn\u0027t right. SO_ERROR is only set *after* the\nconnect succeeded or failed.\n\nUntil then, you have to wait until the socket is writable. Per\nconnect(2) on Linux:\n\n\u003e The socket is nonblocking and the connection cannot be completed\n\u003e immediately.  (UNIX domain sockets failed with EAGAIN instead.)  It\n\u003e is  possible to select(2) or poll(2) for completion by selecting the\n\u003e socket for writing.  After select(2) indicates writability, use\n\u003e getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET to\n\u003e determine whether connect()  completed  successfully  (SO_ERROR  is\n\u003e zero) or unsuccessfully (SO_ERROR is one of the usual error codes\n\u003e listed here, explaining the reason for the failure).\n\nWindows documentation says something similar:\n\n\u003e With a nonblocking socket, the connection attempt cannot be completed\n\u003e immediately. In this case, connect will return SOCKET_ERROR, and\n\u003e WSAGetLastError will return WSAEWOULDBLOCK. In this case, there are\n\u003e three possible scenarios:\n\u003e\n\u003e * Use the select function to determine the completion of the\n\u003e   connection request by checking to see if the socket is writable.\n\nhttps://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect\n\nThis means that, even though BIO is generally not responsible for\ncalling select/poll, we need to do it here. Use poll on POSIX because\nselect cannot monitor fds beyond FD_SETSIZE. (Winsock\u0027s select does not\nhave this limitation. nfds is ignored.)\n\nAs part of this, remove the weird zero return from conn_state when\nconnect fails the second time around. It would make more sense to behave\nthe same between the two, and this actually would have caused BIO_read\nto mistakenly report EOF when implicitly driving the connect state. No\none could have been relying on this because this code didn\u0027t work\nanyway. To that end, it seems unlikely anyone is using non-blocking\nconnect BIOs because they don\u0027t work at all.\n\nChange-Id: Iaf4c58920e686eadcfbb215f43cf9d90fa35f56d\nReviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/96189\nAuto-Submit: David Benjamin \u003cdavidben@google.com\u003e\nCommit-Queue: David Benjamin \u003cdavidben@google.com\u003e\nReviewed-by: Adam Langley \u003cagl@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3c01952fe7b7a7e2bbf0548282e6e5b4fdc4c636",
      "old_mode": 33188,
      "old_path": "crypto/bio/bio_test.cc",
      "new_id": "8aa41cbfc9cc7a2f8e511971ea92b38aa9d0dbd3",
      "new_mode": 33188,
      "new_path": "crypto/bio/bio_test.cc"
    },
    {
      "type": "modify",
      "old_id": "7f4a17be1daaf351b7281f498de57ca200237e5a",
      "old_mode": 33188,
      "old_path": "crypto/bio/connect.cc",
      "new_id": "328c2b1006fbae5bf88838699f1255bf750be24a",
      "new_mode": 33188,
      "new_path": "crypto/bio/connect.cc"
    },
    {
      "type": "modify",
      "old_id": "19b930c770e47e03276e3059dc16ba20f425f775",
      "old_mode": 33188,
      "old_path": "crypto/bio/internal.h",
      "new_id": "72215fcd638f6c334260392f8f63e23a7c772e6b",
      "new_mode": 33188,
      "new_path": "crypto/bio/internal.h"
    },
    {
      "type": "modify",
      "old_id": "e251b34175f393f33eb342be17ffb309a3989983",
      "old_mode": 33188,
      "old_path": "crypto/bio/socket_helper.cc",
      "new_id": "6c975b382d9d0881eac762d43b8118c2e5fa83d6",
      "new_mode": 33188,
      "new_path": "crypto/bio/socket_helper.cc"
    }
  ]
}
