lua_apr.c revision b2c17021012bc4f7cd8e374c6bd72b926737320f
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * Licensed to the Apache Software Foundation (ASF) under one or more
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * contributor license agreements. See the NOTICE file distributed with
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * this work for additional information regarding copyright ownership.
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * The ASF licenses this file to You under the Apache License, Version 2.0
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * (the "License"); you may not use this file except in compliance with
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * the License. You may obtain a copy of the License at
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * Unless required by applicable law or agreed to in writing, software
a530dde7009b0a808300c420def741354a4d13d2Martin Kühl * distributed under the License is distributed on an "AS IS" BASIS,
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * See the License for the specific language governing permissions and
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco * limitations under the License.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riescoreq_table_t *ap_lua_check_apr_table(lua_State *L, int index)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riescovoid ap_lua_push_apr_table(lua_State *L, req_table_t *t)
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco req_table_t *t = ap_lua_check_apr_table(L, 1);
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco /* Unless it's the 'notes' table, check for newline chars */
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco /* t->r will be NULL in case of the connection notes, but since
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco we aren't going to check anything called 'notes', we can safely
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco disregard checking whether t->r is defined.
223be434693e8c97e2522ac19155a284b3536035Adrián Riesco if (strcmp(t->n, "notes") && ap_strchr_c(val, '\n')) {
51c15129e8118fed5c33c334f8df82619ce98e7dAdrián Riesco char *replacement = apr_pstrdup(t->r->pool, val);
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco while ( (badchar = ap_strchr(badchar, '\n')) ) {
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, t->r, APLOGNO(02614)
5318901bb69bf247e0f341312c800ba4ea87e46bAdrián Riesco "mod_lua: Value for '%s' in table '%s' contains newline!",
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco req_table_t *t = ap_lua_check_apr_table(L, 1);