aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-04-11 02:20:31 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-04-11 02:20:31 +0800
commit98e88c01eb0e6404d1c5f49a22165d0861e6b924 (patch)
treed016d445fe476f747eea9030896214adeaacf51f /src/core
parent44ad3c8b36540c6b0b3144a21ac40310e163bb19 (diff)
downloadrwebbrowser-98e88c01eb0e6404d1c5f49a22165d0861e6b924.tar.gz
rwebbrowser-98e88c01eb0e6404d1c5f49a22165d0861e6b924.tar.xz
feat: implement basic HTTP client with socket and address networking utilities
Diffstat (limited to 'src/core')
-rw-r--r--src/core/browser.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/browser.cc b/src/core/browser.cc
index 88c47be..ccda9a1 100644
--- a/src/core/browser.cc
+++ b/src/core/browser.cc
@@ -17,6 +17,7 @@
*/
#include "ricochet/core/browser.hh"
+#include "ricochet/net/http_client.hh"
#include <iostream>
namespace ricochet::core {
@@ -24,6 +25,18 @@ namespace ricochet::core {
int Browser::run( std::string_view initial_url )
{
std::cout << "Browser: Navigating to " << initial_url << "...\n";
+
+ const net::HttpClient client;
+ auto response_result = client.fetch( initial_url );
+ if ( !response_result.has_value() ) {
+ std::cerr << "[!] Ricochet failed to load page: " << response_result.error() << "\n";
+ return 1;
+ }
+
+ const auto& response = response_result.value();
+ std::cout << "\n[=== HTTP Status: " << response.status_code << " ===]\n";
+ std::cout << "[=== HTML Content Below ===]\n\n";
+ std::cout << response.body << "\n";
return 0;
}