jbe@456: --[[-- jbe@456: value = -- value of header as string containing comma (and space) separated values jbe@456: request.get_header( jbe@456: key -- name of header, e.g. "Authorization" jbe@456: ) jbe@456: jbe@457: Returns the value of an HTTP header sent by the client. If the header occurs multiple times, the values are concatenated with a comma and zero or more space characters (e.g. "value1, value2"). If the header is missing, nil is returned. jbe@456: jbe@456: --]]-- jbe@456: jbe@456: function request.get_header(key) jbe@457: local http_request = request._http_request jbe@458: local values = http_request.headers[key] jbe@457: if #values == 0 then jbe@457: return nil jbe@457: elseif #values == 1 then jbe@457: return values[1] jbe@457: else jbe@458: return http_request.headers_csv_string[key] jbe@457: end jbe@456: end