-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
386 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef BASEKEYVALUEMAP_HPP | ||
#define BASEKEYVALUEMAP_HPP | ||
|
||
#include <map> | ||
#include <string> | ||
|
||
class BaseKeyValueMap | ||
{ | ||
private: | ||
|
||
public: | ||
BaseKeyValueMap(void); | ||
BaseKeyValueMap(const BaseKeyValueMap &other); | ||
virtual ~BaseKeyValueMap(); | ||
|
||
virtual void show_value() = 0; | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
#ifndef HTTPREQUEST_HPP | ||
#define HTTPREQUEST_HPP | ||
|
||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
#include <sstream> | ||
#include <set> | ||
|
||
#include "BaseKeyValueMap.hpp" | ||
#include "HandlingString.hpp" | ||
#include "RequestLine.hpp" | ||
#include "ValueWeightArraySet.hpp" | ||
#include "ValueArraySet.hpp" | ||
#include "ValueSet.hpp" | ||
#include "TwoValueSet.hpp" | ||
#include "ValueMap.hpp" | ||
#include "ValueDateSet.hpp" | ||
|
||
class BaseKeyValueMap; | ||
|
||
class RequestLine; | ||
class ValueWeightArraySet; | ||
class ValueArraySet; | ||
class ValueSet; | ||
class TwoValueSet; | ||
class ValueMap; | ||
class ValueDateSet; | ||
|
||
class HttpRequest | ||
{ | ||
private: | ||
RequestLine _requestline; | ||
std::map<std::string, void(HttpRequest::*)(const std::string&, const std::string&)> inputvalue_functionmap; | ||
std::map<std::string, BaseKeyValueMap*> request_keyvalue_map; | ||
|
||
HttpRequest(); | ||
HttpRequest(const HttpRequest &other); | ||
|
||
bool check_keyword_exist(const std::string &key); | ||
std::string obtain_request_key(const std::string value); | ||
std::string obtain_request_value(const std::string value); | ||
|
||
TwoValueSet *ready_TwoValueSet(const std::string &value); | ||
TwoValueSet *ready_TwoValueSet(const std::string &value, char delimiter); | ||
ValueArraySet *ready_ValueArraySet(const std::string &value); | ||
ValueDateSet *ready_ValueDateSet(const std::string &value); | ||
ValueMap *ready_ValueMap(const std::string &value); | ||
ValueMap *ready_ValueMap(const std::string &only_value, const std::string &value); | ||
ValueSet *ready_ValueSet(const std::string &value); | ||
ValueWeightArraySet *ready_ValueWeightArraySet(const std::string &value); | ||
void ready_functionmap(void); | ||
|
||
double _status_code; | ||
|
||
public: | ||
|
||
HttpRequest(const std::string &all_request_text); | ||
~HttpRequest(); | ||
|
||
// void set_all_method(); | ||
void set_accept(const std::string &key, const std::string &value); | ||
void set_accept_ch(const std::string &key,const std::string &value); | ||
void set_accept_charset(const std::string &key,const std::string &value); | ||
void set_accept_encoding(const std::string &key,const std::string &value); | ||
void set_accept_language(const std::string &key,const std::string &value); | ||
bool check_accept_langage_valueword(const std::string &value); | ||
// void set_//方かわからん | ||
void set_accept_post(const std::string &key,const std::string &value); | ||
void set_accept_ranges(const std::string &key,const std::string &value); | ||
void set_access_control_allow_credentials(const std::string &key,const std::string &value); | ||
void set_access_control_allow_headers(const std::string &key,const std::string &value); | ||
void set_access_control_allow_methods(const std::string &key,const std::string &value); | ||
void set_access_control_allow_origin(const std::string &key,const std::string &value); | ||
void set_access_control_expose_headers(const std::string &key,const std::string &value); | ||
void set_access_control_max_age(const std::string &key,const std::string &value); | ||
void set_access_control_request_headers(const std::string &key,const std::string &value); | ||
void set_access_control_request_method(const std::string &key,const std::string &value); | ||
void set_age(const std::string &key,const std::string &value); | ||
void set_allow(const std::string &key,const std::string &value); | ||
void set_alt_svc(const std::string &key,const std::string &value); | ||
void set_alt_used(const std::string &key,const std::string &value); | ||
void set_authorization(const std::string &key, const std::string &value); | ||
// void set//か全くわからない うまく分けられん | ||
void set_clear_site_data(const std::string &key,const std::string &value); | ||
void set_connection(const std::string &key,const std::string &value); | ||
void set_content_disponesition(const std::string &key,const std::string &value); | ||
void set_content_encoding(const std::string &key,const std::string &value); | ||
void set_content_language(const std::string &key,const std::string &value); | ||
void set_content_length(const std::string &key,const std::string &value); | ||
void set_content_location(const std::string &key,const std::string &value); | ||
void set_content_range(const std::string &key,const std::string &value); | ||
void set_content_security_policy(const std::string &key,const std::string &value); | ||
void set_content_security_policy_report_only(const std::string &key,const std::string &value); | ||
void set_content_type(const std::string &key,const std::string &value); | ||
void set_cookie(const std::string &key,const std::string &value); | ||
void set_cross_origin_embedder_policy(const std::string &key,const std::string &value); | ||
void set_cross_origin_opener_policy(const std::string &key,const std::string &value); | ||
void set_cross_origin_resource_policy(const std::string &key,const std::string &value); | ||
void set_date(const std::string &key,const std::string &value); | ||
void set_etag(const std::string &key,const std::string &value); | ||
void set_expect(const std::string &key,const std::string &value); | ||
// void set//ているっぽくて対応したくない | ||
void set_expires(const std::string &key,const std::string &value); | ||
void set_forwarded(const std::string &key,const std::string &value); | ||
void set_email(const std::string &key,const std::string &value); | ||
void set_from(const std::string &key,const std::string &value); | ||
void set_host(const std::string &key,const std::string &value); | ||
void set_if_match(const std::string &key,const std::string &value); | ||
void set_if_modified_since(const std::string &key,const std::string &value); | ||
void set_if_none_match(const std::string &key,const std::string &value); | ||
void set_if_range(const std::string &key,const std::string &value); | ||
void set_if_unmodified_since(const std::string &key,const std::string &value); | ||
void set_keep_alive(const std::string &key,const std::string &value); | ||
void set_last_modified(const std::string &key,const std::string &value); | ||
void set_link(const std::string &key,const std::string &value); | ||
void set_location(const std::string &key,const std::string &value); | ||
void set_max_forwards(const std::string &key,const std::string &value); | ||
void set_origin(const std::string &key,const std::string &value); | ||
void set_permission_policy(const std::string &key,const std::string &value); | ||
void set_proxy_authenticate(const std::string &key,const std::string &value); | ||
void set_proxy_authorization(const std::string &key,const std::string &value); | ||
// void set//れどれが当てはまるかわからん | ||
void set_referer(const std::string &key,const std::string &value); | ||
void set_referrer_policy(const std::string &key,const std::string &value); | ||
void set_retry_after(const std::string &key,const std::string &value); | ||
void set_sec_fetch_dest(const std::string &key,const std::string &value); | ||
void set_sec_fetch_mode(const std::string &key,const std::string &value); | ||
void set_sec_fetch_site(const std::string &key,const std::string &value); | ||
void set_sec_fetch_user(const std::string &key,const std::string &value); | ||
void set_sec_purpose(const std::string &key,const std::string &value); | ||
void set_sec_websocket_accept(const std::string &key,const std::string &value); | ||
void set_server(const std::string &key,const std::string &value); | ||
void set_servertiming(const std::string &key,const std::string &value); | ||
void set_service_worker_navigation_preload(const std::string &key,const std::string &value); | ||
void set_set_cookie(const std::string &key,const std::string &value); | ||
void set_sourcemap(const std::string &key,const std::string &value); | ||
void set_strict_transport_security(const std::string &key,const std::string &value); | ||
void set_te(const std::string &key,const std::string &value); | ||
void set_timing_allow_origin(const std::string &key,const std::string &value); | ||
void set_trailer(const std::string &key,const std::string &value); | ||
void set_transfer_encoding(const std::string &key,const std::string &value); | ||
void set_upgrade(const std::string &key,const std::string &value); | ||
void set_upgrade_insecure_requests(const std::string &key,const std::string &value); | ||
void set_user_agent(const std::string &key,const std::string &value); | ||
void set_vary(const std::string &key,const std::string &value); | ||
void set_via(const std::string &key,const std::string &value); | ||
void set_www_authenticate(const std::string &key,const std::string &value); | ||
void set_x_xss_protection(const std::string &key,const std::string &value); | ||
|
||
//debug関数 | ||
void show_requestinfs(void); | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef REQUESTLINE_HPP | ||
#define REQUESTLINE_HPP | ||
|
||
#include <string> | ||
#include <iostream> | ||
#include <sstream> | ||
|
||
class RequestLine | ||
{ | ||
private: | ||
std::string _method; | ||
std::string _target_page; | ||
std::string _version; | ||
|
||
RequestLine(const RequestLine &other); | ||
RequestLine& operator=(const RequestLine &other); | ||
|
||
public: | ||
RequestLine(); | ||
~RequestLine(); | ||
|
||
void set_value(const std::string &line); | ||
|
||
std::string get_method(void) const; | ||
std::string get_target_page(void) const; | ||
std::string get_version(void) const; | ||
|
||
void show_requestline(void) const; | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef TWOVALUESET_HPP | ||
#define TWOVALUESET_HPP | ||
|
||
#include <string> | ||
#include <iostream> | ||
#include "BaseKeyValueMap.hpp" | ||
|
||
class TwoValueSet: public BaseKeyValueMap | ||
{ | ||
private: | ||
std::string _firstvalue; | ||
std::string _secondValue; | ||
|
||
public: | ||
TwoValueSet(); | ||
TwoValueSet(std::string const &first_value); | ||
TwoValueSet(const std::string &first_value, const std::string &second_value); | ||
TwoValueSet& operator=(const TwoValueSet &other); | ||
~TwoValueSet(); | ||
|
||
std::string get_firstvalue(void) const; | ||
std::string get_secondvalue(void) const; | ||
|
||
void show_value(void); | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef VALUEARRAYSET_HPP | ||
#define VALUEARRAYSET_HPP | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <iostream> | ||
|
||
#include "BaseKeyValueMap.hpp" | ||
|
||
class ValueArraySet: public BaseKeyValueMap | ||
{ | ||
private: | ||
std::vector<std::string> _value_array; | ||
|
||
public: | ||
ValueArraySet(); | ||
ValueArraySet(const ValueArraySet &other); | ||
ValueArraySet(const std::vector<std::string> &value_array); | ||
ValueArraySet &operator=(const ValueArraySet &other); | ||
~ValueArraySet(); | ||
|
||
std::vector<std::string> get_value_array(void) const; | ||
|
||
void show_value(void); | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef VALUEDATESET_HPP | ||
#define VALUEDATESET_HPP | ||
|
||
#include <string> | ||
#include <iostream> | ||
#include <sstream> | ||
|
||
#include "BaseKeyValueMap.hpp" | ||
|
||
class ValueDateSet: public BaseKeyValueMap | ||
{ | ||
private: | ||
std::string _day_name; | ||
std::string _day; | ||
std::string _month; | ||
std::string _year; | ||
std::string _hour; | ||
std::string _minute; | ||
std::string _second; | ||
|
||
public: | ||
ValueDateSet(); | ||
ValueDateSet(const ValueDateSet &other); | ||
ValueDateSet& operator=(const ValueDateSet &other); | ||
ValueDateSet(const std::string &date_format); | ||
~ValueDateSet(); | ||
|
||
std::string get_valuedateset_day_name() const; | ||
std::string get_valuedateset_day() const; | ||
std::string get_valuedateset_month() const; | ||
std::string get_valuedateset_year() const; | ||
std::string get_valuedateset_hour() const; | ||
std::string get_valuedateset_minute() const; | ||
std::string get_valuedateset_second() const; | ||
|
||
void show_value(); | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef VALUEMAP_HPP | ||
#define VALUEMAP_HPP | ||
|
||
#include <string> | ||
#include <map> | ||
#include <iostream> | ||
|
||
#include "BaseKeyValueMap.hpp" | ||
|
||
class ValueMap: public BaseKeyValueMap | ||
{ | ||
private: | ||
std::string _only_value; | ||
std::map<std::string, std::string> _value_map; | ||
|
||
public: | ||
ValueMap(); | ||
ValueMap(const ValueMap &other); | ||
ValueMap& operator=(const ValueMap &other); | ||
ValueMap(const std::string &value, std::map<std::string, std::string> value_map); | ||
ValueMap(std::map<std::string, std::string> value_map); | ||
~ValueMap(); | ||
|
||
void set_value(const std::string &only_value, const std::map<std::string, std::string> &value_map); | ||
void set_value(const std::string &only_value); | ||
void set_value(const std::map<std::string, std::string> &value_map); | ||
|
||
std::string get_only_value(void) const; | ||
std::map<std::string, std::string> get_value_map(void) const; | ||
|
||
void show_value(); | ||
}; | ||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef VALUESET_HPP | ||
#define VALUESET_HPP | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <iostream> | ||
|
||
#include "BaseKeyValueMap.hpp" | ||
|
||
class ValueSet: public BaseKeyValueMap | ||
{ | ||
private: | ||
std::string _value; | ||
|
||
public: | ||
ValueSet(); | ||
ValueSet(const ValueSet &other); | ||
ValueSet &operator=(const ValueSet &other); | ||
ValueSet(const std::string &value); | ||
~ValueSet(); | ||
|
||
std::string get_value_set(void) const; | ||
|
||
void show_value(); | ||
}; | ||
|
||
#endif |
File renamed without changes.
Oops, something went wrong.