Work on the CGI handling.
This commit is contained in:
parent
496b90a680
commit
39f5936787
@ -5,13 +5,20 @@
|
|||||||
namespace jet {
|
namespace jet {
|
||||||
|
|
||||||
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
|
__jet::__jet(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
|
||||||
|
if(variableDefined("cgi"))
|
||||||
|
resolveKeyword("cgi");
|
||||||
if(variables["cgi"] == "true") {
|
if(variables["cgi"] == "true") {
|
||||||
coreutils::ZString requestMethod(getenv("REQUEST_METHOD"));
|
coreutils::ZString requestMethod(getenv("REQUEST_METHOD"));
|
||||||
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"));
|
||||||
|
|
||||||
|
coreutils::MString postdata;
|
||||||
|
postdata.read(0);
|
||||||
|
std::cout << postdata << std::endl;
|
||||||
|
|
||||||
|
coreutils::IMFRequest request(postdata);
|
||||||
|
coreutils::IMFMessage message(postdata);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
__jet.h
2
__jet.h
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "Tag.h"
|
#include "Tag.h"
|
||||||
#include "ZString.h"
|
#include "ZString.h"
|
||||||
|
#include "IMFRequest.h"
|
||||||
|
#include "IMFMessage.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace jet {
|
namespace jet {
|
||||||
|
21
tests/post.example
Normal file
21
tests/post.example
Normal 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
tests/posttest.sh
Executable file
5
tests/posttest.sh
Executable 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
tests/testpost.jet
Executable file
4
tests/testpost.jet
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!../jet-2.0
|
||||||
|
<jet cgi="true">
|
||||||
|
|
||||||
|
</jet>
|
Loading…
x
Reference in New Issue
Block a user