mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-07-17 14:46:31 +02:00
「🏗️」 wip: implementing config in client: fix your code adjoly xd
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/30 09:42:18 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/30 09:47:33 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/30 15:17:15 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -28,7 +28,10 @@ void Delete::parse(std::string const &data) {
|
||||
if (std::getline(stream, line)) {
|
||||
std::istringstream line_stream(line);
|
||||
line_stream >> this->_method >> this->_target >> this->_protocol;
|
||||
this->_target.insert(this->_target.begin(), '.');
|
||||
_method = _sanitizeStr(_method);
|
||||
_target = _sanitizeStr(_target);
|
||||
_protocol = _sanitizeStr(_protocol);
|
||||
// this->_target.insert(this->_target.begin(), '.');
|
||||
}
|
||||
|
||||
while (std::getline(stream, line) && line != "\r") {
|
||||
@ -36,7 +39,7 @@ void Delete::parse(std::string const &data) {
|
||||
if (delimiter_index != std::string::npos) {
|
||||
std::string key = line.substr(0, delimiter_index);
|
||||
std::string value = line.substr(delimiter_index + 2);
|
||||
this->_headers.insert(std::make_pair(key, value));
|
||||
this->_headers.insert(std::make_pair(key, _sanitizeStr(value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/30 09:40:16 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/30 14:54:23 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/30 15:30:08 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -31,7 +31,6 @@ void Get::parse(std::string const &data) {
|
||||
_method = _sanitizeStr(_method);
|
||||
_target = _sanitizeStr(_target);
|
||||
_protocol = _sanitizeStr(_protocol);
|
||||
/* this->_target.insert(this->_target.begin(), '.'); */
|
||||
}
|
||||
|
||||
while (std::getline(stream, line) && line != "\r") {
|
||||
@ -50,9 +49,8 @@ void Get::parse(std::string const &data) {
|
||||
|
||||
_url = new URL("http://" + _headers["Host"] + _target);
|
||||
|
||||
|
||||
std::cout << "wtf = " << _headers["Host"] << std::endl;
|
||||
std::cout << *_url << std::endl;
|
||||
/*std::cout << "wtf = " << _headers["Host"] << std::endl;
|
||||
std::cout << *_url << std::endl;*/
|
||||
|
||||
/*
|
||||
std::cout << "-- start-line --" << std::endl;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/30 09:50:20 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/30 09:50:22 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/30 15:18:01 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -30,7 +30,10 @@ void Post::parse(std::string const &data) {
|
||||
if (std::getline(stream, line)) {
|
||||
std::istringstream line_stream(line);
|
||||
line_stream >> this->_method >> this->_target >> this->_protocol;
|
||||
this->_target.insert(this->_target.begin(), '.');
|
||||
_method = _sanitizeStr(_method);
|
||||
_target = _sanitizeStr(_target);
|
||||
_protocol = _sanitizeStr(_protocol);
|
||||
// this->_target.insert(this->_target.begin(), '.');
|
||||
}
|
||||
|
||||
while (std::getline(stream, line) && line != "\r") {
|
||||
@ -38,7 +41,7 @@ void Post::parse(std::string const &data) {
|
||||
if (delimiter_index != std::string::npos) {
|
||||
std::string key = line.substr(0, delimiter_index);
|
||||
std::string value = line.substr(delimiter_index + 2);
|
||||
this->_headers.insert(std::make_pair(key, value));
|
||||
this->_headers.insert(std::make_pair(key, _sanitizeStr(value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user