(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:wwwoosh_port) op:Equal rhs:{(DQ (8080))})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:wwwoosh_http_version)
          op: Equal
          rhs: {(DQ (HTTP/1.1))}
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:wwwoosh_fifo)
          op: Equal
          rhs: {(DQ (/tmp/wwwoosh_fifo))}
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:wwwoosh_debug_enabled) op:Equal rhs:{(DQ )})]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:CR)
          op: Equal
          rhs: 
            {
              (word_part.SingleQuotedPart
                left: <Left_DollarSingleQuote "$'">
                tokens: [<Char_OneChar '\\r'>]
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:LF)
          op: Equal
          rhs: 
            {
              (word_part.SingleQuotedPart
                left: <Left_DollarSingleQuote "$'">
                tokens: [<Char_OneChar '\\n'>]
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:CRLF)
          op: Equal
          rhs: {(DQ ($ VSub_DollarName '$CR') ($ VSub_DollarName '$LF'))}
        )
      ]
    )
    (command.FuncDef
      name: wwwoosh
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:app)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (C {(rm)} {(-f)} {(DQ ($ VSub_DollarName '$wwwoosh_fifo'))})
            (C {(mkfifo)} {(DQ ($ VSub_DollarName '$wwwoosh_fifo'))})
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-gt)} {(1)} {(Lit_Other ']')})
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:wwwoosh_port)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$2'))}
                    )
                  ]
                )
              ]
            )
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(Lit_Other '[')} {($ VSub_Pound '$#')} {(-gt)} {(2)} {(Lit_Other ']')})
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:wwwoosh_debug_enabled)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$3'))}
                    )
                  ]
                )
              ]
            )
            (C {(echo)} {(DQ ('Starting Wwwoosh on port ') ($ VSub_DollarName '$wwwoosh_port') (...))})
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [(command.Sentence child:(C {(true)}) terminator:<Op_Semi ';'>)]
              body: 
                (command.DoGroup
                  children: [
                    (command.Pipeline
                      children: [
                        (command.SimpleCommand
                          words: [{(wwwoosh_listen)} {($ VSub_DollarName '$wwwoosh_port')}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Less '<'>
                              fd: 16777215
                              arg_word: {(DQ ($ VSub_DollarName '$wwwoosh_fifo'))}
                            )
                          ]
                        )
                        (C {(wwwoosh_debug)})
                        (C {(wwwoosh_handle_request)} {(DQ ($ VSub_DollarName '$app'))})
                        (C {(wwwoosh_debug)})
                        (command.SimpleCommand
                          words: [{(wwwoosh_handle_response)}]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(DQ ($ VSub_DollarName '$wwwoosh_fifo'))}
                            )
                          ]
                        )
                      ]
                      negated: F
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.FuncDef
      name: wwwoosh_debug
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_DollarName '$wwwoosh_debug_enabled')} 
                          {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(tee)} {(/dev/stderr)})]
                )
              ]
              else_action: [(C {(cat)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: wwwoosh_handle_request
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:app)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (C {(read)} {(request_line)})
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [
                (command.Sentence
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(read)} {(header)})
                        (C {(Lit_Other '[')} {(KW_Bang '!')} {(DQ ($ VSub_DollarName '$header'))} 
                          {(Lit_Other '=')} {(word_part.SingleQuotedPart left:<Left_DollarSingleQuote "$'"> tokens:[<Char_OneChar '\\r'>])} 
                          {(Lit_Other ']')}
                        )
                      ]
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:header_name)
                          op: Equal
                          rhs: 
                            {
                              (DQ (HTTP_) 
                                (word_part.CommandSubPart
                                  command_list: 
                                    (command.CommandList
                                      children: [
                                        (command.Pipeline
                                          children: [
                                            (C {(echo)} {($ VSub_DollarName '$header')})
                                            (C {(cut)} {(-d)} {(SQ <':'>)} {(-f)} {(1)})
                                            (C {(tr)} {(SQ <a-z->)} {(SQ <A-Z_>)})
                                          ]
                                          negated: F
                                        )
                                      ]
                                    )
                                  left_token: <Left_DollarParen '$('>
                                )
                              )
                            }
                        )
                      ]
                    )
                    (C {(export)} 
                      {($ VSub_DollarName '$header_name') (Lit_Other '=') 
                        (DQ 
                          (word_part.CommandSubPart
                            command_list: 
                              (command.CommandList
                                children: [
                                  (command.Pipeline
                                    children: [
                                      (C {(echo)} {($ VSub_DollarName '$header')})
                                      (C {(cut)} {(-d)} {(SQ <':'>)} {(-f)} {(2)})
                                      (C {(sed)} {(SQ <'s/^ //'>)})
                                    ]
                                    negated: F
                                  )
                                ]
                              )
                            left_token: <Left_DollarParen '$('>
                          )
                        )
                      }
                    )
                  ]
                )
            )
            (C {(export)} 
              {(Lit_VarLike 'REQUEST_METHOD=') 
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Pipeline
                          children: [
                            (C {(echo)} {($ VSub_DollarName '$request_line')})
                            (C {(cut)} {(-d)} {(SQ <' '>)} {(-f)} {(1)})
                          ]
                          negated: F
                        )
                      ]
                    )
                  left_token: <Left_DollarParen '$('>
                )
              }
            )
            (C {(export)} 
              {(Lit_VarLike 'wwwoosh_http_version=') 
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Pipeline
                          children: [
                            (C {(echo)} {($ VSub_DollarName '$request_line')})
                            (C {(cut)} {(-d)} {(SQ <' '>)} {(-f)} {(3)})
                            (C {(tr)} {(-d)} 
                              {
                                (word_part.SingleQuotedPart
                                  left: <Left_DollarSingleQuote "$'">
                                  tokens: [<Char_OneChar '\\r'>]
                                )
                              }
                            )
                          ]
                          negated: F
                        )
                      ]
                    )
                  left_token: <Left_DollarParen '$('>
                )
              }
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:request_path)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_DollarName '$request_line')})
                                  (C {(cut)} {(-d)} {(SQ <' '>)} {(-f)} {(2)})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    }
                )
              ]
            )
            (C {(export)} 
              {(Lit_VarLike 'PATH_INFO=') 
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Pipeline
                          children: [
                            (C {(echo)} {($ VSub_DollarName '$request_path')})
                            (C {(cut)} {(-d)} {(SQ <'?'>)} {(-f)} {(1)})
                          ]
                          negated: F
                        )
                      ]
                    )
                  left_token: <Left_DollarParen '$('>
                )
              }
            )
            (C {(export)} 
              {(Lit_VarLike 'QUERY_STRING=') 
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.Pipeline
                          children: [
                            (C {(echo)} {($ VSub_DollarName '$request_path')})
                            (C {(cut)} {(-d)} {(SQ <'?'>)} {(-f)} {(2)})
                          ]
                          negated: F
                        )
                      ]
                    )
                  left_token: <Left_DollarParen '$('>
                )
              }
            )
            (C {(export)} {(Lit_VarLike 'SCRIPT_NAME=') (DQ )})
            (C {(export)} {(Lit_VarLike 'SERVER_NAME=') (DQ (localhost))})
            (C {(export)} {(Lit_VarLike 'SERVER_PORT=') (DQ ($ VSub_DollarName '$port'))})
            (C {(DQ ($ VSub_DollarName '$app'))})
          ]
        )
    )
    (command.FuncDef
      name: wwwoosh_handle_response
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:response_status)
                  op: Equal
                  rhs: {(DQ ('200 OK'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:response_headers) op:Equal rhs:{(DQ )})]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:content_length) op:Equal rhs:{(DQ (-))})]
            )
            (command.FuncDef
              name: add_header
              body: 
                (command.BraceGroup
                  children: [
                    (command.Assignment
                      keyword: Assign_Local
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:header)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number '$1'))}
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_DollarName '$response_headers'))} 
                                  {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:response_headers)
                                  op: Equal
                                  rhs: 
                                    {
                                      (DQ ($ VSub_DollarName '$response_headers') 
                                        ($ VSub_DollarName '$CRLF') ($ VSub_DollarName '$header')
                                      )
                                    }
                                )
                              ]
                            )
                          ]
                        )
                      ]
                      else_action: [
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:response_headers)
                              op: Equal
                              rhs: {(DQ ($ VSub_DollarName '$header'))}
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
            )
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [
                (command.Sentence
                  child: 
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(read)} {(header)})
                        (C {(Lit_Other '[')} {(KW_Bang '!')} {(DQ ($ VSub_DollarName '$header'))} 
                          {(Lit_Other '=')} {(DQ )} {(Lit_Other ']')}
                        )
                      ]
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.Assignment
                      keyword: Assign_Local
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:header_name)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (word_part.CommandSubPart
                                  command_list: 
                                    (command.CommandList
                                      children: [
                                        (command.Pipeline
                                          children: [
                                            (C {(echo)} {($ VSub_DollarName '$header')})
                                            (C {(cut)} {(-d)} {(SQ <':'>)} {(-f)} {(1)})
                                            (C {(tr)} {(SQ <A-Z>)} {(SQ <a-z>)})
                                          ]
                                          negated: F
                                        )
                                      ]
                                    )
                                  left_token: <Left_DollarParen '$('>
                                )
                              )
                            }
                        )
                      ]
                    )
                    (command.Assignment
                      keyword: Assign_Local
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:header_value)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (word_part.CommandSubPart
                                  command_list: 
                                    (command.CommandList
                                      children: [
                                        (command.Pipeline
                                          children: [
                                            (C {(echo)} {($ VSub_DollarName '$header')})
                                            (C {(cut)} {(-d)} {(SQ <':'>)} {(-f)} {(2)})
                                          ]
                                          negated: F
                                        )
                                      ]
                                    )
                                  left_token: <Left_DollarParen '$('>
                                )
                              )
                            }
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_DollarName '$header_name'))} 
                                  {(Lit_Other '=')} {(DQ (status))} {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:response_status)
                                  op: Equal
                                  rhs: 
                                    {
                                      (DQ 
                                        (word_part.CommandSubPart
                                          command_list: 
                                            (command.CommandList
                                              children: [
                                                (command.Pipeline
                                                  children: [
                                                    (C {(echo)} {($ VSub_DollarName '$header')})
                                                    (C {(cut)} {(-d)} {(SQ <':'>)} {(-f)} {(2)})
                                                    (C {(sed)} {(SQ <'s/^ //'>)})
                                                  ]
                                                  negated: F
                                                )
                                              ]
                                            )
                                          left_token: <Left_DollarParen '$('>
                                        )
                                      )
                                    }
                                )
                              ]
                            )
                          ]
                        )
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_DollarName '$header_name'))} 
                                  {(Lit_Other '=')} {(DQ (content-length))} {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:content_length)
                                  op: Equal
                                  rhs: {(DQ ($ VSub_DollarName '$header_value'))}
                                )
                              ]
                            )
                            (C {(add_header)} {(DQ ($ VSub_DollarName '$header'))})
                          ]
                        )
                      ]
                      else_action: [(C {(add_header)} {(DQ ($ VSub_DollarName '$header'))})]
                    )
                  ]
                )
            )
            (C {(add_header)} {(DQ ('Connection: close'))})
            (C {(add_header)} 
              {
                (DQ ('Date: ') 
                  (word_part.CommandSubPart
                    command_list: 
                      (command.CommandList
                        children: [(C {(date)} {(-u)} {(SQ <'+%a, %d %b %Y %R:%S GMT'>)})]
                      )
                    left_token: <Left_DollarParen '$('>
                  )
                )
              }
            )
            (C {(echo)} 
              {
                (DQ ($ VSub_DollarName '$wwwoosh_http_version') (' ') 
                  ($ VSub_DollarName '$response_status') ($ VSub_DollarName '$CRLF') ($ VSub_DollarName '$response_headers') ($ VSub_DollarName '$CRLF') 
                  ($ VSub_DollarName '$CR')
                )
              }
            )
            (C {(cat)})
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:log_remote_host) op:Equal rhs:{(DQ (-))})]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:log_user) op:Equal rhs:{(DQ (-))})]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:log_date)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (word_part.CommandSubPart
                          command_list: 
                            (command.CommandList
                              children: [(C {(date)} {(-u)} {(SQ <'+%d/%b/%Y:%H:%M:%S'>)})]
                            )
                          left_token: <Left_DollarParen '$('>
                        )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:log_header)
                  op: Equal
                  rhs: 
                    {
                      (DQ ($ VSub_DollarName '$REQUEST_METHOD') (' ') ($ VSub_DollarName '$PATH_INFO') 
                        (' ') ($ VSub_DollarName '$wwwoosh_http_version')
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:log_status)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (word_part.CommandSubPart
                          command_list: 
                            (command.CommandList
                              children: [
                                (command.Pipeline
                                  children: [
                                    (C {(echo)} {(DQ ($ VSub_DollarName '$response_status'))})
                                    (C {(cut)} {(-d)} {(DQ (' '))} {(-f1)})
                                  ]
                                  negated: F
                                )
                              ]
                            )
                          left_token: <Left_DollarParen '$('>
                        )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:log_size)
                  op: Equal
                  rhs: {(DQ ($ VSub_DollarName '$content_length'))}
                )
              ]
            )
            (command.SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ($ VSub_DollarName '$log_remote_host') (' - ') ($ VSub_DollarName '$log_user') 
                    (' [') ($ VSub_DollarName '$log_date') ('] ') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
                    ($ VSub_DollarName '$log_header') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' ') ($ VSub_DollarName '$log_status') 
                    (' ') ($ VSub_DollarName '$log_size')
                  )
                }
              ]
              redirects: [(redir.Redir op:<Redir_GreatAnd '1>&'> fd:1 arg_word:{(2)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: wwwoosh_listen
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.SimpleCommand
                  words: [{(nc)} {(-l)} {(-p)} {($ VSub_Number '$1')}]
                  redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})]
                )
                (C {(nc)} {(-l)} {($ VSub_Number '$1')})
              ]
            )
          ]
        )
    )
    (command.Case
      to_match: {(DQ ($ VSub_Number '$0'))}
      arms: [
        (case_arm
          pat_list: [{(Lit_Other '*') (wwwoosh.sh)}]
          action: [(C {(wwwoosh)} {($ VSub_At '$@')})]
        )
      ]
    )
  ]
)