mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 19:48:47 +02:00
「🔨」 fix: fixed url
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/22 12:17:48 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/29 15:48:19 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/30 14:38:03 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <webserv.hpp>
|
||||
|
||||
class URL {
|
||||
public:
|
||||
@ -31,9 +30,11 @@ class URL {
|
||||
return _full_url < other._full_url;
|
||||
}
|
||||
|
||||
std::vector<std::string> getSegments(void) { return _path_segments; }
|
||||
std::string getFullUrl(void) const { return _full_url; }
|
||||
std::vector<std::string> getSegments(void) const { return _path_segments; }
|
||||
|
||||
std::string getFullUrl(void) const { return _full_url; }
|
||||
std::string getQueryString(void) const { return _query_string; }
|
||||
std::string getPort(void) const { return _port; }
|
||||
|
||||
private:
|
||||
void parse() {
|
||||
@ -97,7 +98,6 @@ class URL {
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &os, const URL &URL) {
|
||||
|
||||
os << URL.getFullUrl();
|
||||
return os;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 17:23:00 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/30 09:34:49 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/30 14:52:22 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -55,6 +55,15 @@ class ARequest : public http::IMessage {
|
||||
std::string _protocol;
|
||||
config::Server *_conf;
|
||||
URL *_url;
|
||||
|
||||
std::string _sanitizeStr(std::string &str) {
|
||||
std::string newStr = str;
|
||||
|
||||
if (str[str.size() - 1] == '\r') {
|
||||
newStr.erase(str.size() - 1);
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace http
|
||||
|
@ -6,13 +6,14 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/30 09:37:38 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/30 14:51:39 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <config/default.hpp>
|
||||
#include <cstdio>
|
||||
#include <netinet/in.h>
|
||||
#include <requests/default.hpp>
|
||||
#include <server/Server.hpp>
|
||||
@ -30,7 +31,7 @@ class Client {
|
||||
void parse(void);
|
||||
void answer(void);
|
||||
|
||||
bool requestParsed(void);
|
||||
bool requestParsed(void);
|
||||
|
||||
struct pollfd *getPollfd(void) const { return _pfd; }
|
||||
|
||||
@ -43,11 +44,21 @@ class Client {
|
||||
private:
|
||||
void _getRequest(std::string);
|
||||
|
||||
std::string _sanitizeStr(std::string &str) {
|
||||
std::string newStr = str;
|
||||
|
||||
if (str[str.size() - 1] == '\r') {
|
||||
newStr.erase(str.size() - 1);
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
struct pollfd *_pfd;
|
||||
struct sockaddr_in _client_addr;
|
||||
http::ARequest *_request;
|
||||
// http::Response *_response;
|
||||
config::Server *_conf;
|
||||
config::Route *_route;
|
||||
config::Config *_Gconf;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user