| Index: net/base/nss_memio.c
 | 
| diff --git a/net/base/nss_memio.c b/net/base/nss_memio.c
 | 
| index bd0471067f4e57e31b39d09889f0caa1bdeef378..9e6e84611cfb257a9a944cd9ff2072770616896a 100644
 | 
| --- a/net/base/nss_memio.c
 | 
| +++ b/net/base/nss_memio.c
 | 
| @@ -228,8 +228,17 @@ static int PR_CALLBACK memio_Recv(PRFileDesc *fd, void *buf, PRInt32 len,
 | 
|      rv = memio_buffer_get(mb, buf, len);
 | 
|      if (rv == 0 && !secret->eof) {
 | 
|          secret->read_requested = len;
 | 
| +        /* If there is no more data in the buffer, report any pending errors
 | 
| +         * that were previously observed. Note that both the readbuf and the
 | 
| +         * writebuf are checked for errors, since the application may have
 | 
| +         * encountered a socket error while writing that would otherwise not
 | 
| +         * be reported until the application attempted to write again - which
 | 
| +         * it may never do.
 | 
| +         */
 | 
|          if (mb->last_err)
 | 
|              PR_SetError(mb->last_err, 0);
 | 
| +        else if (secret->writebuf.last_err)
 | 
| +            PR_SetError(secret->writebuf.last_err, 0);
 | 
|          else
 | 
|              PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
 | 
|          return -1;
 | 
| @@ -256,6 +265,11 @@ static int PR_CALLBACK memio_Send(PRFileDesc *fd, const void *buf, PRInt32 len,
 | 
|      mb = &secret->writebuf;
 | 
|      PR_ASSERT(mb->bufsize);
 | 
|  
 | 
| +    /* Note that the read error state is not reported, because it cannot be
 | 
| +     * reported until all buffered data has been read. If there is an error
 | 
| +     * with the next layer, attempting to call Send again will report the
 | 
| +     * error appropriately.
 | 
| +     */
 | 
|      if (mb->last_err) {
 | 
|          PR_SetError(mb->last_err, 0);
 | 
|          return -1;
 | 
| 
 |