Still working out cgi variable stuff.

This commit is contained in:
Brad Arant 2025-12-10 16:48:23 -08:00
parent e6ebb34366
commit d0f2551e89
2 changed files with 10 additions and 6 deletions

13
Tag.cpp
View File

@ -407,11 +407,14 @@ namespace jet {
else else
return parent->keywords[name]; return parent->keywords[name];
} else if(variable.ifNext(":")) { } else if(variable.ifNext(":")) {
renderVariableName(variable, name, modifier); if(global.cgi) {
if(name.find(":") == -1) { renderVariableName(variable, name, modifier);
name << ":0"; if(name.find(":") == -1) {
} name << ":0";
return processModifier(global.cgiData[name], modifier); }
return processModifier(global.cgiData[name], modifier);
} else
throw coreutils::Exception("cgi variable only allowed in cgi mode.");
} else if(variable.ifNext("@")) { } else if(variable.ifNext("@")) {
// TODO: should only allow session variables. Allow substitution. // TODO: should only allow session variables. Allow substitution.
} else if(variable.ifNext("%")) { } else if(variable.ifNext("%")) {

View File

@ -35,8 +35,9 @@ namespace jet {
if(requestMethod == "POST") { if(requestMethod == "POST") {
coreutils::ZString contentLength(getenv("CONTENT_LENGTH")); coreutils::ZString contentLength(getenv("CONTENT_LENGTH"));
coreutils::ZString contentType(getenv("CONTENT_TYPE")); coreutils::ZString contentType(getenv("CONTENT_TYPE"));
ZString boundary = "xxxx";
global.cgiData = new coreutils::CGIFormData(0, contentType, contentLength, boundary); global.cgiData = new coreutils::CGIFormData(0, contentType, contentLength.asInteger(), boundary);
} }
} }
processContainer(container, NULL, true); processContainer(container, NULL, true);