2015-02-28

TLS v1.6.4 is out

TLS and Openssl - Static libraries (w32, mingw/msys)


下載 TLS v1.6.4 以後使用之前 MinGW/MSYS 的方式編譯,確定可以編譯。


測試的 script 從 Tcler's Wiki 來的:
package require tls
variable quit 0

proc Read {chan} {
    if {[eof $chan]} { fileevent $chan readable {}; puts "Closed"; set ::forever 1; return }
    puts [read $chan]
    variable quit ; if {!$quit} { puts $chan QUIT; set quit 0 }
}

proc Write {chan} {
    fileevent $chan writable {}
    tls::handshake $chan
    fconfigure $chan -buffering line -blocking 0 -translation crlf
}

set sock [tls::socket -async pop.gmail.com 995]
fconfigure $sock -encoding binary -buffering none -blocking 1
fileevent $sock writable [list Write $sock]
fileevent $sock readable [list Read $sock]

vwait ::forever

2015-02-26

Wub Direct example

Tcler's Wiki: Wub Direct


稍微嘗試了一下 Tcler's Wiki 提供的範例,發現 local.tcl 如果是使用 svn checkout 目前的 code,要放在跟 site.config 與 Wub.tcl 同一個目錄中。


我發現在 examples 有放一個 hello-direct.tcl,想要測試這個檔案,所以在 local.tcl 使用:
source examples/hello-direct.tcl

然後加入下列的設定到 site.config -
hello {
       domain Direct
       url /hello
       namespace ::Hello
}

再打 http://localhost:8080/hello/ 測試,是有網頁內容顯示的(而不是丟出錯誤訊息),看起來有成功。


但是在 local.tcl 直接使用 source 的方式感覺還是有點怪怪的,不知是否有更好的方式。


更新:
在設定  hello-direct.tcl 以後,又用 hello 來測試 Wub 的 rewrite 功能,site.config 設定如下:
testrewrite {
    url /testrewrite
    rewrite /hello
}

如果使用 http://localhost:8080/testrewrite/ 測試,確實會被轉到 http://localhost:8080/hello/。

2015-02-12

REST library at Tcllib

a rest framework
rest - A framework for RESTful web services


寫了一個 FACEBOOK REST API 的小程式來測試:
package require rest

set urls "http://tcl-eval.blogspot.tw/"
set res [rest::get http://api.facebook.com/restserver.php [list method links.getStats urls $urls]]
puts $res

Facebook 回傳回來的是 XML 形式的資料,我只有印出來確定沒問題,但是看樣子是可以使用的。

下面就是結果:
<?xml version="1.0" encoding="UTF-8"?>
<links_getStats_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/
1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true">
  <link_stat>
    <url>http://tcl-eval.blogspot.tw/</url>
    <normalized_url>http://tcl-eval.blogspot.tw/</normalized_url>
    <share_count>0</share_count>
    <like_count>0</like_count>
    <comment_count>0</comment_count>
    <total_count>0</total_count>
    <click_count>0</click_count>
    <comments_fbid xsi:nil="true"/>
    <commentsbox_count>0</commentsbox_count>
  </link_stat>
</links_getStats_response>

2015-02-01

Tclqrencode v0.2, update libpng dll and header files

版本一樣維持在 v0.2,因為主要的 code base 沒有變動。主要的改變是更新 win 目錄下的 libpng,使用 libpng v1.6. 16 的 source code 編譯出一個新的,並且也更新了 header files。

希望我全部的事情都有做對。


連結網址:
Tclqrencode


我只有使用 Tclqrencode v0.1 這篇文章的範例進行測試,希望不會有什麼問題。