Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved SCGI security: (1) The --scgi option only listens on IP address 127.0.0.1. The new --remote-scgi option must be used if the webserver is on a different machine. (2) The new --fromip option can be used to restrict incoming requests to a particular IP address. (3) In SCGI mode, the new parameter "SERVER_ADDR" contains the IP address of the webserver that originated the SCGI request. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fb5eafae32c267434df7a9a427ca9b68 |
User & Date: | drh 2019-04-01 00:53:50.535 |
Context
2019-04-01
| ||
01:31 | Fix error in the first example of the "intro.md" page. (check-in: 83e002a08c user: drh tags: trunk) | |
00:53 | Improved SCGI security: (1) The --scgi option only listens on IP address 127.0.0.1. The new --remote-scgi option must be used if the webserver is on a different machine. (2) The new --fromip option can be used to restrict incoming requests to a particular IP address. (3) In SCGI mode, the new parameter "SERVER_ADDR" contains the IP address of the webserver that originated the SCGI request. (check-in: fb5eafae32 user: drh tags: trunk) | |
2019-03-08
| ||
00:08 | Add the forgotten helloworld.md documentation file. (check-in: 5f79eb875f user: drh tags: trunk) | |
Changes
Changes to docs/intro.md.
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - - + + + + + + + | web-browser at that script. Run the hello-world program as SCGI like this: > wapptclsh main.tcl --scgi 9000 |
︙ |
Changes to docs/params.md.
︙ | |||
244 245 246 247 248 249 250 251 252 253 254 255 256 257 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | + + + + | it should invoke the "wapp-allow-xorigin-params" interface to explicitly signal that cross-origin parameters are safe for that page. + **SELF\_URL** The URL for the current page, stripped of query parameter. This is useful for filling in the action= attribute of forms. + **SERVER\_ADDR** In SCGI mode only, this variable is the address of the webserver from which the SCGI request originates. + **WAPP\_MODE** This parameter has a value of "cgi", "local", "scgi", or "server" depending on how Wapp was launched. ### 3.1 URL Parsing Example |
︙ |
Changes to docs/quickref.md.
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + - + | |REMOTE\_ADDR|→|IP address of the client| |REMOTE\_PORT|→|TCP port of the client| |REQUEST\_METHOD|→|"GET" or "POST" or "HEAD"| |SAME\_ORIGIN|→|True if this request is from the same origin| |SCRIPT\_FILENAME|→|Full pathname of the Wapp application script| |SCRIPT\_NAME|→|Prefix of PATH\_INFO that identifies the application script| |SELF\_URL|→|URL of this request without PATH\_TAIL| |SERVER\_ADDR|→|IP address of the webserver sending an SCGI request| |
︙ |
Changes to wapp.tcl.
︙ | |||
363 364 365 366 367 368 369 | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | - + + + + - - + + - + + - + + - + + + | # Start up a listening socket. Arrange to invoke wappInt-new-connection # for each inbound HTTP connection. # # port Listen on this TCP port. 0 means to select a port # that is not currently in use # |
︙ | |||
404 405 406 407 408 409 410 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | - + + - + + + + + | } } # This routine is a "socket -server" callback. The $chan, $ip, and $port # arguments are added by the socket command. # # Arrange to invoke $callback when content is available on the new socket. |
︙ | |||
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | + + + - + + + + + + + + + + + + + + + + + + + | if {![dict exists $W .toread]} { # If the .toread key is not set, that means we are still reading # the header. # # An SGI header is short. This implementation assumes the entire # header is available all at once. # dict set W .remove_addr [dict get $W REMOTE_ADDR] set req [read $chan 15] set n [string length $req] scan $req %d:%s len hdr incr len [string length "$len:,"] append hdr [read $chan [expr {$len-15}]] foreach {nm val} [split $hdr \000] { if {$nm==","} break dict set W $nm $val } set len 0 if {[dict exists $W CONTENT_LENGTH]} { set len [dict get $W CONTENT_LENGTH] } if {$len>0} { # Still need to read the query content dict set W .toread $len } else { # There is no query content, so handle the request immediately dict set W SERVER_ADDR [dict get $W .remove_addr] set wapp $W wappInt-handle-request $chan 0 } } else { # If .toread is set, that means we are reading the query content. # Continue reading until .toread reaches zero. set got [read $chan [dict get $W .toread]] dict append W CONTENT $got dict set W .toread [expr {[dict get $W .toread]-[string length $got]}] if {[dict get $W .toread]<=0} { # Handle the request as soon as all the query content is received dict set W SERVER_ADDR [dict get $W .remove_addr] set wapp $W wappInt-handle-request $chan 0 } } } # Start up the wapp framework. Parameters are a list passed as the # single argument. # # -server $PORT Listen for HTTP requests on this TCP port $PORT # # -local $PORT Listen for HTTP requests on 127.0.0.1:$PORT # |
︙ | |||
928 929 930 931 932 933 934 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | - - - - - + + + + + - - - - - + + + + + - - - + - - - + + + | } } default { error "unknown option: $term" } } } |