(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:wwwoosh_port)
          op: assign_op.Equal
          rhs: {(DQ <8080>)}
          spids: [4]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:wwwoosh_http_version)
          op: assign_op.Equal
          rhs: {(DQ <'HTTP/1.1'>)}
          spids: [9]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:wwwoosh_fifo)
          op: assign_op.Equal
          rhs: {(DQ <'/tmp/wwwoosh_fifo'>)}
          spids: [15]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:wwwoosh_debug_enabled)
          op: assign_op.Equal
          rhs: {(DQ )}
          spids: [20]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CR)
          op: assign_op.Equal
          rhs: 
            {
              (single_quoted
                left: <Id.Left_DollarSingleQuote '$\''>
                tokens: [<Id.Char_OneChar '\\r'>]
                multiline: F
              )
            }
          spids: [25]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LF)
          op: assign_op.Equal
          rhs: 
            {
              (single_quoted
                left: <Id.Left_DollarSingleQuote '$\''>
                tokens: [<Id.Char_OneChar '\\n'>]
                multiline: F
              )
            }
          spids: [30]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CRLF)
          op: assign_op.Equal
          rhs: {(DQ ($ Id.VSub_DollarName '$CR') ($ Id.VSub_DollarName '$LF'))}
          spids: [35]
        )
      ]
    )
    (command.ShFunction
      name: wwwoosh
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<Id.Lit_VarLike 'app='> (DQ ($ Id.VSub_Number '$1'))})
            (C {<rm>} {<-f>} {(DQ ($ Id.VSub_DollarName '$wwwoosh_fifo'))})
            (C {<mkfifo>} {(DQ ($ Id.VSub_DollarName '$wwwoosh_fifo'))})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<1>} {<Id.Lit_RBracket ']'>})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:wwwoosh_port)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$2'))}
                      spids: [92]
                    )
                  ]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<2>} {<Id.Lit_RBracket ']'>})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:wwwoosh_debug_enabled)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$3'))}
                      spids: [110]
                    )
                  ]
                )
              ]
            )
            (C {<echo>} 
              {(DQ <'Starting Wwwoosh on port '> ($ Id.VSub_DollarName '$wwwoosh_port') <...>)}
            )
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [(command.Sentence child:(C {<true>}) terminator:<Id.Op_Semi _>)]
                )
              body: 
                (command.DoGroup
                  children: [
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{<wwwoosh_listen>} {($ Id.VSub_DollarName '$wwwoosh_port')}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Less '<'>
                              loc: (redir_loc.Fd fd:0)
                              arg: {(DQ ($ Id.VSub_DollarName '$wwwoosh_fifo'))}
                            )
                          ]
                          do_fork: T
                        )
                        (C {<wwwoosh_debug>})
                        (C {<wwwoosh_handle_request>} {(DQ ($ Id.VSub_DollarName '$app'))})
                        (C {<wwwoosh_debug>})
                        (command.Simple
                          words: [{<wwwoosh_handle_response>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {(DQ ($ Id.VSub_DollarName '$wwwoosh_fifo'))}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: F
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: wwwoosh_debug
      body: 
        (BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} 
                              {($ Id.VSub_DollarName '$wwwoosh_debug_enabled')} {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [(C {<tee>} {<'/dev/stderr'>})]
                  spids: [189 198]
                )
              ]
              else_action: [(C {<cat>})]
            )
          ]
        )
    )
    (command.ShFunction
      name: wwwoosh_handle_request
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<Id.Lit_VarLike 'app='> (DQ ($ Id.VSub_Number '$1'))})
            (C {<read>} {<request_line>})
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {<read>} {<header>})
                            (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} 
                              {(DQ ($ Id.VSub_DollarName '$header'))} {<Id.Lit_Equals '='>} 
                              {
                                (single_quoted
                                  left: <Id.Left_DollarSingleQuote '$\''>
                                  tokens: [<Id.Char_OneChar '\\r'>]
                                  multiline: F
                                )
                              } {<Id.Lit_RBracket ']'>}
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:header_name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ <HTTP_> 
                                (command_sub
                                  left_token: <Id.Left_DollarParen '$('>
                                  child: 
                                    (command.Pipeline
                                      children: [
                                        (C {<echo>} {($ Id.VSub_DollarName '$header')})
                                        (C {<cut>} {<-d>} {(SQ <':'>)} {<-f>} {<1>})
                                        (C {<tr>} {(SQ <a-z->)} {(SQ <A-Z_>)})
                                      ]
                                      negated: F
                                    )
                                )
                              )
                            }
                          spids: [280]
                        )
                      ]
                    )
                    (C {<export>} 
                      {($ Id.VSub_DollarName '$header_name') <Id.Lit_Equals '='> 
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Pipeline
                                children: [
                                  (C {<echo>} {($ Id.VSub_DollarName '$header')})
                                  (C {<cut>} {<-d>} {(SQ <':'>)} {<-f>} {<2>})
                                  (C {<sed>} {(SQ <'s/^ //'>)})
                                ]
                                negated: F
                              )
                          )
                        )
                      }
                    )
                  ]
                )
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'REQUEST_METHOD='> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_DollarName '$request_line')})
                        (C {<cut>} {<-d>} {(SQ <' '>)} {<-f>} {<1>})
                      ]
                      negated: F
                    )
                )
              }
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'wwwoosh_http_version='> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_DollarName '$request_line')})
                        (C {<cut>} {<-d>} {(SQ <' '>)} {<-f>} {<3>})
                        (C {<tr>} {<-d>} 
                          {
                            (single_quoted
                              left: <Id.Left_DollarSingleQuote '$\''>
                              tokens: [<Id.Char_OneChar '\\r'>]
                              multiline: F
                            )
                          }
                        )
                      ]
                      negated: F
                    )
                )
              }
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:request_path)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<echo>} {($ Id.VSub_DollarName '$request_line')})
                              (C {<cut>} {<-d>} {(SQ <' '>)} {<-f>} {<2>})
                            ]
                            negated: F
                          )
                      )
                    }
                  spids: [423]
                )
              ]
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'PATH_INFO='> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_DollarName '$request_path')})
                        (C {<cut>} {<-d>} {(SQ <'?'>)} {<-f>} {<1>})
                      ]
                      negated: F
                    )
                )
              }
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'QUERY_STRING='> 
                (command_sub
                  left_token: <Id.Left_DollarParen '$('>
                  child: 
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_DollarName '$request_path')})
                        (C {<cut>} {<-d>} {(SQ <'?'>)} {<-f>} {<2>})
                      ]
                      negated: F
                    )
                )
              }
            )
            (C {<export>} {<Id.Lit_VarLike 'SCRIPT_NAME='> (DQ )})
            (C {<export>} {<Id.Lit_VarLike 'SERVER_NAME='> (DQ <localhost>)})
            (C {<export>} {<Id.Lit_VarLike 'SERVER_PORT='> (DQ ($ Id.VSub_DollarName '$port'))})
            (C {(DQ ($ Id.VSub_DollarName '$app'))})
          ]
        )
    )
    (command.ShFunction
      name: wwwoosh_handle_response
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<Id.Lit_VarLike 'response_status='> (DQ <'200 OK'>)})
            (C {<local>} {<Id.Lit_VarLike 'response_headers='> (DQ )})
            (C {<local>} {<Id.Lit_VarLike 'content_length='> (DQ <->)})
            (command.ShFunction
              name: add_header
              body: 
                (BraceGroup
                  children: [
                    (C {<local>} {<Id.Lit_VarLike 'header='> (DQ ($ Id.VSub_Number '$1'))})
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} 
                                      {(DQ ($ Id.VSub_DollarName '$response_headers'))} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:response_headers)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ ($ Id.VSub_DollarName '$response_headers') 
                                        ($ Id.VSub_DollarName '$CRLF') ($ Id.VSub_DollarName '$header')
                                      )
                                    }
                                  spids: [588]
                                )
                              ]
                            )
                          ]
                          spids: [574 585]
                        )
                      ]
                      else_action: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:response_headers)
                              op: assign_op.Equal
                              rhs: {(DQ ($ Id.VSub_DollarName '$header'))}
                              spids: [599]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
            )
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: 
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {<read>} {<header>})
                            (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} 
                              {(DQ ($ Id.VSub_DollarName '$header'))} {<Id.Lit_Equals '='>} {(DQ )} {<Id.Lit_RBracket ']'>}
                            )
                          ]
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              body: 
                (command.DoGroup
                  children: [
                    (C {<local>} 
                      {<Id.Lit_VarLike 'header_name='> 
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Pipeline
                                children: [
                                  (C {<echo>} {($ Id.VSub_DollarName '$header')})
                                  (C {<cut>} {<-d>} {(SQ <':'>)} {<-f>} {<1>})
                                  (C {<tr>} {(SQ <A-Z>)} {(SQ <a-z>)})
                                ]
                                negated: F
                              )
                          )
                        )
                      }
                    )
                    (C {<local>} 
                      {<Id.Lit_VarLike 'header_value='> 
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Pipeline
                                children: [
                                  (C {<echo>} {($ Id.VSub_DollarName '$header')})
                                  (C {<cut>} {<-d>} {(SQ <':'>)} {<-f>} {<2>})
                                ]
                                negated: F
                              )
                          )
                        )
                      }
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} 
                                      {(DQ ($ Id.VSub_DollarName '$header_name'))} {<Id.Lit_Equals '='>} {(DQ <status>)} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:response_status)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ 
                                        (command_sub
                                          left_token: <Id.Left_DollarParen '$('>
                                          child: 
                                            (command.Pipeline
                                              children: [
                                                (C {<echo>} {($ Id.VSub_DollarName '$header')})
                                                (C {<cut>} {<-d>} {(SQ <':'>)} {<-f>} {<2>})
                                                (C {<sed>} {(SQ <'s/^ //'>)})
                                              ]
                                              negated: F
                                            )
                                        )
                                      )
                                    }
                                  spids: [723]
                                )
                              ]
                            )
                          ]
                          spids: [703 720]
                        )
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} 
                                      {(DQ ($ Id.VSub_DollarName '$header_name'))} {<Id.Lit_Equals '='>} {(DQ <content-length>)} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:content_length)
                                  op: assign_op.Equal
                                  rhs: {(DQ ($ Id.VSub_DollarName '$header_value'))}
                                  spids: [775]
                                )
                              ]
                            )
                            (C {<add_header>} {(DQ ($ Id.VSub_DollarName '$header'))})
                          ]
                          spids: [755 772]
                        )
                      ]
                      else_action: [(C {<add_header>} {(DQ ($ Id.VSub_DollarName '$header'))})]
                    )
                  ]
                )
            )
            (C {<add_header>} {(DQ <'Connection: close'>)})
            (C {<add_header>} 
              {
                (DQ <'Date: '> 
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {<date>} {<-u>} {(SQ <'+%a, %d %b %Y %R:%S GMT'>)})
                  )
                )
              }
            )
            (C {<echo>} 
              {
                (DQ ($ Id.VSub_DollarName '$wwwoosh_http_version') <' '> 
                  ($ Id.VSub_DollarName '$response_status') ($ Id.VSub_DollarName '$CRLF') ($ Id.VSub_DollarName '$response_headers') 
                  ($ Id.VSub_DollarName '$CRLF') ($ Id.VSub_DollarName '$CR')
                )
              }
            )
            (C {<cat>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:log_remote_host)
                  op: assign_op.Equal
                  rhs: {(DQ <->)}
                  spids: [850]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:log_user)
                  op: assign_op.Equal
                  rhs: {(DQ <->)}
                  spids: [856]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:log_date)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: (C {<date>} {<-u>} {(SQ <'+%d/%b/%Y:%H:%M:%S'>)})
                        )
                      )
                    }
                  spids: [862]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:log_header)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ ($ Id.VSub_DollarName '$REQUEST_METHOD') <' '> 
                        ($ Id.VSub_DollarName '$PATH_INFO') <' '> ($ Id.VSub_DollarName '$wwwoosh_http_version')
                      )
                    }
                  spids: [876]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:log_status)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (command.Pipeline
                              children: [
                                (C {<echo>} {(DQ ($ Id.VSub_DollarName '$response_status'))})
                                (C {<cut>} {<-d>} {(DQ <' '>)} {<-f1>})
                              ]
                              negated: F
                            )
                        )
                      )
                    }
                  spids: [889]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:log_size)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_DollarName '$content_length'))}
                  spids: [913]
                )
              ]
            )
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ ($ Id.VSub_DollarName '$log_remote_host') <' - '> 
                    ($ Id.VSub_DollarName '$log_user') <' ['> ($ Id.VSub_DollarName '$log_date') <'] '> 
                    (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$log_header') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' '> 
                    ($ Id.VSub_DollarName '$log_status') <' '> ($ Id.VSub_DollarName '$log_size')
                  )
                }
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '1>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
          ]
        )
    )
    (command.ShFunction
      name: wwwoosh_listen
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (command.Simple
                  words: [{<nc>} {<-l>} {<-p>} {($ Id.VSub_Number '$1')}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '2>'>
                      loc: (redir_loc.Fd fd:2)
                      arg: {<'/dev/null'>}
                    )
                  ]
                  do_fork: T
                )
                (C {<nc>} {<-l>} {($ Id.VSub_Number '$1')})
              ]
            )
          ]
        )
    )
    (command.Case
      to_match: {(DQ ($ Id.VSub_Number '$0'))}
      arms: [
        (case_arm
          pat_list: [{<Id.Lit_Star '*'> <wwwoosh.sh>}]
          action: [(C {<wwwoosh>} {($ Id.VSub_At '$@')})]
          spids: [988 990 996 -1]
        )
      ]
    )
  ]
)