Work on the CGI handling.

This commit is contained in:
Brad Arant committed 2024-11-11 15:59:42 -08:00
1 parent 496b90a680
commit 39f5936787
5 files changed
+41 -2

No files matched your search

+9 -2
View File
@@ -5,14 +5,21 @@
namespace jet {
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
if(variables["cgi"] == "true") {
if(variableDefined("cgi"))
resolveKeyword("cgi");
if(variables["cgi"] == "true") {
coreutils::ZString requestMethod(getenv("REQUEST_METHOD"));
if(requestMethod == "POST") {
coreutils::ZString contentLength(getenv("CONTENT_LENGTH"));
coreutils::ZString contentType(getenv("CONTENT_TYPE"));
coreutils::MString postdata;
postdata.read(0);
std::cout << postdata << std::endl;
coreutils::IMFRequest request(postdata);
coreutils::IMFMessage message(postdata);
if(contentType == "multipart/form-data")
+2
View File
@@ -3,6 +3,8 @@
#include "Tag.h"
#include "ZString.h"
#include "IMFRequest.h"
#include "IMFMessage.h"
#include <sstream>
namespace jet {
+21
View File
@@ -0,0 +1,21 @@
POST /cgi-bin/qtest HTTP/1.1
Content-Type: multipart/form-data;
boundary=2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f
Content-Length: 514
--2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f
Content-Disposition: form-data; name="datafile1"; filename="r.gif"
Content-Type: image/gif
GIF87a.............,...........D..;
--2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f
Content-Disposition: form-data; name="datafile2"; filename="g.gif"
Content-Type: image/gif
GIF87a.............,...........D..;
--2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f
Content-Disposition: form-data; name="datafile3"; filename="b.gif"
Content-Type: image/gif
GIF87a.............,...........D..;
--2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f--
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
export REQUEST_METHOD=POST
export CONTENT_LENGTH=554
export CONTENT_TYPE=multipart/form-data
cat post.example | ./testpost.jet
+4
View File
@@ -0,0 +1,4 @@
#!../jet-2.0
<jet cgi="true">
</jet>