(command.CommandList
  children: [
    (command.ShFunction
      name: 'http::parse_request'
      body: 
        (BraceGroup
          children: [
            (C {<http> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <read>} {<req_line>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:req_line)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (sh_array_literal
                        left: <Id.Op_LParen _>
                        words: [{($ Id.VSub_DollarName '$req_line')}]
                      )
                    }
                  spids: [23]
                )
              ]
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'REQUEST_METHOD='> 
                (braced_var_sub
                  token: <Id.VSub_Name req_line>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                )
              }
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'REQUEST_URI='> 
                (braced_var_sub
                  token: <Id.VSub_Name req_line>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 1>})
                )
              }
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'REQUEST_PATH='> 
                (braced_var_sub
                  token: <Id.VSub_Name REQUEST_URI>
                  suffix_op: 
                    (suffix_op.Unary
                      tok: <Id.VOp1_DPercent '%%'>
                      arg_word: 
                        {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\?'>) 
                          <Id.Lit_Other '*'>
                        }
                    )
                )
              }
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'QUERY_STRING='> 
                (braced_var_sub
                  token: <Id.VSub_Name REQUEST_URI>
                  suffix_op: 
                    (suffix_op.Unary
                      tok: <Id.VOp1_Pound '#'>
                      arg_word: 
                        {<Id.Lit_Other '*'> 
                          (word_part.EscapedLiteral
                            token: <Id.Lit_EscapedChar '\\?'>
                          )
                        }
                    )
                )
              }
            )
            (C {<export>} 
              {<Id.Lit_VarLike 'HTTP_VERSION='> 
                (braced_var_sub
                  token: <Id.VSub_Name req_line>
                  bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 2>})
                )
              }
            )
            (C {<export>} {<Id.Lit_VarLike 'SERVER_SOFTWARE='> (DQ <'balls/0.0'>)})
            (C {<declare>} {<-A>} {<HEADERS>})
            (C {<local>} {<key>})
            (C {<local>} {<val>})
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [
                    (command.Sentence
                      child: (C {<http> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <read>} {<HEADER_LINE>})
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                )
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:key)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name HEADER_LINE>
                                  suffix_op: 
                                    (suffix_op.Unary
                                      tok: <Id.VOp1_DPercent '%%'>
                                      arg_word: 
                                        {
                                          (word_part.ExtGlob
                                            op: <Id.ExtGlob_Star '*('>
                                            arms: [{<' '>}]
                                          ) <':'> <Id.Lit_Other '*'>
                                        }
                                    )
                                )
                              )
                            }
                          spids: [127]
                        )
                      ]
                    )
                    (C {<trim>} {<key>})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:val)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name HEADER_LINE>
                                  suffix_op: 
                                    (suffix_op.Unary
                                      tok: <Id.VOp1_Pound '#'>
                                      arg_word: 
                                        {<Id.Lit_Other '*'> <':'> 
                                          (word_part.ExtGlob
                                            op: <Id.ExtGlob_Star '*('>
                                            arms: [{<' '>}]
                                          )
                                        }
                                    )
                                )
                              )
                            }
                          spids: [146]
                        )
                      ]
                    )
                    (C {<trim>} {<val>})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: 
                            (sh_lhs_expr.IndexedName
                              name: HEADERS
                              index: {(DQ ($ Id.VSub_DollarName '$key'))}
                            )
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName '$val'))}
                          spids: [166]
                        )
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: 'http::read'
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike '__var='> ($ Id.VSub_Number '$1')})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (C {<read>} {<__in>})
            (C {<local>} {<Id.Lit_VarLike 'RETVAL='> ($ Id.VSub_QMark '$?')})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:__in)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Pipeline
                            children: [
                              (C {<echo>} {(DQ ($ Id.VSub_DollarName '$__in'))})
                              (C {<tr>} {<-d>} {(SQ <'\\r'>)})
                            ]
                            negated: F
                          )
                      )
                    }
                  spids: [220]
                )
              ]
            )
            (C {<export>} 
              {(DQ ($ Id.VSub_DollarName '$__var')) <Id.Lit_Equals '='> 
                (DQ ($ Id.VSub_DollarName '$__in'))
              }
            )
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$RETVAL'))} {<Id.Lit_Equals '='>} 
                  {<0>} {<Id.Lit_RBracket ']'>}
                )
                (C {<Id.Lit_LBracket '['>} {<-n>} 
                  {(DQ (braced_var_sub token:<Id.VSub_Name __var> prefix_op:(Id.VSub_Bang)))} {<Id.Lit_RBracket ']'>}
                )
              ]
            )
          ]
        )
    )
    (C {<declare>} {<-a>} {<HTTP_STATUSES>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.IndexedName name:HTTP_STATUSES index:{<Id.Lit_Digits 200>})
          op: assign_op.Equal
          rhs: {(SQ <OK>)}
          spids: [294]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.IndexedName name:HTTP_STATUSES index:{<Id.Lit_Digits 404>})
          op: assign_op.Equal
          rhs: {(SQ <'Not Found'>)}
          spids: [303]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.IndexedName name:HTTP_STATUSES index:{<Id.Lit_Digits 500>})
          op: assign_op.Equal
          rhs: {(SQ <'Internal Server Error'>)}
          spids: [312]
        )
      ]
    )
    (command.ShFunction
      name: 'http::status'
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'code='> ($ Id.VSub_Number '$1')})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'message='> ($ Id.VSub_Number '$1')})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName '$message'))} 
                  {<Id.Lit_RBracket ']'>}
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:message)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (braced_var_sub
                            token: <Id.VSub_Name HTTP_STATUSES>
                            bracket_op: (bracket_op.ArrayIndex expr:{($ Id.VSub_DollarName '$code')})
                          )
                        }
                      spids: [365]
                    )
                  ]
                )
              ]
            )
            (C {<http> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <header_echo>} 
              {
                (DQ ($ Id.VSub_DollarName '$HTTP_VERSION') <' '> ($ Id.VSub_DollarName '$code') <' '> 
                  ($ Id.VSub_DollarName '$message')
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: 'http::header'
      body: 
        (BraceGroup
          children: [
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'header_name='> ($ Id.VSub_Number '$1')})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (command.Sentence
              child: (C {<local>} {<Id.Lit_VarLike 'header_val='> ($ Id.VSub_Number '$1')})
              terminator: <Id.Op_Semi _>
            )
            (C {<shift>})
            (C {<http> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <header_echo>} 
              {(DQ ($ Id.VSub_DollarName '$header_name') <': '> ($ Id.VSub_DollarName '$header_val'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: 'http::header_echo'
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<3>})]
              do_fork: T
            )
          ]
        )
    )
    (command.ShFunction
      name: 'http::content_type'
      body: 
        (BraceGroup
          children: [
            (C {<http> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <header>} {(SQ <Content-Type>)} 
              {(DQ ($ Id.VSub_At '$@'))}
            )
          ]
        )
    )
  ]
)