(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ (Token id:Id.Lit_Chars val:'test git-http-backend' span_id:6))}
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) (/lib-httpd.sh)})
    (C {(start_httpd)})
    (command.ShFunction
      name: GET
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [
                    {(curl)}
                    {(--include)}
                    {
                      (DQ ($ Id.VSub_DollarName '$HTTPD_URL') (/) ($ Id.VSub_DollarName '$SMART') 
                        (/repo.git/) ($ Id.VSub_Number '$1')
                      )
                    }
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:42)
                      fd: -1
                      arg_word: {(out)}
                    )
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'2>' span_id:45)
                      fd: 2
                      arg_word: {(/dev/null)}
                    )
                  ]
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [{(tr)} {(SQ (Token id:Id.Lit_Chars val:'\\015' span_id:54))} {(Q)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Less val:'<' span_id:59)
                          fd: -1
                          arg_word: {(out)}
                        )
                      ]
                    )
                    (command.Simple
                      words: [
                        {(sed)}
                        {
                          (SQ (Token id:Id.Lit_Chars val:'\n' span_id:68) 
                            (Token
                              id: Id.Lit_Chars
                              val: '\t\ts/Q$//\n'
                              span_id: 69
                            ) (Token id:Id.Lit_Chars val:'\t\t1q\n' span_id:70) (Token id:Id.Lit_Chars val:'\t' span_id:71)
                          )
                        }
                      ]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Great val:'>' span_id:74)
                          fd: -1
                          arg_word: {(act)}
                        )
                      ]
                    )
                  ]
                  negated: F
                )
                (command.Simple
                  words: [{(echo)} {(DQ ('HTTP/1.1 ') ($ Id.VSub_Number '$2'))}]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:87)
                      fd: -1
                      arg_word: {(exp)}
                    )
                  ]
                )
                (C {(test_cmp)} {(exp)} {(act)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: POST
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [
                    {(curl)}
                    {(--include)}
                    {(--data)}
                    {(DQ ($ Id.VSub_Number '$2'))}
                    {(--header)}
                    {(DQ ('Content-Type: application/x-') ($ Id.VSub_Number '$1') (-request))}
                    {
                      (DQ ($ Id.VSub_DollarName '$HTTPD_URL') (/smart/repo.git/) 
                        ($ Id.VSub_Number '$1')
                      )
                    }
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:137)
                      fd: -1
                      arg_word: {(out)}
                    )
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'2>' span_id:140)
                      fd: 2
                      arg_word: {(/dev/null)}
                    )
                  ]
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [{(tr)} {(SQ (Token id:Id.Lit_Chars val:'\\015' span_id:149))} {(Q)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Less val:'<' span_id:154)
                          fd: -1
                          arg_word: {(out)}
                        )
                      ]
                    )
                    (command.Simple
                      words: [
                        {(sed)}
                        {
                          (SQ (Token id:Id.Lit_Chars val:'\n' span_id:163) 
                            (Token
                              id: Id.Lit_Chars
                              val: '\t\ts/Q$//\n'
                              span_id: 164
                            ) (Token id:Id.Lit_Chars val:'\t\t1q\n' span_id:165) (Token id:Id.Lit_Chars val:'\t' span_id:166)
                          )
                        }
                      ]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Great val:'>' span_id:169)
                          fd: -1
                          arg_word: {(act)}
                        )
                      ]
                    )
                  ]
                  negated: F
                )
                (command.Simple
                  words: [{(echo)} {(DQ ('HTTP/1.1 ') ($ Id.VSub_Number '$3'))}]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:182)
                      fd: -1
                      arg_word: {(exp)}
                    )
                  ]
                )
                (C {(test_cmp)} {(exp)} {(act)})
              ]
            )
          ]
        )
    )
    (C {(.)} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) (/t556x_common)})
    (command.Simple
      words: [{(grep)} {(SQ (Token id:Id.Lit_Chars val:'^[^#]' span_id:208))}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:211) fd:-1 arg_word:{(exp)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:214)
          fd: -1
          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/')
            ($ Id.VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ Id.VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ Id.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/')
            ($ Id.VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/')
            ($ Id.VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 404 -\n')
            ('GET  /smart_noexport/repo.git/')
            ($ Id.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/')
            ($ Id.VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/')
            ($ Id.VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart_noexport/repo.git/')
            ($ Id.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/')
            ($ Id.VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ Id.VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 200\n')
            ('GET  /smart/repo.git/')
            ($ Id.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/')
            ($ Id.VSub_DollarName '$LOOSE_URL')
            (' HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/')
            ($ Id.VSub_DollarName '$PACK_URL')
            (' HTTP/1.1 403 -\n')
            ('GET  /smart/repo.git/')
            ($ Id.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 (Token id:Id.Lit_Chars val:'server request log matches test results' span_id:341))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:345) 
          (Token id:Id.Lit_Chars val:'\tsed -e "\n' span_id:346) (Token id:Id.Lit_Chars val:'\t\ts/^.* \\"//\n' span_id:347) 
          (Token id:Id.Lit_Chars val:'\t\ts/\\"//\n' span_id:348) (Token id:Id.Lit_Chars val:'\t\ts/ [1-9][0-9]*\\$//\n' span_id:349) 
          (Token id:Id.Lit_Chars val:'\t\ts/^GET /GET  /\n' span_id:350) (Token id:Id.Lit_Chars val:'\t" >act <"$HTTPD_ROOT_PATH"/access.log &&\n' span_id:351) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp exp act\n' span_id:352)
        )
      }
    )
    (C {(stop_httpd)})
    (C {(test_done)})
  ]
)