JetCore engine (Tag.cpp/.h, Global.cpp/.h, __*.cpp tag classes): - Numerous __mysql.cpp connection-pooling correctness fixes (stale result sets, double-indirection sessionid bugs, field caching, pool keying) and a session-registration-before-connection-confirmed ordering fix (dangling pointer on a failed connect) - Tag.cpp: large body of fixes to the tag-dispatch/container-scanning logic (bare-name fallback, database aliasing, single-quote handling, @-prefix session variable resolution, TAGDEF caching, nested split-tag scanning for if/while/until/ifrow so an inner one doesn't corrupt an outer one's own boundary scan) plus the process-first rendering order fix (a <process> now runs before <checksession>/page resolution, fixing a real "blank page after successful login" bug) - Global.h/.cpp: added imapSessions (parallel to the existing __mysql* session map) for the new <imap> tag family - __whiledir.cpp/__include.cpp: caching and directory-name-aliasing fixes - __call.cpp/.h: fixed a dangling-pointer bug - __write.cpp: fixed an O_WRONLY-only open that couldn't create a new file - __ifrow.cpp/__sql.cpp: fixed the same sessionid double-indirection bug __mysql.cpp had (resolveKeyword's result was being used as a map key lookup instead of the resolved value itself) jetc compiler (jetc/JetParser.cpp/.h, JetCodegen.cpp/.h, JetAST.h, jetc.cpp, build-shared.sh, build-compiled.sh): - Parser fixes: inline <include>, nested-quote handling, void-tag recognition - Codegen fixes and expanded AST support - build-shared.sh: atomic rename into place for a freshly-built .jtc (a live server dlopen()ing the same path mid-rebuild was corrupting its own already-mapped view of the old file) and a staleness check so a cached JetCore .o doesn't silently keep serving yesterday's fixes forever - Added -lssl to both build scripts' link lines (needed once the new <imap> tag's client-side TLS code existed - previously nothing in this codebase used OpenSSL's SSL/TLS client API, only libcrypto) Site content (jetc/barant-site/): SPA (fetch-and-swap navigation) rollout across essentially every .page/.jet/.section/.tag/.proc/.method file - dynamic-content fixes, fragment-mode stripping, native $[@name] session variables replacing older mechanisms, and this session's own checkout.page redesign, login start-param redirect fix, and per-page side-menu (menu.bar/$[PAGE].menu) refresh support. Completed the earlier main.css/control.css move from assets/ to assets/images/ (git still showed the old paths as tracked-but-deleted until now). Deliberately left out of this commit: dozens of .pre-<description>- <date> manual backup files (this session's and earlier ones' own before/after snapshots, not meant for permanent history), compiled .jtc build outputs, ad hoc test binaries and scripts under jetc/ (login_asan, wcwc_test, optest2_bin, etc.), and jetc/__pycache__/ - none of these are meant to be tracked; a .gitignore covering them would be worth adding separately.
96 lines
3.6 KiB
C++
96 lines
3.6 KiB
C++
#ifndef __Global_h__
|
|
# define __Global_h__
|
|
|
|
# include "MString.h"
|
|
# include "CGIFormattedData.h"
|
|
# include "CGIFormData.h"
|
|
# include "StreamReader.h"
|
|
# include "JFile.h"
|
|
# include <map>
|
|
|
|
namespace jet {
|
|
|
|
class __mysql;
|
|
class __imap;
|
|
class Tag;
|
|
|
|
class Global {
|
|
|
|
public:
|
|
Global(char **envp);
|
|
virtual ~Global();
|
|
|
|
void dump();
|
|
bool sessionExists(coreutils::MString sessionId);
|
|
void addSession(coreutils::MString sessionId, __mysql *mysql);
|
|
void removeSession(coreutils::MString sessionId);
|
|
__mysql * getSession(coreutils::MString sessionId);
|
|
bool imapSessionExists(coreutils::MString sessionId);
|
|
void addImapSession(coreutils::MString sessionId, __imap *imap);
|
|
void removeImapSession(coreutils::MString sessionId);
|
|
__imap * getImapSession(coreutils::MString sessionId);
|
|
coreutils::ZString getSessionVariable(coreutils::MString &splitName);
|
|
void outputHeaders();
|
|
void setupFormData(coreutils::ZString &formdata);
|
|
void setupFormURLEncoded(coreutils::ZString &formdata);
|
|
char *errorCursor = NULL;
|
|
|
|
coreutils::CGIFormattedData cookies;
|
|
|
|
///
|
|
/// cgiReader backs cgiData below - it must outlive it, since
|
|
/// CGIFormData (a Parser) only holds a reference to it, not its own
|
|
/// copy of the request body. Declared before cgiData so it's
|
|
/// constructed first and destroyed last (member destruction order
|
|
/// mirrors declaration order).
|
|
///
|
|
|
|
coreutils::StreamReader cgiReader;
|
|
coreutils::CGIFormData *cgiData = NULL;
|
|
|
|
///
|
|
/// sessionFile backs $[@name] (read) and <set name="@name" .../>
|
|
/// (write) - a JSON file at sessiondir/<sessionId>.json, loaded when
|
|
/// opened and saved automatically when destroyed (JFile/MFile's own
|
|
/// RAII behavior - see MFile.cpp). NULL unless cgi mode and the
|
|
/// sessiondir keyword are both active for this request.
|
|
///
|
|
|
|
coreutils::JFile *sessionFile = NULL;
|
|
std::map<coreutils::MString, coreutils::MString> variables;
|
|
std::map<coreutils::MString, __mysql *> sessions;
|
|
std::map<coreutils::MString, coreutils::MString> headers;
|
|
std::map<coreutils::MString, coreutils::MString> tags;
|
|
|
|
// Populated once per compiled .jtc module's own entry function (see
|
|
// jetc's TAGDEF codegen) - a top-level <tag name="X"> definition
|
|
// that jetc could compile directly registers its own render
|
|
// function here under its lowercase name, same key convention as
|
|
// `tags` above. __dotag checks this first before falling back to
|
|
// the text-based findTagDefinition()/processContainer() path (see
|
|
// __dotag.cpp), avoiding a full re-parse of the definition's body
|
|
// on every invocation. A miss here (a locally-scoped/nested tag
|
|
// definition, or content that was never compiled at all) is always
|
|
// safe - it just means the existing interpreted path runs exactly
|
|
// as it always has; this is a pure additive fast path, never a
|
|
// replacement for `tags`, which every TAGDEF still populates too.
|
|
std::map<coreutils::MString, void(*)(Tag&, coreutils::MString&)> compiledTags;
|
|
|
|
char **envp;
|
|
bool cgi = false;
|
|
bool session = false;
|
|
coreutils::MString sessionId;
|
|
|
|
// Deliberately the LAST member declared in Global - appended
|
|
// here, after every pre-existing field, rather than inserted
|
|
// earlier among them, so this addition does not shift the
|
|
// memory offset of any field that existed before it. See
|
|
// __imap.h for what registers here.
|
|
std::map<coreutils::MString, __imap *> imapSessions;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|