[Ttssh2-commit] [4085] TTProxy でプロキシサーバに IPv6 アドレスを指定できない問題を修正した

svnno****@sourc***** svnno****@sourc*****
2010年 9月 6日 (月) 00:05:41 JST


Revision: 4085
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4085
Author:   maya
Date:     2010-09-06 00:05:41 +0900 (Mon, 06 Sep 2010)

Log Message:
-----------
TTProxy でプロキシサーバに IPv6 アドレスを指定できない問題を修正した
  Setup ダイアログでは [] で囲む必要はない
  コマンドラインでは [] で囲む必要がある

Modified Paths:
--------------
    trunk/TTProxy/ProxyWSockHook.h
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html


-------------- next part --------------
Modified: trunk/TTProxy/ProxyWSockHook.h
===================================================================
--- trunk/TTProxy/ProxyWSockHook.h	2010-09-02 12:45:49 UTC (rev 4084)
+++ trunk/TTProxy/ProxyWSockHook.h	2010-09-05 15:05:41 UTC (rev 4085)
@@ -208,6 +208,7 @@
             return digit;
         }
 
+#if 0
         static String parse(const char* url, ProxyInfo& proxy) {
             char* p = strstr((char*) url, "://");
             if (p == NULL) {
@@ -264,6 +265,78 @@
             }
             return url;
         }
+#else
+        static String parse(const char* url, ProxyInfo& proxy) {
+            char* p = strstr((char*) url, "://");
+            if (p == NULL) {
+                proxy.type = TYPE_NONE;
+                return NULL;
+            }
+            proxy.type = parseType(url, p);
+            if (proxy.type == TYPE_NONE)
+                return NULL;
+            p += 3;
+            const char* start = p;
+
+            // user:pass ‚ª‚ ‚ê‚Ίi”[‚·‚é
+            String tmp = String(start);
+            int index = tmp.indexOf('@');
+            if (index > -1) {
+                tmp = String(p, index);
+                index = tmp.indexOf(':');
+                if (index == -1) {
+                    proxy.user = urldecode(p, p + tmp.length());
+                }
+                else {
+                    proxy.user = urldecode(p, p + index);
+                    proxy.pass = urldecode(p + index + 1, p + tmp.length());
+                }
+                p += tmp.length() + 1;
+            }
+
+            // ƒzƒXƒg–¼‚ðŠi”[‚·‚é
+            start = p;
+            int in_blacket = false;
+            while (*p != '\0' && *p != '/') {
+                if (*p == '[') {
+                    in_blacket = true;
+                }else if (in_blacket && *p == ']') {
+                    in_blacket = false;
+                }else if (!in_blacket && *p == ':') {
+                    if (*start == '[') {
+                        proxy.host = String(start + 1, p - start - 2);
+                    }
+                    else {
+                        proxy.host = String(start, p - start);
+                    }
+                    start = p + 1;
+                }
+                p++;
+            }
+
+            if (proxy.type != TYPE_NONE_FORCE && proxy.type != TYPE_SSL) {
+                if (proxy.host == NULL) {
+                    if (start >= p) {
+                        proxy.type = TYPE_NONE;
+                        return NULL;
+                    }
+                    proxy.host = String(start, p - start);
+                }else{
+                    // ƒ|[ƒg”ԍ†‚ðŠi”[‚·‚é
+                    proxy.port = parsePort(start, p);
+                    if (proxy.port < 0) {
+                        proxy.type = TYPE_NONE;
+                        return NULL;
+                    }
+                }
+            }
+            if (*p == '/') {
+                p++;
+                return p;
+            }
+            return url;
+        }
+#endif
         String generateURL()const {
             if (type == TYPE_NONE || host == NULL)
                 return NULL;
@@ -279,7 +352,14 @@
                     }
                     buffer.append('@');
                 }
-                urlencode(host, buffer);
+                if (host.indexOf(':') == -1) {
+                    buffer.append(host);
+                }
+                else {
+                    buffer.append("[");
+                    buffer.append(host);
+                    buffer.append("]");
+                }
                 if (port != 0) {
                     buffer.append(':');
                     int digit = 10000;

Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2010-09-02 12:45:49 UTC (rev 4084)
+++ trunk/doc/en/html/about/history.html	2010-09-05 15:05:41 UTC (rev 4085)
@@ -49,6 +49,7 @@
   <li>Misc
     <ul>
       <li>upgraded TTSSH version supporting SSH2 to <a href="#ttssh_2.55">2.55</a></li>
+      <li>upgraded TTProxy to <a href="#ttproxy_1.0.0.17">1.0.0.17</a></li>
     </ul>
   </li>
 
@@ -2316,6 +2317,11 @@
 
 <h2><a name="ttproxy">TTProxy</a></h2>
 
+<h3><a name="ttproxy_1.0.0.17">2010.xx.xx (Ver 1.0.0.17)</a></h3>
+<ul class="history">
+      <!--li>Bug fix: ƒvƒƒLƒVƒT[ƒo‚É IPv6 ƒAƒhƒŒƒX‚ðŽw’è‚Å‚«‚È‚¢–â‘è‚ðC³‚µ‚½B</li-->
+</ul>
+
 <h3><a name="ttproxy_1.0.0.16">2009.11.10 (Ver 1.0.0.16)</a></h3>
 <ul class="history">
       <li>Bug fix: teraterm didn't connect to server in some cases because of failed to parse a commandline parameters.<br>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2010-09-02 12:45:49 UTC (rev 4084)
+++ trunk/doc/ja/html/about/history.html	2010-09-05 15:05:41 UTC (rev 4085)
@@ -48,6 +48,7 @@
   <li>‚»‚Ì‘¼
     <ul>
       <li><a href="#ttssh_2.55">SSH2‘ΉžTTSSH(2.55)</a>‚֍·‚µ‘Ö‚¦‚½B</li>
+      <li><a href="#ttproxy_1.0.0.17">TTProxy(1.0.0.17)</a>‚֍·‚µ‘Ö‚¦‚½B</li>
     </ul>
   </li>
 
@@ -2318,6 +2319,11 @@
 
 <h2><a name="ttproxy">TTProxy</a></h2>
 
+<h3><a name="ttproxy_1.0.0.17">2010.xx.xx (Ver 1.0.0.17)</a></h3>
+<ul class="history">
+      <li>ƒvƒƒLƒVƒT[ƒo‚É IPv6 ƒAƒhƒŒƒX‚ðŽw’è‚Å‚«‚È‚¢–â‘è‚ðC³‚µ‚½B</li>
+</ul>
+
 <h3><a name="ttproxy_1.0.0.16">2009.11.10 (Ver 1.0.0.16)</a></h3>
 <ul class="history">
       <li>ƒRƒ}ƒ“ƒhƒ‰ƒCƒ“ƒpƒ‰ƒ[ƒ^‚̉ðÍ‚ÉŽ¸”s‚µ‚Đڑ±‚ÉŽ¸”s‚·‚邱‚Æ‚ª‚ ‚é–â‘è‚ðC³‚µ‚½B<br>



Ttssh2-commit メーリングリストの案内