work on cgi.
This commit is contained in:
parent
ce6b163d5d
commit
c0f44a3bc5
15
__jet.cpp
15
__jet.cpp
@ -2,6 +2,7 @@
|
|||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
namespace jet {
|
namespace jet {
|
||||||
|
|
||||||
@ -9,7 +10,8 @@ namespace jet {
|
|||||||
if(keywordDefined("cgi") && (resolveKeyword("cgi") == "true")) {
|
if(keywordDefined("cgi") && (resolveKeyword("cgi") == "true")) {
|
||||||
global.cgi = true;
|
global.cgi = true;
|
||||||
|
|
||||||
cookies = getenv("HTTP_COOKIE");
|
char *cookies = getenv("HTTP_COOKIE");
|
||||||
|
std::cout << cookies << std::endl;
|
||||||
|
|
||||||
if(keywordDefined("sessiondir")) {
|
if(keywordDefined("sessiondir")) {
|
||||||
global.session = true;
|
global.session = true;
|
||||||
@ -20,14 +22,15 @@ namespace jet {
|
|||||||
// else
|
// else
|
||||||
// generate new session id.
|
// generate new session id.
|
||||||
// create session cookie in response.
|
// create session cookie in response.
|
||||||
char hashit[64];
|
unsigned char hashit[64];
|
||||||
char hash[32];
|
unsigned char hash[SHA_DIGEST_LENGTH];
|
||||||
sprintf(hashit, "JETSESSION%ld", time(0));
|
char hashname[64];
|
||||||
SHA1(hashit, strlen(hashit), hash);
|
sprintf((char *)hashit, "JETSESSION%ld", time(0));
|
||||||
|
SHA1(hashit, strlen((char *)hashit), hash);
|
||||||
sprintf(hashname, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
sprintf(hashname, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
|
||||||
hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8], hash[9],
|
hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8], hash[9],
|
||||||
hash[10], hash[11], hash[12], hash[13], hash[14], hash[15], hash[16], hash[17], hash[18], hash[19]);
|
hash[10], hash[11], hash[12], hash[13], hash[14], hash[15], hash[16], hash[17], hash[18], hash[19]);
|
||||||
coreutils::ZString sessionCookie(hash);
|
coreutils::ZString sessionCookie(hashname);
|
||||||
global.headers[keywords["Set-Cookie"]] << "session=" << sessionCookie;
|
global.headers[keywords["Set-Cookie"]] << "session=" << sessionCookie;
|
||||||
if(keywordDefined("sessiontimeout")) {
|
if(keywordDefined("sessiontimeout")) {
|
||||||
time_t timeout = time(0) + keywords["sessiontimeout"].asInteger();
|
time_t timeout = time(0) + keywords["sessiontimeout"].asInteger();
|
||||||
|
2
compile
2
compile
@ -18,7 +18,7 @@ done
|
|||||||
|
|
||||||
wait
|
wait
|
||||||
echo -n "Building executable jet-2.0..."
|
echo -n "Building executable jet-2.0..."
|
||||||
g++ -g -o jet-2.0 $list -std=c++23 -L../CoreUtils -lCoreUtils -lmysqlclient
|
g++ -g -o jet-2.0 $list -std=c++23 -L../CoreUtils -lCoreUtils -lmysqlclient -lcrypto
|
||||||
if [ $? = '0' ]
|
if [ $? = '0' ]
|
||||||
then
|
then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user