static int psx_auth_fail(request_rec *r, qEnvApache *renv) { // this is kinda wrong.... but for now we keep it.... if (!r->header_only) { CStr resp = renv->GetCtx()->Eval("http-noauth"); if (!resp.IsEmpty()) { qStrBuf bufin(resp); qStrBuf bufout; renv->GetCtx()->ParseTry(&bufin, &bufout); ap_custom_response(r, HTTP_UNAUTHORIZED, bufout.GetBuffer()); } } if (!ap_auth_type(r)) { ap_table_setn(r->err_headers_out, r->proxyreq ? "Proxy-Authenticate" : "WWW-Authenticate", ap_pstrcat(r->pool, "Basic realm=\"", ap_auth_name(r), "\"", NULL)); } else { ap_note_basic_auth_failure(r); } renv->Free(); ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, AP2STATUS r, "returning unauthorized: %d, status : %d", HTTP_UNAUTHORIZED, r->status); return HTTP_UNAUTHORIZED; }
/** * Load the ".INI" file from the given input stream. * @param in stream to read file from. * @return Created INI file. * @throw Exception For any error (IO or format). */ File *File::load(io::InStream *in) throw (Exception) { File *file = new File(); Section *sect = file->defaultSection(); io::BufferedInStream bufin(*in); io::Input input(bufin); try { // read all lines int num = 1; while(true) { // read the line bool ended = false; string line; while(true) { line = line + input.scanLine(); num++; if(!line) { ended = true; break; } while(line[line.length() - 1] == '\n' || line[line.length() - 1] == '\r') line = line.substring(0, line.length() - 1); if(line[line.length() - 1] != '\\') break; line = line.substring(0, line.length() - 1); } if(ended) break; // empty line? if(!line) continue; // is it a comment? if(line[0] == ';') continue; // is it a section? if(line[0] == '[') { if(line[line.length() - 1] != ']') throw Exception(_ << num << ": malformed section name"); sect = new Section(line.substring(1, line.length() - 2)); file->sects.put(sect->name(), sect); continue; } // is it a key/value pair? int p = line.indexOf('='); if(p >= 0) { sect->values.put(line.substring(0, p), line.substring(p + 1)); continue; } // syntax error? throw Exception(_ << num << ": garbage here"); } } catch(io::IOException& e) { delete file; throw Exception(e.message()); } return file; }