implement response parser features, add request struct

This commit is contained in:
yggverse 2024-09-16 14:05:07 +03:00
parent 0a7c3a6055
commit a478e31bd5
2 changed files with 125 additions and 33 deletions

View file

@ -96,13 +96,52 @@ namespace app::browser::main::tab
struct Gemini
{
// Defaults
static const int DEFAULT_PORT = 1965;
// Actions
static Glib::RefPtr<Gio::SocketClient> create();
static Glib::ustring get_request_from_uri(
GUri * uri
);
struct Request
{
static Glib::ustring create_from_uri(
GUri * uri
);
};
struct Response
{
/*
* Status codes
*
* 10-19 Input expected
* 20-29 Success
* 30-39 Redirection
* 40-49 Temporary failure
* 50-59 Permanent failure
* 60-69 Client certificates
*
* https://geminiprotocol.net/docs/protocol-specification.gmi#status-codes
*/
enum class Status
{
SUCCESS,
REDIRECT,
TEMPORARY_FAILURE,
PERMANENT_FAILURE,
CERTIFICATE,
UNDEFINED
}; // @TODO explain code groups
struct Match
{
static bool meta(
const Glib::ustring & RESPONSE,
Status & status,
MIME & mime
);
};
};
};
};