reflected the recent standard changes in the doc

This commit is contained in:
Luxferre
2024-11-01 07:47:58 +02:00
parent 374be3b9af
commit 2f04542cf6
4 changed files with 23 additions and 15 deletions
+1
View File
@@ -1,6 +1,7 @@
useragent "tii/current" useragent "tii/current"
proxyhost "" proxyhost ""
proxyport "0" proxyport "0"
net_timeout 10000
tiix_font "Fira Code" tiix_font "Fira Code"
tiix_fontsize "12" tiix_fontsize "12"
tiix_fgcolor "#eee" tiix_fgcolor "#eee"
+10 -11
View File
@@ -61,6 +61,11 @@ Response: newline-separated message ID list
When a new message is posted to the echo, it gets appended to the end of the When a new message is posted to the echo, it gets appended to the end of the
corresponding message ID list for this echo. corresponding message ID list for this echo.
The message order in an echo does not always match the timestamp ordering;
it is fully up to the client on how to sort the messages internally. The
messages are only guaranteed to be saved by the server in the order they
arrive onto the server.
- Listing messages in any amount of echos - - Listing messages in any amount of echos -
Request: GET /u/e/echo.1.name/echo.2.name/... Request: GET /u/e/echo.1.name/echo.2.name/...
@@ -77,7 +82,10 @@ msgid2fromecho2
... ...
In case of limited request, the offset can be negative. E.g. -10:10 means In case of limited request, the offset can be negative. E.g. -10:10 means
requesting last 10 messages from the index. requesting last 10 messages from the index. If the offset:limit pair is not
valid for a particular echo, all message IDs from this echo are returned.
The same message ID ordering rule as for /e applies to /u/e as well.
- Fetching a single message by its ID - - Fetching a single message by its ID -
@@ -90,6 +98,7 @@ Request: GET /u/m/msgid1/msgid2/...
Response: newline-separated list of msgid:base64_msgtext Response: newline-separated list of msgid:base64_msgtext
Here, base64_msgtext is a Base64-encoded Node-to-Point Message (see below). Here, base64_msgtext is a Base64-encoded Node-to-Point Message (see below).
The standardized ID count limit is at most 40 messages per bundle.
- Posting a message (via POST) - - Posting a message (via POST) -
@@ -171,14 +180,4 @@ This algorithm must be implemented by every station to generate message IDs:
4. Replace all occurrences of + or - with A, and / or _ with z. 4. Replace all occurrences of + or - with A, and / or _ with z.
5. The result of these operations is your ii message ID. 5. The result of these operations is your ii message ID.
Implementation notes
--------------------
* Most HTTP servers are configured to reject long GET lines, so tii passes a
limited amount of message IDs to the /u/m endpoints. This behaviour can be
configured in the stations.txt file.
* The message order in an echo does not always match the timestamp ordering;
it is fully up to the client on how to sort the messages internally. The
messages are only guaranteed to be saved by the server in the order they
arrive onto the server.
--- Luxferre --- --- Luxferre ---
+8 -4
View File
@@ -78,8 +78,7 @@ proc url2dict {inputurl} {
} }
proc reqresp {host port reqline is_tls encoding} { proc reqresp {host port reqline is_tls encoding} {
global sock_response global sock_response net_timeout
set sock_net_timeout 5000
set sock 0 set sock 0
if {$is_tls eq 1} { if {$is_tls eq 1} {
catch {set sock [::tls::socket -autoservername true -async $host $port]} catch {set sock [::tls::socket -autoservername true -async $host $port]}
@@ -109,7 +108,7 @@ proc reqresp {host port reqline is_tls encoding} {
} }
set rcv_end_$sock 0 set rcv_end_$sock 0
} }
after $sock_net_timeout "global rcv_end_$sock; set rcv_end_$sock 1" after $net_timeout "global rcv_end_$sock; set rcv_end_$sock 1"
vwait rcv_end_$sock vwait rcv_end_$sock
catch {close $sock} catch {close $sock}
unset -nocomplain rcv_end_$sock unset -nocomplain rcv_end_$sock
@@ -118,6 +117,7 @@ proc reqresp {host port reqline is_tls encoding} {
# file download helper # file download helper
proc getfile {url} { proc getfile {url} {
global net_timeout
set url [regsub -all {([^:])//} $url {\1/}] set url [regsub -all {([^:])//} $url {\1/}]
set urlparts [url2dict $url] set urlparts [url2dict $url]
set scheme [dict get $urlparts scheme] set scheme [dict get $urlparts scheme]
@@ -156,7 +156,7 @@ proc getfile {url} {
https - http { https - http {
set hs "" set hs ""
while {$hs eq ""} { while {$hs eq ""} {
set hs [::http::geturl $url -binary 1 -keepalive 0 -timeout 10000] set hs [::http::geturl $url -binary 1 -keepalive 0 -timeout $net_timeout]
} }
if {[::http::ncode $hs] eq "200"} { if {[::http::ncode $hs] eq "200"} {
return [::http::data $hs] return [::http::data $hs]
@@ -369,6 +369,7 @@ set localdb [file join $appdir "tii.db"]
# populate general HTTP configuration # populate general HTTP configuration
set cfgfile [file join $appdir "config.txt"] set cfgfile [file join $appdir "config.txt"]
set net_timeout 5000
if {[file exists $cfgfile]} { if {[file exists $cfgfile]} {
set cfg [readfile $cfgfile] set cfg [readfile $cfgfile]
if {[dict exists $cfg useragent]} { if {[dict exists $cfg useragent]} {
@@ -380,6 +381,9 @@ if {[file exists $cfgfile]} {
if {[dict exists $cfg proxyport]} { if {[dict exists $cfg proxyport]} {
::http::config -proxyport [dict get $cfg proxyport] ::http::config -proxyport [dict get $cfg proxyport]
} }
if {[dict exists $cfg net_timeout]} {
set net_timeout [dict get $cfg net_timeout]
}
} }
if {$argc > 0} { if {$argc > 0} {
+4
View File
@@ -29,6 +29,7 @@ set tiix_linkcolor blue
set useragent "" set useragent ""
set proxyhost "" set proxyhost ""
set proxyport 0 set proxyport 0
set net_timeout 5000
set cfgfile [file join $appdir "config.txt"] set cfgfile [file join $appdir "config.txt"]
if {[file exists $cfgfile]} { if {[file exists $cfgfile]} {
set cfg [readfile $cfgfile] set cfg [readfile $cfgfile]
@@ -44,6 +45,9 @@ if {[file exists $cfgfile]} {
set proxyport [dict get $cfg proxyport] set proxyport [dict get $cfg proxyport]
::http::config -proxyport $proxyport ::http::config -proxyport $proxyport
} }
if {[dict exists $cfg net_timeout]} {
set net_timeout [dict get $cfg net_timeout]
}
if {[dict exists $cfg tiix_font]} { if {[dict exists $cfg tiix_font]} {
set tiix_font [dict get $cfg tiix_font] set tiix_font [dict get $cfg tiix_font]
} }