Backport fixes for bug 332348 from trunk to NSS_3_11_BRANCH.

Patch by nelson, r=julien.  Patch by Julien, r=wtchang


git-svn-id: svn://10.0.0.236/branches/NSS_3_11_BRANCH@195229 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nelson%bolyard.com
2006-04-24 04:58:06 +00:00
parent 93cead24a1
commit 1b9d59f1e0

View File

@@ -77,6 +77,8 @@
#define MAX_WAIT_FOR_SERVER 600
#define WAIT_INTERVAL 100
PRIntervalTime maxInterval = PR_INTERVAL_NO_TIMEOUT;
int ssl2CipherSuites[] = {
SSL_EN_RC4_128_WITH_MD5, /* A */
SSL_EN_RC4_128_EXPORT40_WITH_MD5, /* B */
@@ -374,7 +376,7 @@ thread_main(void * arg)
rc = PR_Read(std_in, buf, sizeof buf);
if (rc <= 0)
break;
wc = PR_Write(ps, buf, rc);
wc = PR_Send(ps, buf, rc, 0, maxInterval);
} while (wc == rc);
PR_Close(ps);
}
@@ -419,6 +421,7 @@ int main(int argc, char **argv)
char * certDir = NULL;
char * nickname = NULL;
char * cipherString = NULL;
char * tmp;
int multiplier = 0;
SECStatus rv;
PRStatus status;
@@ -448,6 +451,14 @@ int main(int argc, char **argv)
progName = strrchr(argv[0], '\\');
progName = progName ? progName+1 : argv[0];
tmp = PR_GetEnv("NSS_DEBUG_TIMEOUT");
if (tmp && tmp[0]) {
int sec = PORT_Atoi(tmp);
if (sec > 0) {
maxInterval = PR_SecondsToInterval(sec);
}
}
optstate = PL_CreateOptState(argc, argv, "23BTfc:h:p:d:m:n:oqsvw:x");
while ((optstatus = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
switch (optstate->option) {
@@ -786,7 +797,8 @@ int main(int argc, char **argv)
}
pollset[SSOCK_FD].fd = s;
pollset[SSOCK_FD].in_flags = clientSpeaksFirst ? 0 : PR_POLL_READ;
pollset[SSOCK_FD].in_flags = PR_POLL_EXCEPT |
(clientSpeaksFirst ? 0 : PR_POLL_READ);
pollset[STDIN_FD].fd = PR_GetSpecialFD(PR_StandardInput);
pollset[STDIN_FD].in_flags = PR_POLL_READ;
npds = 2;
@@ -875,7 +887,7 @@ int main(int argc, char **argv)
FPRINTF(stderr, "%s: Writing %d bytes to server\n",
progName, nb);
do {
PRInt32 cc = PR_Write(s, bufp, nb);
PRInt32 cc = PR_Send(s, bufp, nb, 0, maxInterval);
if (cc < 0) {
PRErrorCode err = PR_GetError();
if (err != PR_WOULD_BLOCK_ERROR) {
@@ -916,7 +928,7 @@ int main(int argc, char **argv)
#endif
) {
/* Read from socket and write to stdout */
nb = PR_Read(pollset[SSOCK_FD].fd, buf, sizeof(buf));
nb = PR_Recv(pollset[SSOCK_FD].fd, buf, sizeof buf, 0, maxInterval);
FPRINTF(stderr, "%s: Read from server %d bytes\n", progName, nb);
if (nb < 0) {
if (PR_GetError() != PR_WOULD_BLOCK_ERROR) {