-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from ErnestoAvedillo/Change-cgi-in-all-Location
Change cgi in all location, cookies, norma and cgi environments
- Loading branch information
Showing
46 changed files
with
1,084 additions
and
828 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* Environment.hpp :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: eavedill <eavedill@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/06/30 13:47:48 by eavedill #+# #+# */ | ||
/* Updated: 2024/06/30 14:57:33 by eavedill ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#pragma once | ||
#include <iostream> | ||
#include <string> | ||
#include <map> | ||
#include <vector> | ||
#include "ExtendedString.hpp" | ||
|
||
#define SCRIPT_FILENAME_KEY "SCRIPT_FILENAME" | ||
#define QUERY_STRING_KEY "QUERY_STRING" | ||
#define REQUEST_METHOD_KEY "REQUEST_METHOD" | ||
#define CONTENT_TYPE_KEY "CONTENT_TYPE" | ||
#define CONTENT_LENGTH_KEY "CONTENT_LENGTH" | ||
#define GATEWAY_INTERFACE_KEY "GATEWAY_INTERFACE" | ||
#define SERVER_SOFTWARE_KEY "SERVER_SOFTWARE" | ||
#define REMOTE_ADDR_KEY "REMOTE_ADDR" | ||
#define REMOTE_PORT_KEY "REMOTE_PORT" | ||
#define SERVER_ADDR_KEY "SERVER_ADDR" | ||
#define SERVER_PORT_KEY "SERVER_PORT" | ||
#define CONTENT_LENGTH_KEY "CONTENT_LENGTH" | ||
#define CONTENT_TYPE_KEY "CONTENT_TYPE" | ||
#define SERVER_NAME_KEY "SERVER_NAME" | ||
#define HTTP_HOST_KEY "HTTP_HOST" | ||
#define HTTP_USER_AGENT_KEY "HTTP_USER_AGENT" | ||
#define HTTP_ACCEPT_KEY "HTTP_ACCEPT" | ||
#define HTTP_ACCEPT_LANGUAGE_KEY "HTTP_ACCEPT_LANGUAGE" | ||
#define HTTP_ACCEPT_ENCODING_KEY "HTTP_ACCEPT_ENCODING" | ||
#define HTTP_COOKIE_KEY "HTTP_COOKIE" | ||
#define HTTP_CONNECTION_KEY "HTTP_CONNECTION" | ||
#define HTTP_UPGRADE_INSECURE_REQUESTS_KEY "HTTP_UPGRADE_INSECURE_REQUESTS" | ||
#define PATH_INFO_KEY "PATH_INFO" | ||
|
||
|
||
class Environment | ||
{ | ||
private: | ||
std::map<std::string, std::string> _env; | ||
std::vector<char*> _envArray; | ||
public: | ||
Environment(); | ||
~Environment(); | ||
void setEnv(const std::string $key, const std::string $value); | ||
std::vector<char*> getEnv(); | ||
std::string getEnv(std::string key); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,39 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ExtendedString.hpp :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: eavedill <eavedill@student.42.fr> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/06/30 13:47:57 by eavedill #+# #+# */ | ||
/* Updated: 2024/06/30 14:56:55 by eavedill ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#pragma once | ||
#include <sstream> | ||
#include <string> | ||
#include <unistd.h> | ||
#include <vector> | ||
#include "utils.hpp" | ||
|
||
class ExtendedString : public std::string { | ||
public: | ||
//using std::string::string; // Inherit constructors from std::string | ||
ExtendedString(); | ||
ExtendedString(const std::string &str); | ||
~ExtendedString(); | ||
ExtendedString &operator=(const std::string &str); | ||
|
||
bool isNumber() const; | ||
bool firstCharIsSign() const; | ||
void replaceString(const std::string& , const std::string& ); | ||
bool validIPAddress(); | ||
size_t stringToSizeT(); | ||
std::vector<ExtendedString> splitString(char ); | ||
//***To be used in case do not want to modify the original string | ||
//ExtendedString removeCharFromString(char); | ||
void removeCharFromString(char); | ||
//***To be used in case do not want to modify the original string | ||
// ExtendedString removeBlanksAndTabs() ; | ||
void removeBlanksAndTabs() ; | ||
int count_chars(char c); | ||
void replaceFirstString(const std::string& searchString, const std::string& replaceString); | ||
class ExtendedString : public std::string | ||
{ | ||
public: | ||
ExtendedString(); | ||
ExtendedString(const std::string &str); | ||
~ExtendedString(); | ||
ExtendedString &operator=(const std::string &str); | ||
|
||
bool isNumber() const; | ||
bool firstCharIsSign() const; | ||
void replaceString(const std::string& , const std::string& ); | ||
bool validIPAddress(); | ||
size_t stringToSizeT(); | ||
std::vector<ExtendedString> splitString(char ); | ||
void removeCharFromString(char); | ||
void removeBlanksAndTabs() ; | ||
int count_chars(char c); | ||
void replaceFirstString(const std::string& searchString, const std::string& replaceString); | ||
|
||
}; |
Oops, something went wrong.