multipart/formdata now works for cgi variables. Created base for dump tag.

This commit is contained in:
brad Arant 2024-11-24 11:20:30 -08:00
parent c21dea1411
commit c90c7353c7
6 changed files with 43 additions and 132 deletions

View File

@ -73,7 +73,11 @@ namespace jet {
renderVariableName(variable, name, modifier, lvariables); renderVariableName(variable, name, modifier, lvariables);
return variables[name]; return variables[name];
} if(variable.ifNext(":")) { } if(variable.ifNext(":")) {
// TODO: should only allow CGI variable name. Allow variable substitution. renderVariableName(variable, name, modifier, lvariables);
if(name.find(":") == -1) {
name << ":0";
}
return processModifier(cgiVariables[name], modifier);
} if(variable.ifNext("@")) { } if(variable.ifNext("@")) {
// TODO: should only allow session variables. Allow substitution. // TODO: should only allow session variables. Allow substitution.
} if(variable.ifNext("%")) { } if(variable.ifNext("%")) {
@ -103,8 +107,9 @@ namespace jet {
if(variable.ifNext(";")) { if(variable.ifNext(";")) {
renderVariableName(variable, modifier, modifier, lvariables); renderVariableName(variable, modifier, modifier, lvariables);
return; return;
} } else if(variable.ifNext(":")) {
else if(variable.startsWith("$[") || variable.startsWith("#[")) name << ":";
} else if(variable.startsWith("$[") || variable.startsWith("#["))
name << getVariable(variable, lvariables); name << getVariable(variable, lvariables);
else if(variable.ifNext("]")) else if(variable.ifNext("]"))
return; return;
@ -151,8 +156,14 @@ namespace jet {
coreutils::ZString data = formdata.getTokenExclude("-"); // TODO: Fix this parsing. Need a string exclusion method to check for 'boundary'. coreutils::ZString data = formdata.getTokenExclude("-"); // TODO: Fix this parsing. Need a string exclusion method to check for 'boundary'.
data.trimCRLF(); data.trimCRLF();
formdata.ifNext(boundary); formdata.ifNext(boundary);
cgiVariables[name] = data; int index = 0;
std::cout << name << ":[" << data << "]" << std::endl; coreutils::MString namex;
do {
namex = "";
namex << name << ":" << index++;
} while(cgiVariables.count(namex) != 0);
cgiVariables[namex] = data;
// std::cout << namex << ":[" << data << "]" << std::endl;
if(formdata.ifNext("--")) if(formdata.ifNext("--"))
break; break;
formdata.goeol(); formdata.goeol();

View File

@ -27,7 +27,7 @@ namespace jet {
void setupFormData(coreutils::ZString &formdata); void setupFormData(coreutils::ZString &formdata);
std::map<coreutils::MString, coreutils::MString> variables; std::map<coreutils::MString, coreutils::MString> variables;
std::map<coreutils::ZString, coreutils::ZString> cgiVariables; std::map<coreutils::MString, coreutils::MString> cgiVariables;
std::map<coreutils::MString, __mysql *> sessions; std::map<coreutils::MString, __mysql *> sessions;
std::map<coreutils::MString, coreutils::MString> headers; std::map<coreutils::MString, coreutils::MString> headers;
std::map<coreutils::MString, coreutils::MString> tags; std::map<coreutils::MString, coreutils::MString> tags;

View File

@ -1,127 +1,17 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.6.24) 1 NOV 2024 14:40 This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdfetex 2024.11.17) 24 NOV 2024 10:04
entering extended mode entering extended mode
restricted \write18 enabled. restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled. %&-line parsing enabled.
**JetCore.txt **\input ./JetCore.txt
(./JetCore.txt (./JetCore.txt
LaTeX2e <2023-11-01> patch level 1 ./JetCore.txt:1: Undefined control sequence.
L3 programming layer <2024-01-22> l.1 \documentclass
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls {book}
Document Class: book 2023/05/17 v1.4n Standard LaTeX document class ?
(/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo ./JetCore.txt:1: Emergency stop.
File: bk10.clo 2023/05/17 v1.4n Standard LaTeX file (size option) l.1
)
\c@part=\count187
\c@chapter=\count188
\c@section=\count189
\c@subsection=\count190
\c@subsubsection=\count191
\c@paragraph=\count192
\c@subparagraph=\count193
\c@figure=\count194
\c@table=\count195
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen140
)
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2024-01-04 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count196
\l__pdf_internal_box=\box51
)
(./JetCore.aux)
\openout1 = `JetCore.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 7. End of file on the terminal!
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 9.
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2
]
(./JetCore.toc
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 4.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 4.
[3])
\tf@toc=\write3
\openout3 = `JetCore.toc'.
[4]
Chapter 1.
[5
] [6
]
Chapter 2.
[7] [8
]
Chapter 3.
[9{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc}] [10
]
Chapter 4.
Overfull \hbox (8.39041pt too wide) in paragraph at lines 100--100
[]\OT1/cmr/bx/n/12 substring(string, start-position, number-of-characters
[]
[11] [12
]
Chapter 5.
[13] [14
]
Chapter 6.
[15] [16] [17] [18] (./JetCore.aux)
***********
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-01-22>
***********
)
Here is how much of TeX's memory you used:
508 strings out of 476182
9280 string characters out of 5795595
1932975 words of memory out of 5000000
22573 multiletter control sequences out of 15000+600000
564392 words of font info for 57 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
35i,6n,50p,185b,189s stack positions out of 10000i,1000n,20000p,200000b,200000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></us
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/shar
e/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texli
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share/texlive/texm
f-dist/fonts/type1/public/amsfonts/cm/cmr17.pfb></usr/share/texlive/texmf-dist/
fonts/type1/public/amsfonts/cm/cmsl10.pfb></usr/share/texlive/texmf-dist/fonts/
type1/public/amsfonts/cm/cmtt10.pfb></usr/share/texmf/fonts/type1/public/cm-sup
er/sfrm1000.pfb>
Output written on JetCore.pdf (18 pages, 126208 bytes).
PDF statistics:
103 PDF objects out of 1000 (max. 8388607)
66 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
./JetCore.txt:1: ==> Fatal error occurred, no output PDF file produced!

View File

@ -1,5 +1,4 @@
\documentclass{book} \documentclass{book}
\title{JET Extension Tags} \title{JET Extension Tags}
\author{Bradford Matthew Arant Sr.} \author{Bradford Matthew Arant Sr.}
\date{\today} \date{\today}
@ -193,6 +192,15 @@ used for making comments and is ignored by the jet reader.
The comments tag has no attributes. The comments tag has no attributes.
\section{dump}
Use the dump tag to display the contents of all the global, local and
cgi cariables to a specified file.
The attributes are:
file
\section{expr} \section{expr}
\section{for} \section{for}

View File

@ -19,7 +19,7 @@ Content-Disposition: form-data; name="name"
5 5
------WebKitFormBoundaryA1LWIjMAIsdFW9XA ------WebKitFormBoundaryA1LWIjMAIsdFW9XA
Content-Disposition: form-data; name="name" Content-Disposition: form-data; name="name2"
6 6
------WebKitFormBoundaryA1LWIjMAIsdFW9XA-- ------WebKitFormBoundaryA1LWIjMAIsdFW9XA--

View File

@ -1,4 +1,6 @@
#!../jet-2.0 #!../jet-2.0
<jet cgi="true"> <jet cgi="true">
$[:name]
$[:name:3;tohex]
$[:name2;tohex]
</jet> </jet>