tcl-hacks

Check-in [6ead9e4e36]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:provide close, reject unused args from serve
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tclish-args
Files: files | file ages | folders
SHA1:6ead9e4e3612bec76e288a630e6baa88f46ae826
User & Date: aspect 2018-07-29 15:55:39
Context
2018-12-11
07:06
boot.tcl can now pass args to a script correctly, tclish likes this Leaf check-in: d6f9265bbe user: aspect tags: tclish-args
2018-07-29
15:55
provide close, reject unused args from serve check-in: 6ead9e4e36 user: aspect tags: tclish-args
15:39
prove binary and utf-8 coding check-in: b1ecf5f008 user: aspect tags: tclish-args
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/minhttpd-0.tm.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39





40
41
42
43
44
45
46
            }
            if {[eof $chan]} {
                return -level 2 -code error -errorcode {MINHTTPD EOF} "Premature EOF while reading line after [string length $line] bytes"
            }
        }
    }

    proc serve {callback port args} {
        dict set sockargs -server [callback accept $callback]
        if {[regexp {(.*):(.*)} $port -> host port]} {
            dict set sockargs -myaddr $host
        }
        set listenfd [socket {*}$sockargs $port]
        return $listenfd
    }






    proc accept {callback chan caddr cport} {
        coroutine coro#$chan#[info cmdcount] Accept $callback $chan
    }

    proc Accept {callback chan} {
        finally close $chan







|







>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
            }
            if {[eof $chan]} {
                return -level 2 -code error -errorcode {MINHTTPD EOF} "Premature EOF while reading line after [string length $line] bytes"
            }
        }
    }

    proc serve {callback port} {
        dict set sockargs -server [callback accept $callback]
        if {[regexp {(.*):(.*)} $port -> host port]} {
            dict set sockargs -myaddr $host
        }
        set listenfd [socket {*}$sockargs $port]
        return $listenfd
    }

    proc close {listenfd} {
        close $listenfd
        # timeouts will take care of existing clients
    }

    proc accept {callback chan caddr cport} {
        coroutine coro#$chan#[info cmdcount] Accept $callback $chan
    }

    proc Accept {callback chan} {
        finally close $chan