Wapp

Check-in [102ae00863]
Login

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

Overview
Comment:Add the -nowait option to the wapp-start proc.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:102ae008635d1780d643a2ff3f3bb69c4d7a5a60488952603a34ca296bc7e2df
User & Date: drh 2019-02-16 00:26:03
Context
2019-02-16
12:07
Minor updates to the documentation. check-in: ca3221ef4e user: drh tags: trunk
00:26
Add the -nowait option to the wapp-start proc. check-in: 102ae00863 user: drh tags: trunk
2019-02-05
23:32
Update the built-in tclsqlite3.c to the latest 3.27.0 beta. check-in: 52cd62c2ac user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to wapp.tcl.

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
...
871
872
873
874
875
876
877



878
879
880
881
882
883
884
...
914
915
916
917
918
919
920

921

922
923
924
925
# With no arguments, the behavior is called "auto".  In "auto" mode,
# if the GATEWAY_INTERFACE environment variable indicates CGI, then run
# as CGI.  Otherwise, start an HTTP server bound to the loopback address
# only, on an arbitrary TCP port, and automatically launch a web browser
# on that TCP port.
#
# Additional options:



#
#    -trace               "puts" each request URL as it is handled, for
#                         debugging
#
#    -lint                Run wapp-safety-check on the application instead
#                         of running the application itself
#
................................................................................
#    -Dvar=value          Set TCL global variable "var" to "value"
#
#
proc wapp-start {arglist} {
  global env
  set mode auto
  set port 0

  set n [llength $arglist]
  for {set i 0} {$i<$n} {incr i} {
    set term [lindex $arglist $i]
    if {[string match --* $term]} {set term [string range $term 1 end]}
    switch -glob -- $term {
      -server {
        incr i;
................................................................................
        incr i;
        set mode "scgi"
        set port [lindex $arglist $i]
      }
      -cgi {
        set mode "cgi"
      }



      -trace {
        proc wappInt-trace {} {
          set q [wapp-param QUERY_STRING]
          set uri [wapp-param BASE_URL][wapp-param PATH_INFO]
          if {$q!=""} {append uri ?$q}
          puts $uri
        }
................................................................................
  if {$mode=="scgi"} {
    wappInt-start-listener $port scgi
  } elseif {$mode=="server"} {
    wappInt-start-listener $port server
  } else {
    wappInt-start-listener $port local
  }

  vwait ::forever

}

# Call this version 1.0
package provide wapp 1.0







>
>
>







 







>







 







>
>
>







 







>
|
>




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
...
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
...
921
922
923
924
925
926
927
928
929
930
931
932
933
934
# With no arguments, the behavior is called "auto".  In "auto" mode,
# if the GATEWAY_INTERFACE environment variable indicates CGI, then run
# as CGI.  Otherwise, start an HTTP server bound to the loopback address
# only, on an arbitrary TCP port, and automatically launch a web browser
# on that TCP port.
#
# Additional options:
#
#    -nowait              Do not wait in the event loop.  Return immediately
#                         after all event handlers are established.
#
#    -trace               "puts" each request URL as it is handled, for
#                         debugging
#
#    -lint                Run wapp-safety-check on the application instead
#                         of running the application itself
#
................................................................................
#    -Dvar=value          Set TCL global variable "var" to "value"
#
#
proc wapp-start {arglist} {
  global env
  set mode auto
  set port 0
  set nowait 0
  set n [llength $arglist]
  for {set i 0} {$i<$n} {incr i} {
    set term [lindex $arglist $i]
    if {[string match --* $term]} {set term [string range $term 1 end]}
    switch -glob -- $term {
      -server {
        incr i;
................................................................................
        incr i;
        set mode "scgi"
        set port [lindex $arglist $i]
      }
      -cgi {
        set mode "cgi"
      }
      -nowait {
        set nowait 1
      }
      -trace {
        proc wappInt-trace {} {
          set q [wapp-param QUERY_STRING]
          set uri [wapp-param BASE_URL][wapp-param PATH_INFO]
          if {$q!=""} {append uri ?$q}
          puts $uri
        }
................................................................................
  if {$mode=="scgi"} {
    wappInt-start-listener $port scgi
  } elseif {$mode=="server"} {
    wappInt-start-listener $port server
  } else {
    wappInt-start-listener $port local
  }
  if {!$nowait} {
    vwait ::forever
  }
}

# Call this version 1.0
package provide wapp 1.0