Posted to tcl by evilotto at Thu Apr 21 21:13:40 GMT 2011view raw

  1. Index: src/branch.c
  2. ===================================================================
  3. --- src/branch.c
  4. +++ src/branch.c
  5. @@ -52,10 +52,11 @@
  6. if( g.argc<5 ){
  7. usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
  8. }
  9. db_find_and_open_repository(0, 0);
  10. noSign = db_get_int("omitsign", 0)|noSign;
  11. + if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
  12.  
  13. /* fossil branch new name */
  14. zBranch = g.argv[3];
  15. if( zBranch==0 || zBranch[0]==0 ){
  16. fossil_panic("branch name cannot be empty");
  17.  
  18. Index: src/http_ssl.c
  19. ===================================================================
  20. --- src/http_ssl.c
  21. +++ src/http_ssl.c
  22. @@ -130,10 +130,11 @@
  23. */
  24. int ssl_open(void){
  25. X509 *cert;
  26. int hasSavedCertificate = 0;
  27. char *connStr ;
  28. + BIO *sBio; /* socket BIO */
  29. ssl_global_init();
  30.  
  31. /* Get certificate for current server from global config and
  32. * (if we have it in config) add it to certificate store.
  33. */
  34. @@ -142,28 +143,48 @@
  35. X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert);
  36. X509_free(cert);
  37. hasSavedCertificate = 1;
  38. }
  39.  
  40. - iBio = BIO_new_ssl_connect(sslCtx);
  41. - BIO_get_ssl(iBio, &ssl);
  42. - SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
  43. - if( iBio==NULL ) {
  44. - ssl_set_errmsg("SSL: cannot open SSL (%s)",
  45. - ERR_reason_error_string(ERR_get_error()));
  46. - return 1;
  47. - }
  48. -
  49. connStr = mprintf("%s:%d", g.urlName, g.urlPort);
  50. - BIO_set_conn_hostname(iBio, connStr);
  51. + sBio=BIO_new_connect(connStr);
  52. free(connStr);
  53. -
  54. - if( BIO_do_connect(iBio)<=0 ){
  55. +
  56. + if( BIO_do_connect(sBio)<=0 ){
  57. ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)",
  58. g.urlName, g.urlPort, ERR_reason_error_string(ERR_get_error()));
  59. ssl_close();
  60. return 1;
  61. + }
  62. +
  63. + if (g.useProxy){
  64. + char ibuf[1024];
  65. + char c;
  66. + int s=0;
  67. + connStr = mprintf("CONNECT %s:443 HTTP/1.0\r\n\r\n", g.urlHostname);
  68. + BIO_write(sBio,connStr,strlen(connStr));
  69. + free( connStr);
  70. + while (s < 4) {
  71. + BIO_read(sBio,&c,1);
  72. + fprintf(stderr,"%c",c);
  73. + switch (s) {
  74. + case 0: case 2: if (c == '\r') s++; else s=0; break;
  75. + case 1: case 3: if (c == '\n') s++; else s=0; break;
  76. + }
  77. + }
  78. + g.urlPath=g.proxyUrlPath;
  79. + }
  80. +
  81. + iBio=BIO_new_ssl(sslCtx,1);
  82. + BIO_set_conn_hostname(iBio,g.urlHostname);
  83. + BIO_get_ssl(iBio,&ssl);
  84. + SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
  85. + BIO_push(iBio,sBio);
  86. + if( iBio==NULL ) {
  87. + ssl_set_errmsg("SSL: cannot open SSL (%s)",
  88. + ERR_reason_error_string(ERR_get_error()));
  89. + return 1;
  90. }
  91.  
  92. if( BIO_do_handshake(iBio)<=0 ) {
  93. ssl_set_errmsg("Error establishing SSL connection %s:%d (%s)",
  94. g.urlName, g.urlPort, ERR_reason_error_string(ERR_get_error()));
  95.  
  96. Index: src/main.c
  97. ===================================================================
  98. --- src/main.c
  99. +++ src/main.c
  100. @@ -102,10 +102,12 @@
  101. char *urlPasswd; /* Password for http: */
  102. char *urlCanonical; /* Canonical representation of the URL */
  103. char *urlProxyAuth; /* Proxy-Authorizer: string */
  104. char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */
  105. int dontKeepUrl; /* Do not persist the URL */
  106. + int useProxy;
  107. + char *proxyUrlPath;
  108.  
  109. const char *zLogin; /* Login name. "" if not logged in. */
  110. int useLocalauth; /* No login required if from 127.0.0.1 */
  111. int noPswd; /* Logged in without password (on 127.0.0.1) */
  112. int userUid; /* Integer user id */
  113.  
  114. Index: src/url.c
  115. ===================================================================
  116. --- src/url.c
  117. +++ src/url.c
  118. @@ -65,10 +65,11 @@
  119. int iStart;
  120. char *zLogin;
  121. char *zExe;
  122.  
  123. g.urlIsFile = 0;
  124. + g.useProxy=0;
  125. if( zUrl[4]=='s' ){
  126. g.urlIsHttps = 1;
  127. g.urlProtocol = "https";
  128. g.urlDfltPort = 443;
  129. iStart = 8;
  130. @@ -273,10 +274,12 @@
  131. if( zProxy && zProxy[0] && !is_false(zProxy) ){
  132. char *zOriginalUrl = g.urlCanonical;
  133. char *zOriginalHost = g.urlHostname;
  134. char *zOriginalUser = g.urlUser;
  135. char *zOriginalPasswd = g.urlPasswd;
  136. + char *zOriginalPath = g.urlPath;
  137. + int zOriginalUrlIsHttps = g.urlIsHttps;
  138. g.urlUser = 0;
  139. g.urlPasswd = "";
  140. url_parse(zProxy);
  141. if( zMsg ) printf("%s%s\n", zMsg, g.urlCanonical);
  142. g.urlPath = zOriginalUrl;
  143. @@ -287,10 +290,13 @@
  144. g.urlProxyAuth = mprintf("Basic %z", zCredentials2);
  145. free(zCredentials1);
  146. }
  147. g.urlUser = zOriginalUser;
  148. g.urlPasswd = zOriginalPasswd;
  149. + g.urlIsHttps = zOriginalUrlIsHttps;
  150. + g.useProxy = 1;
  151. + g.proxyUrlPath=zOriginalPath;
  152. }
  153. }
  154.  
  155. #if INTERFACE
  156. /*
  157.  
  158.