(command.CommandList children: [ (command.ShFunction name_tok: <warn> name: warn body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Sentence child: (command.Simple blame_tok: <echo> more_env: [] words: [{<echo>} {(DQ <'WARNING: '> ($ Id.VSub_At '@'))}] redirects: [(Redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [{<Id.Lit_LBracket '['>} {<-r>} {<bashttpd.conf>} {<Id.Lit_RBracket ']'>}] redirects: [] do_fork: T ) (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <cat> more_env: [] words: [{<cat>}] redirects: [ (Redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<bashttpd.conf>} ) (Redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(SQ <EOF>)} here_end_tok: <Id.Undefined_Tok ''> stdin_parts: [ <'#\n'> <'# bashttpd.conf - configuration for bashttpd\n'> <'#\n'> <'# The behavior of bashttpd is dictated by the evaluation\n'> <'# of rules specified in this configuration file. Each rule\n'> <'# is evaluated until one is matched. If no rule is matched,\n'> <'# bashttpd will serve a 500 Internal Server Error.\n'> <'#\n'> <'# The format of the rules are:\n'> <'# on_uri_match REGEX command [args]\n'> <'# unconditionally command [args]\n'> <'#\n'> <'# on_uri_match:\n'> <'# On an incoming request, the URI is checked against the specified\n'> < '# (bash-supported extended) regular expression, and if encounters a match the\n' > <'# specified command is executed with the specified arguments.\n'> <'#\n'> < '# For additional flexibility, on_uri_match will also pass the results of the\n' > < '# regular expression match, ${BASH_REMATCH[@]} as additional arguments to the\n' > <'# command.\n'> <'#\n'> <'# unconditionally:\n'> < '# Always serve via the specified command. Useful for catchall rules.\n' > <'#\n'> <'# The following commands are available for use:\n'> <'#\n'> <'# serve_file FILE\n'> <'# Statically serves a single file.\n'> <'#\n'> <'# serve_dir_with_tree DIRECTORY\n'> < '# Statically serves the specified directory using \'tree\'. It must be\n' > <'# installed and in the PATH.\n'> <'#\n'> <'# serve_dir_with_ls DIRECTORY\n'> <'# Statically serves the specified directory using \'ls -al\'.\n'> <'#\n'> <'# serve_dir DIRECTORY\n'> < '# Statically serves a single directory listing. Will use \'tree\' if it is\n' > <'# installed and in the PATH, otherwise, \'ls -al\'\n'> <'#\n'> <'# serve_dir_or_file_from DIRECTORY\n'> < '# Serves either a directory listing (using serve_dir) or a file (using\n' > < '# serve_file). Constructs local path by appending the specified root\n' > <'# directory, and the URI portion of the client request.\n'> <'#\n'> <'# serve_static_string STRING\n'> <'# Serves the specified static string with Content-Type text/plain.\n'> <'#\n'> <'# Examples of rules:\n'> <'#\n'> <'# on_uri_match \'^/issue$\' serve_file "/etc/issue"\n'> <'#\n'> < '# When a client\'s requested URI matches the string \'/issue\', serve them the\n' > <'# contents of /etc/issue\n'> <'#\n'> <'# on_uri_match \'root\' serve_dir /\n'> <'#\n'> < '# When a client\'s requested URI has the word \'root\' in it, serve up\n' > <'# a directory listing of /\n'> <'#\n'> <'# DOCROOT=/var/www/html\n'> <'# on_uri_match \'/(.*)\' serve_dir_or_file_from "$DOCROOT"\n'> <'# When any URI request is made, attempt to serve a directory listing\n'> < '# or file content based on the request URI, by mapping URI\'s to local\n' > <'# paths relative to the specified "$DOCROOT"\n'> <'#\n'> <'\n'> < 'unconditionally serve_static_string \'Hello, world! You can configure bashttpd by modifying bashttpd.conf.\'\n' > <'\n'> <'# More about commands:\n'> <'#\n'> < '# It is possible to somewhat easily write your own commands. An example\n' > <'# may help. The following example will serve "Hello, $x!" whenever\n'> <'# a client sends a request with the URI /say_hello_to/$x:\n'> <'#\n'> <'# serve_hello() {\n'> <'# add_response_header "Content-Type" "text/plain"\n'> <'# send_response_ok_exit <<< "Hello, $2!"\n'> <'# }\n'> <'# on_uri_match \'^/say_hello_to/(.*)$\' serve_hello\n'> <'#\n'> <'# Like mentioned before, the contents of ${BASH_REMATCH[@]} are passed\n'> <'# to your command, so its possible to use regular expression groups\n'> <'# to pull out info.\n'> <'#\n'> < '# With this example, when the requested URI is /say_hello_to/Josh, serve_hello\n' > <'# is invoked with the arguments \'/say_hello_to/Josh\' \'Josh\',\n'> <'# (${BASH_REMATCH[0]} is always the full match)\n'> ] ) ) ] do_fork: T ) (command.Simple blame_tok: <warn> more_env: [] words: [ {<warn>} { (DQ < 'Created bashttpd.conf using defaults. Please review it/configure before running bashttpd again.' > ) } ] redirects: [] do_fork: T ) (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ] ops: [<Id.Op_DPipe _>] ) (command.ShFunction name_tok: <recv> name: recv body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Sentence child: (command.Simple blame_tok: <echo> more_env: [] words: [{<echo>} {(DQ <'< '> ($ Id.VSub_At '@'))}] redirects: [(Redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <send> name: send body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Sentence child: (command.Simple blame_tok: <echo> more_env: [] words: [{<echo>} {(DQ <'> '> ($ Id.VSub_At '@'))}] redirects: [(Redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.Simple blame_tok: <printf> more_env: [] words: [{<printf>} {(SQ <'%s\\r\\n'>)} {(DQ ($ Id.VSub_Star '*'))}] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobEqual left: {($ Id.VSub_DollarName UID)} right: {<0>} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.Simple blame_tok: <warn> more_env: [] words: [{<warn>} {(DQ <'It is not recommended to run bashttpd as root.'>)}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _>] ) (command.ShAssignment left: <Id.Lit_VarLike 'DATE='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'DATE='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'DATE='> name:DATE) op: assign_op.Equal rhs: { (CommandSub left_token: <Id.Left_DollarParen '$('> child: (command.Simple blame_tok: <date> more_env: [] words: [{<date>} {<Id.Lit_Other '+'> (DQ <'%a, %d %b %Y %H:%M:%S %Z'>)}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] redirects: [] ) (command.Simple blame_tok: <declare> more_env: [] words: [ {<declare>} {<-a>} {<Id.Lit_VarLike 'RESPONSE_HEADERS='> (ShArrayLiteral left: <Id.Op_LParen _> words: [ {(DQ <'Date: '> ($ Id.VSub_DollarName DATE))} {(DQ <'Expires: '> ($ Id.VSub_DollarName DATE))} {(DQ <'Server: Slash Bin Slash Bash'>)} ] right: <Id.Right_ShArrayLiteral _> ) } ] redirects: [] do_fork: T ) (command.ShFunction name_tok: <add_response_header> name: add_response_header body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'RESPONSE_HEADERS+='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'RESPONSE_HEADERS+='> lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'RESPONSE_HEADERS+='> name: RESPONSE_HEADERS ) op: assign_op.PlusEqual rhs: { (ShArrayLiteral left: <Id.Op_LParen _> words: [{(DQ ($ Id.VSub_Number 1) <': '> ($ Id.VSub_Number 2))}] right: <Id.Right_ShArrayLiteral _> ) } ) ] redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <declare> more_env: [] words: [ {<declare>} {<-a>} {<Id.Lit_VarLike 'HTTP_RESPONSE='> (word_part.AssocArrayLiteral left: <Id.Op_LParen _> pairs: [ (AssocPair key:{<200>} value:{(DQ <OK>)}) (AssocPair key:{<400>} value:{(DQ <'Bad Request'>)}) (AssocPair key:{<403>} value:{(DQ <Forbidden>)}) (AssocPair key:{<404>} value:{(DQ <'Not Found'>)}) (AssocPair key:{<405>} value:{(DQ <'Method Not Allowed'>)}) (AssocPair key:{<500>} value:{(DQ <'Internal Server Error'>)}) ] right: <Id.Right_ShArrayLiteral _> ) } ] redirects: [] do_fork: T ) (command.ShFunction name_tok: <send_response> name: send_response body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [{<local>} {<Id.Lit_VarLike 'code='> ($ Id.VSub_Number 1)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <send> more_env: [] words: [ {<send>} { (DQ <'HTTP/1.0 '> ($ Id.VSub_Number 1) <' '> (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name HTTP_RESPONSE> var_name: HTTP_RESPONSE bracket_op: (bracket_op.ArrayIndex expr:{($ Id.VSub_Number 1)}) right: <Id.Right_DollarBrace '}'> ) ) } ] redirects: [] do_fork: T ) (command.ForEach keyword: <Id.KW_For for> iter_names: [i] iterable: (for_iter.Words words: [ { (DQ (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name RESPONSE_HEADERS> var_name: RESPONSE_HEADERS bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) right: <Id.Right_DollarBrace '}'> ) ) } ] ) semi_tok: <Id.Op_Semi _> body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.Simple blame_tok: <send> more_env: [] words: [{<send>} {(DQ ($ Id.VSub_DollarName i))}] redirects: [] do_fork: T ) ] right: <Id.KW_Done done> ) redirects: [] ) (command.Simple blame_tok: <send> more_env: [] words: [{<send>}] redirects: [] do_fork: T ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<-r>} {<line>}] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.Simple blame_tok: <send> more_env: [] words: [{<send>} {(DQ ($ Id.VSub_DollarName line))}] redirects: [] do_fork: T ) ] right: <Id.KW_Done done> ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <send_response_ok_exit> name: send_response_ok_exit body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Sentence child: (command.Simple blame_tok: <send_response> more_env: [] words: [{<send_response>} {<200>}] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<0>}) terminator: <Id.Op_Semi _> ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <fail_with> name: fail_with body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <send_response> more_env: [] words: [{<send_response>} {(DQ ($ Id.VSub_Number 1))}] redirects: [ (Redir op: <Id.Redir_TLess '<<<'> loc: (redir_loc.Fd fd:0) arg: { (DQ ($ Id.VSub_Number 1) <' '> (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name HTTP_RESPONSE> var_name: HTTP_RESPONSE bracket_op: (bracket_op.ArrayIndex expr:{($ Id.VSub_Number 1)}) right: <Id.Right_DollarBrace '}'> ) ) } ) ] do_fork: T ) (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <serve_file> name: serve_file body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [{<local>} {<Id.Lit_VarLike 'file='> ($ Id.VSub_Number 1)}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'CONTENT_TYPE='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'CONTENT_TYPE='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'CONTENT_TYPE='> name:CONTENT_TYPE) op: assign_op.Equal rhs: (rhs_word__Empty) ) ] redirects: [] ) (command.Case case_kw: <Id.KW_Case case> to_match: (case_arg.Word w:{(DQ ($ Id.VSub_DollarName file))}) arms_start: <Id.KW_In in> arms: [ (CaseArm left: <Id.Lit_Star '*'> pattern: (pat.Words words: [ {<Id.Lit_Star '*'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\.'> ch: . ) <css> } ] ) middle: <Id.Right_CasePat _> action: [ (command.ShAssignment left: <Id.Lit_VarLike 'CONTENT_TYPE='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'CONTENT_TYPE='> lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'CONTENT_TYPE='> name: CONTENT_TYPE ) op: assign_op.Equal rhs: {(DQ <'text/css'>)} ) ] redirects: [] ) ] right: <Id.Op_DSemi _> ) (CaseArm left: <Id.Lit_Star '*'> pattern: (pat.Words words: [ {<Id.Lit_Star '*'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\.'> ch: . ) <js> } ] ) middle: <Id.Right_CasePat _> action: [ (command.ShAssignment left: <Id.Lit_VarLike 'CONTENT_TYPE='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'CONTENT_TYPE='> lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'CONTENT_TYPE='> name: CONTENT_TYPE ) op: assign_op.Equal rhs: {(DQ <'text/javascript'>)} ) ] redirects: [] ) ] right: <Id.Op_DSemi _> ) (CaseArm left: <Id.Lit_Star '*'> pattern: (pat.Words words:[{<Id.Lit_Star '*'>}]) middle: <Id.Right_CasePat _> action: [ (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<-r>} {<CONTENT_TYPE>}] redirects: [ (Redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: { (CommandSub left_token: <Id.Left_ProcSubIn '<('> child: (command.Simple blame_tok: <file> more_env: [] words: [ {<file>} {<-b>} {<--mime-type>} {(DQ ($ Id.VSub_DollarName file))} ] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] do_fork: T ) ] right: <Id.Op_DSemi _> ) ] arms_end: <Id.KW_Esac esac> redirects: [] ) (command.Sentence child: (command.Simple blame_tok: <add_response_header> more_env: [] words: [ {<add_response_header>} {(DQ <Content-Type>)} {(DQ ($ Id.VSub_DollarName CONTENT_TYPE))} ] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.AndOr children: [ (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<-r>} {<CONTENT_LENGTH>}] redirects: [ (Redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: { (CommandSub left_token: <Id.Left_ProcSubIn '<('> child: (command.Simple blame_tok: <stat> more_env: [] words: [{<stat>} {<-c> (SQ <'%s'>)} {(DQ ($ Id.VSub_DollarName file))}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] do_fork: T ) (command.Simple blame_tok: <add_response_header> more_env: [] words: [ {<add_response_header>} {(DQ <Content-Length>)} {(DQ ($ Id.VSub_DollarName CONTENT_LENGTH))} ] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _>] ) (command.Simple blame_tok: <send_response_ok_exit> more_env: [] words: [{<send_response_ok_exit>}] redirects: [ (Redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_DollarName file))} ) ] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <serve_dir_with_tree> name: serve_dir_with_tree body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [ {<local>} {<Id.Lit_VarLike 'dir='> (DQ ($ Id.VSub_Number 1))} {<tree_vers>} {<tree_opts>} {<basehref>} {<x>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <add_response_header> more_env: [] words: [{<add_response_header>} {(DQ <Content-Type>)} {(DQ <'text/html'>)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<x>} {<tree_vers>} {<x>}] redirects: [ (Redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: { (CommandSub left_token: <Id.Left_ProcSubIn '<('> child: (command.Simple blame_tok: <tree> more_env: [] words: [{<tree>} {<--version>}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] do_fork: T ) (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName tree_vers)} right: {<v1.6> <Id.Lit_Other '*'>} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'tree_opts='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'tree_opts='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tree_opts='> name:tree_opts) op: assign_op.Equal rhs: {(DQ <--du>)} ) ] redirects: [] ) ] ops: [<Id.Op_DAmp _>] ) (command.Simple blame_tok: <send_response_ok_exit> more_env: [] words: [{<send_response_ok_exit>}] redirects: [ (Redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: { (CommandSub left_token: <Id.Left_ProcSubIn '<('> child: (command.Simple blame_tok: <tree> more_env: [] words: [ {<tree>} {<-H>} {(DQ ($ Id.VSub_Number 2))} {<-L>} {<1>} {(DQ ($ Id.VSub_DollarName tree_opts))} {<-D>} {(DQ ($ Id.VSub_DollarName dir))} ] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <serve_dir_with_ls> name: serve_dir_with_ls body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [{<local>} {<Id.Lit_VarLike 'dir='> ($ Id.VSub_Number 1)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <add_response_header> more_env: [] words: [{<add_response_header>} {(DQ <Content-Type>)} {(DQ <'text/plain'>)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <send_response_ok_exit> more_env: [] words: [{<send_response_ok_exit>}] redirects: [ (Redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: { (CommandSub left_token: <Id.Left_ProcSubIn '<('> child: (command.Simple blame_tok: <ls> more_env: [] words: [{<ls>} {<-la>} {(DQ ($ Id.VSub_DollarName dir))}] redirects: [] do_fork: T ) right: <Id.Eof_RParen _> ) } ) ] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <serve_dir> name: serve_dir body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [{<local>} {<Id.Lit_VarLike 'dir='> ($ Id.VSub_Number 1)}] redirects: [] do_fork: T ) (command.AndOr children: [ (command.Simple blame_tok: <which> more_env: [] words: [{<which>} {<tree>}] redirects: [ (Redir op: <Id.Redir_AndGreat '&>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (command.Simple blame_tok: <serve_dir_with_tree> more_env: [] words: [{<serve_dir_with_tree>} {(DQ ($ Id.VSub_At '@'))}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _>] ) (command.Simple blame_tok: <serve_dir_with_ls> more_env: [] words: [{<serve_dir_with_ls>} {(DQ ($ Id.VSub_At '@'))}] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<500>}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <serve_dir_or_file_from> name: serve_dir_or_file_from body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [ {<local>} {<Id.Lit_VarLike 'URL_PATH='> ($ Id.VSub_Number 1) <'/'> ($ Id.VSub_Number 3)} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <shift> more_env: [] words: [{<shift>}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'URL_PATH='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'URL_PATH='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'URL_PATH='> name:URL_PATH) op: assign_op.Equal rhs: { (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name URL_PATH> var_name: URL_PATH suffix_op: (suffix_op.PatSub pat: {<'[^a-zA-Z0-9_~'> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\-'> ch: - ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\.'> ch:.) (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\/'> ch: '/' ) <']'> } replace: {} replace_mode: Id.Lit_Slash slash_tok: <Id.VOp2_Slash _> ) right: <Id.Right_DollarBrace '}'> ) } ) ] redirects: [] ) (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName URL_PATH)} right: {<Id.Lit_Other '*'> <..> <Id.Lit_Other '*'>} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<400>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _>] ) (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.LogicalAnd left: (bool_expr.Unary op_id: Id.BoolUnary_d child: {($ Id.VSub_DollarName URL_PATH)} ) right: (bool_expr.LogicalAnd left: (bool_expr.Unary op_id: Id.BoolUnary_f child: {($ Id.VSub_DollarName URL_PATH) <'/index.html'>} ) right: (bool_expr.Unary op_id: Id.BoolUnary_r child: {($ Id.VSub_DollarName URL_PATH) <'/index.html'>} ) ) ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.ShAssignment left: <Id.Lit_VarLike 'URL_PATH='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'URL_PATH='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'URL_PATH='> name:URL_PATH) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName URL_PATH) <'/index.html'>)} ) ] redirects: [] ) ] ops: [<Id.Op_DAmp _>] ) (command.If if_kw: <Id.KW_If if> arms: [ (IfArm keyword: <Id.KW_If if> cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Unary op_id: Id.BoolUnary_f child: {($ Id.VSub_DollarName URL_PATH)} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Unary op_id: Id.BoolUnary_r child: {($ Id.VSub_DollarName URL_PATH)} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.Simple blame_tok: <serve_file> more_env: [] words: [ {<serve_file>} {(DQ ($ Id.VSub_DollarName URL_PATH))} {(DQ ($ Id.VSub_At '@'))} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<403>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _> <Id.Op_DPipe _>] ) ] spids: [944 955] ) (IfArm keyword: <Id.KW_Elif elif> cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Unary op_id: Id.BoolUnary_d child: {($ Id.VSub_DollarName URL_PATH)} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) terminator: <Id.Op_Semi _> ) ] ) then_kw: <Id.KW_Then then> action: [ (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Unary op_id: Id.BoolUnary_x child: {($ Id.VSub_DollarName URL_PATH)} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.Simple blame_tok: <serve_dir> more_env: [] words: [ {<serve_dir>} {(DQ ($ Id.VSub_DollarName URL_PATH))} {(DQ ($ Id.VSub_At '@'))} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<403>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _> <Id.Op_DPipe _>] ) ] spids: [987 998] ) ] else_action: [] fi_kw: <Id.KW_Fi fi> redirects: [] ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<404>}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <serve_static_string> name: serve_static_string body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <add_response_header> more_env: [] words: [{<add_response_header>} {(DQ <Content-Type>)} {(DQ <'text/plain'>)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <send_response_ok_exit> more_env: [] words: [{<send_response_ok_exit>}] redirects: [ (Redir op: <Id.Redir_TLess '<<<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_Number 1))} ) ] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <on_uri_match> name: on_uri_match body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <local> more_env: [] words: [{<local>} {<Id.Lit_VarLike 'regex='> ($ Id.VSub_Number 1)}] redirects: [] do_fork: T ) (command.Simple blame_tok: <shift> more_env: [] words: [{<shift>}] redirects: [] do_fork: T ) (command.AndOr children: [ (command.DBracket left: <Id.KW_DLeftBracket '[['> expr: (bool_expr.Binary op_id: Id.BoolBinary_EqualTilde left: {($ Id.VSub_DollarName REQUEST_URI)} right: {($ Id.VSub_DollarName regex)} ) right: <Id.Lit_DRightBracket ']]'> redirects: [] ) (command.Simple blame_tok: <Id.Left_DoubleQuote '"'> more_env: [] words: [ {(DQ ($ Id.VSub_At '@'))} { (DQ (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name BASH_REMATCH> var_name: BASH_REMATCH bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At) right: <Id.Right_DollarBrace '}'> ) ) } ] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _>] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <unconditionally> name: unconditionally body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <Id.Left_DoubleQuote '"'> more_env: [] words: [{(DQ ($ Id.VSub_At '@'))} {(DQ ($ Id.VSub_DollarName REQUEST_URI))}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.AndOr children: [ (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<-r>} {<line>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<400>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DPipe _>] ) (command.ShAssignment left: <Id.Lit_VarLike 'line='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'line='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'line='> name:line) op: assign_op.Equal rhs: { (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name line> var_name: line suffix_op: (suffix_op.Unary op: <Id.VOp1_DPercent '%%'> arg_word: { (SingleQuoted left: <Id.Left_DollarSingleQuote '$\''> tokens: [<Id.Char_OneChar '\\r'>] right: <Id.Right_SingleQuote '\''> ) } ) right: <Id.Right_DollarBrace '}'> ) } ) ] redirects: [] ) (command.Simple blame_tok: <recv> more_env: [] words: [{<recv>} {(DQ ($ Id.VSub_DollarName line))}] redirects: [] do_fork: T ) (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<-r>} {<REQUEST_METHOD>} {<REQUEST_URI>} {<REQUEST_HTTP_VERSION>}] redirects: [ (Redir op: <Id.Redir_TLess '<<<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_DollarName line))} ) ] do_fork: T ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName REQUEST_METHOD))} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName REQUEST_URI))} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName REQUEST_HTTP_VERSION))} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<400>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DAmp _> <Id.Op_DAmp _> <Id.Op_DPipe _>] ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName REQUEST_METHOD))} {<Id.Lit_Equals '='>} {(DQ <GET>)} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<405>}] redirects: [] do_fork: T ) ] ops: [<Id.Op_DPipe _>] ) (command.Simple blame_tok: <declare> more_env: [] words: [{<declare>} {<-a>} {<REQUEST_HEADERS>}] redirects: [] do_fork: T ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple blame_tok: <read> more_env: [] words: [{<read>} {<-r>} {<line>}] redirects: [] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'line='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'line='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'line='> name:line) op: assign_op.Equal rhs: { (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name line> var_name: line suffix_op: (suffix_op.Unary op: <Id.VOp1_DPercent '%%'> arg_word: { (SingleQuoted left: <Id.Left_DollarSingleQuote '$\''> tokens: [<Id.Char_OneChar '\\r'>] right: <Id.Right_SingleQuote '\''> ) } ) right: <Id.Right_DollarBrace '}'> ) } ) ] redirects: [] ) (command.Simple blame_tok: <recv> more_env: [] words: [{<recv>} {(DQ ($ Id.VSub_DollarName line))}] redirects: [] do_fork: T ) (command.AndOr children: [ (command.Simple blame_tok: <Id.Lit_LBracket '['> more_env: [] words: [ {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_DollarName line))} {<Id.Lit_RBracket ']'>} ] redirects: [] do_fork: T ) (command.ControlFlow keyword:<Id.ControlFlow_Break break>) ] ops: [<Id.Op_DAmp _>] ) (command.ShAssignment left: <Id.Lit_VarLike 'REQUEST_HEADERS+='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'REQUEST_HEADERS+='> lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'REQUEST_HEADERS+='> name: REQUEST_HEADERS ) op: assign_op.PlusEqual rhs: { (ShArrayLiteral left: <Id.Op_LParen _> words: [{(DQ ($ Id.VSub_DollarName line))}] right: <Id.Right_ShArrayLiteral _> ) } ) ] redirects: [] ) ] right: <Id.KW_Done done> ) redirects: [] ) (command.Simple blame_tok: <source> more_env: [] words: [ {<source>} { (DQ (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name BASH_SOURCE> var_name: BASH_SOURCE bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>}) suffix_op: (suffix_op.Unary op: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>} ) right: <Id.Right_DollarBrace '}'> ) ) <'/bashttpd.conf'> } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <fail_with> more_env: [] words: [{<fail_with>} {<500>}] redirects: [] do_fork: T ) ] )