| | @@ -183,10 +183,11 @@ |
| 183 | 183 | ** and run an SSH command to talk to the remote machine. |
| 184 | 184 | */ |
| 185 | 185 | const char *zSsh; /* The base SSH command */ |
| 186 | 186 | Blob zCmd; /* The SSH command */ |
| 187 | 187 | char *zHost; /* The host name to contact */ |
| 188 | + int n; /* Size of prefix string */ |
| 188 | 189 | |
| 189 | 190 | zSsh = db_get("ssh-command", zDefaultSshCmd); |
| 190 | 191 | blob_init(&zCmd, zSsh, -1); |
| 191 | 192 | if( g.urlPort!=g.urlDfltPort ){ |
| 192 | 193 | #ifdef __MINGW32__ |
| | @@ -219,13 +220,15 @@ |
| 219 | 220 | } |
| 220 | 221 | #endif |
| 221 | 222 | }else{ |
| 222 | 223 | zHost = mprintf("%s", g.urlName); |
| 223 | 224 | } |
| 225 | + n = blob_size(&zCmd); |
| 224 | 226 | blob_append(&zCmd, " ", 1); |
| 225 | 227 | shell_escape(&zCmd, zHost); |
| 226 | | - fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ |
| 228 | + if( g.urlShell ) blob_appendf(&zCmd, " %s", g.urlShell); |
| 229 | + fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ |
| 227 | 230 | free(zHost); |
| 228 | 231 | popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); |
| 229 | 232 | if( sshPid==0 ){ |
| 230 | 233 | fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); |
| 231 | 234 | } |
| | @@ -251,13 +254,13 @@ |
| 251 | 254 | Blob cmd; |
| 252 | 255 | blob_zero(&cmd); |
| 253 | 256 | shell_escape(&cmd, g.urlFossil); |
| 254 | 257 | blob_append(&cmd, " test-http ", -1); |
| 255 | 258 | shell_escape(&cmd, g.urlPath); |
| 256 | | - /* printf("%s\n", blob_str(&cmd)); fflush(stdout); */ |
| 257 | | - fprintf(sshOut, "%s\n", blob_str(&cmd)); |
| 259 | + fprintf(sshOut, "%s || true\n", blob_str(&cmd)); |
| 258 | 260 | fflush(sshOut); |
| 261 | + if( g.fSshTrace ) printf("Sent: [%s]\n", blob_str(&cmd)); |
| 259 | 262 | blob_reset(&cmd); |
| 260 | 263 | }else if( g.urlIsHttps ){ |
| 261 | 264 | #ifdef FOSSIL_ENABLE_SSL |
| 262 | 265 | rc = ssl_open(); |
| 263 | 266 | if( rc==0 ) transport.isOpen = 1; |
| | @@ -403,11 +406,10 @@ |
| 403 | 406 | int got; |
| 404 | 407 | if( sshIn ){ |
| 405 | 408 | int x; |
| 406 | 409 | int wanted = N; |
| 407 | 410 | got = 0; |
| 408 | | - /* printf("want %d bytes...\n", wanted); fflush(stdout); */ |
| 409 | 411 | while( wanted>0 ){ |
| 410 | 412 | x = read(sshIn, &zBuf[got], wanted); |
| 411 | 413 | if( x<=0 ) break; |
| 412 | 414 | got += x; |
| 413 | 415 | wanted -= x; |
| | @@ -438,11 +440,14 @@ |
| 438 | 440 | int transport_receive(char *zBuf, int N){ |
| 439 | 441 | int onHand; /* Bytes current held in the transport buffer */ |
| 440 | 442 | int nByte = 0; /* Bytes of content received */ |
| 441 | 443 | |
| 442 | 444 | onHand = transport.nUsed - transport.iCursor; |
| 443 | | - /* printf("request %d with %d on hand\n", N, onHand); fflush(stdout); */ |
| 445 | + if( g.fSshTrace){ |
| 446 | + printf("Reading %d bytes with %d on hand... ", N, onHand); |
| 447 | + fflush(stdout); |
| 448 | + } |
| 444 | 449 | if( onHand>0 ){ |
| 445 | 450 | int toMove = onHand; |
| 446 | 451 | if( toMove>N ) toMove = N; |
| 447 | 452 | /* printf("bytes on hand: %d of %d\n", toMove, N); fflush(stdout); */ |
| 448 | 453 | memcpy(zBuf, &transport.pBuf[transport.iCursor], toMove); |
| | @@ -460,10 +465,11 @@ |
| 460 | 465 | if( got>0 ){ |
| 461 | 466 | nByte += got; |
| 462 | 467 | transport.nRcvd += got; |
| 463 | 468 | } |
| 464 | 469 | } |
| 470 | + if( g.fSshTrace ) printf("Got %d bytes\n", nByte); |
| 465 | 471 | return nByte; |
| 466 | 472 | } |
| 467 | 473 | |
| 468 | 474 | /* |
| 469 | 475 | ** Load up to N new bytes of content into the transport.pBuf buffer. |
| | @@ -532,11 +538,11 @@ |
| 532 | 538 | } |
| 533 | 539 | break; |
| 534 | 540 | } |
| 535 | 541 | i++; |
| 536 | 542 | } |
| 537 | | - /* printf("Got line: [%s]\n", &transport.pBuf[iStart]); */ |
| 543 | + if( g.fSshTrace ) printf("Got line: [%s]\n", &transport.pBuf[iStart]); |
| 538 | 544 | return &transport.pBuf[iStart]; |
| 539 | 545 | } |
| 540 | 546 | |
| 541 | 547 | void transport_global_shutdown(void){ |
| 542 | 548 | if( g.urlIsSsh && sshPid ){ |
| 543 | 549 | |