(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'test git-http-backend'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY')) (/lib-httpd.sh)})
    (C {(start_httpd)})
    (command.FuncDef
      name: GET
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [
                    {(curl)}
                    {(--include)}
                    {
                      (DQ ($ VSub_DollarName '$HTTPD_URL') (/) ($ VSub_DollarName '$SMART') (/repo.git/) 
                        ($ VSub_Number '$1')
                      )
                    }
                  ]
                  redirects: [
                    (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(out)})
                    (redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})
                  ]
                )
                (command.Pipeline
                  children: [
                    (command.SimpleCommand
                      words: [{(tr)} {(SQ <'\\015'>)} {(Q)}]
                      redirects: [(redir.Redir op:<Redir_Less '<'> fd:16777215 arg_word:{(out)})]
                    )
                    (command.SimpleCommand
                      words: [{(sed)} {(SQ <'\n'> <'\t\ts/Q$//\n'> <'\t\t1q\n'> <'\t'>)}]
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(act)})]
                    )
                  ]
                  negated: F
                )
                (command.SimpleCommand
                  words: [{(echo)} {(DQ ('HTTP/1.1 ') ($ VSub_Number '$2'))}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(exp)})]
                )
                (C {(test_cmp)} {(exp)} {(act)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: POST
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [
                    {(curl)}
                    {(--include)}
                    {(--data)}
                    {(DQ ($ VSub_Number '$2'))}
                    {(--header)}
                    {(DQ ('Content-Type: application/x-') ($ VSub_Number '$1') (-request))}
                    {(DQ ($ VSub_DollarName '$HTTPD_URL') (/smart/repo.git/) ($ VSub_Number '$1'))}
                  ]
                  redirects: [
                    (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(out)})
                    (redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})
                  ]
                )
                (command.Pipeline
                  children: [
                    (command.SimpleCommand
                      words: [{(tr)} {(SQ <'\\015'>)} {(Q)}]
                      redirects: [(redir.Redir op:<Redir_Less '<'> fd:16777215 arg_word:{(out)})]
                    )
                    (command.SimpleCommand
                      words: [{(sed)} {(SQ <'\n'> <'\t\ts/Q$//\n'> <'\t\t1q\n'> <'\t'>)}]
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(act)})]
                    )
                  ]
                  negated: F
                )
                (command.SimpleCommand
                  words: [{(echo)} {(DQ ('HTTP/1.1 ') ($ VSub_Number '$3'))}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(exp)})]
                )
                (C {(test_cmp)} {(exp)} {(act)})
              ]
            )
          ]
        )
    )
    (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY')) (/t556x_common)})
    (command.SimpleCommand
      words: [{(grep)} {(SQ <'^[^#]'>)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(exp)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EOF)}
          here_end_span_id: 337
          stdin_parts: [
            ('\n')
            ('###  refs/heads/master\n')
            ('###\n')
            ('GET  /smart/repo.git/refs/heads/master HTTP/1.1 404 -\n')
            ('\n')
            ('###  getanyfile default\n')
            ('###\n')
            ('GET  /smart/repo.git/HEAD HTTP/1.1 200\n')
            ('GET  /smart/repo.git/info/refs HTTP/1.1 200\n')
            ('GET  /smart/repo.git/objects/info/packs HTTP/1.1 200\n')
            ('GET  /smart/repo.git/objects/info/alternates HTTP/1.1 200 -\n')
            ('GET  /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$IDX_URL')
            (' HTTP/1.1 200\n')
            ('\n')
            ('###  no git-daemon-export-ok\n')
            ('###\n')
            ('GET  /smart_noexport/repo.git/HEAD HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/info/refs HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/objects/info/packs HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/')
            ($ VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/')
            ($ VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/')
            ($ VSub_DollarName '$IDX_URL')
            (' HTTP/1.1 404 -\n')
            ('\n')
            ('###  git-daemon-export-ok\n')
            ('###\n')
            ('GET  /smart_noexport/repo.git/HEAD HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/info/refs HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/objects/info/packs HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 200 -\n')
            ('GET  /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 200 -\n')
            ('GET  /smart_noexport/repo.git/')
            ($ VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/')
            ($ VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/')
            ($ VSub_DollarName '$IDX_URL')
            (' HTTP/1.1 200\n')
            ('\n')
            ('###  getanyfile true\n')
            ('###\n')
            ('GET  /smart/repo.git/HEAD HTTP/1.1 200\n')
            ('GET  /smart/repo.git/info/refs HTTP/1.1 200\n')
            ('GET  /smart/repo.git/objects/info/packs HTTP/1.1 200\n')
            ('GET  /smart/repo.git/objects/info/alternates HTTP/1.1 200 -\n')
            ('GET  /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$IDX_URL')
            (' HTTP/1.1 200\n')
            ('\n')
            ('###  getanyfile false\n')
            ('###\n')
            ('GET  /smart/repo.git/HEAD HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/info/refs HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/objects/info/packs HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/objects/info/alternates HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/objects/info/http-alternates HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/')
            ($ VSub_DollarName '$IDX_URL')
            (' HTTP/1.1 403 -\n')
            ('\n')
            ('###  uploadpack default\n')
            ('###\n')
            ('GET  /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200\n')
            ('POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -\n')
            ('\n')
            ('###  uploadpack true\n')
            ('###\n')
            ('GET  /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200\n')
            ('POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -\n')
            ('\n')
            ('###  uploadpack false\n')
            ('###\n')
            ('GET  /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 403 -\n')
            ('POST /smart/repo.git/git-upload-pack HTTP/1.1 403 -\n')
            ('\n')
            ('###  receivepack default\n')
            ('###\n')
            ('GET  /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -\n')
            ('POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -\n')
            ('\n')
            ('###  receivepack true\n')
            ('###\n')
            ('GET  /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 200\n')
            ('POST /smart/repo.git/git-receive-pack HTTP/1.1 200 -\n')
            ('\n')
            ('###  receivepack false\n')
            ('###\n')
            ('GET  /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -\n')
            ('POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'server request log matches test results'>)} 
      {
        (SQ <'\n'> <'\tsed -e "\n'> <'\t\ts/^.* \\"//\n'> <'\t\ts/\\"//\n'> <'\t\ts/ [1-9][0-9]*\\$//\n'> 
          <'\t\ts/^GET /GET  /\n'> <'\t" >act <"$HTTPD_ROOT_PATH"/access.log &&\n'> <'\ttest_cmp exp act\n'>
        )
      }
    )
    (C {(stop_httpd)})
    (C {(test_done)})
  ]
)