apr_socket_opt_get(socket, APR_SO_SNDBUF, &opt) and apr_socket_opt_get(socket, APR_SO_RCVBUF, &opt) always set opt to 0. It would be useful if these calls instead returned the send buffer and receive buffer sizes respectively.
Created attachment 20671 [details] Implement APR_SO_SNDBUF and APR_SO_RCVBUF in apr_socket_opt_get
Why using setsockopt in the SO_RCVBUF case?
Comment on attachment 20671 [details] Implement APR_SO_SNDBUF and APR_SO_RCVBUF in apr_socket_opt_get Patch mistakenly used setsockopt instead of getsockopt for SO_RCVBUF
Created attachment 20676 [details] Fix getsockopt/setsockopt typo in previous patch
Please keep in mind the following comment from the Linux man page for SO_RCVBUF, SO_RCVBUF: Sets or gets the maximum socket receive buffer in bytes. The kernel doubles this value (to allow space for bookkeeping over- head) when it is set using setsockopt(), and this doubled value is returned by getsockopt(). There is no such hint on the man page of e.g. Solaris. In the case that other OS (e.g. Solaris) do not modify the buffer size given with setsockopt, your patch is not portable. Especially if someone wants to use the result of apr_socket_opt_get for a apr_socket_opt_set in a platform independent way.
I don't think this patch introduces any new portability issues. The semantics of the current apr_socket_opt_set(..., APR_SO_SNDBUF, ...) aren't portable, but this patch shouldn't change that.