diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-11 02:20:31 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-11 02:20:31 +0800 |
| commit | bfb85334541e44cf03823fe8f0f80c89ee1feeba (patch) | |
| tree | 17b335f1b8edbd9d1acb06ee78e57e6dd0a82b12 /ricochet/src/core/browser.cc | |
| parent | 3f39df2356504bc68a4e493a723fd4d907c43ff4 (diff) | |
| download | rcc-project-bfb85334541e44cf03823fe8f0f80c89ee1feeba.tar.gz rcc-project-bfb85334541e44cf03823fe8f0f80c89ee1feeba.tar.xz | |
feat: implement basic HTTP client with socket and address networking utilities
Diffstat (limited to 'ricochet/src/core/browser.cc')
| -rw-r--r-- | ricochet/src/core/browser.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ricochet/src/core/browser.cc b/ricochet/src/core/browser.cc index 88c47be..ccda9a1 100644 --- a/ricochet/src/core/browser.cc +++ b/ricochet/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; } |
