-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Milestone
Description
Prerequisite Checklist
- I searched for existing issues to prevent duplicates
- I searched for existing discussions on the forum to prevent duplicates
- I am here to report an issue and not to just ask a question or look for help (use the forum or Discord instead)
Describe your issue here
Upon running some code like this:
Http http;
Http::Request request;
http.setHost("garbage");
request.setMethod(Http::Request::Method::Get);
request.setUri("");
request.setHttpVersion(1, 1);
Http::Response response = http.sendRequest(request, seconds(0.5));
err() << response.getBody() << endl;
err() << endl;
at the sendRequest line, the code crashes with the following error:
terminate called after throwing an instance of 'std::bad_optional_access'
what(): bad optional access
which happens at this line:
if (m_connection.connect(m_host.value(), m_port, timeout) == Socket::Status::Done)
in Http.cpp
Your Environment
- OS / distro / window manager: Linux/X11
- SFML version: 3.0.1
- Compiler / toolchain: g++ / CMake
Steps to reproduce
Http http;
Http::Request request;
http.setHost("garbage");
request.setMethod(Http::Request::Method::Get);
request.setUri("");
request.setHttpVersion(1, 1);
Http::Response response = http.sendRequest(request, seconds(0.5));
err() << response.getBody() << endl;
err() << endl;
Expected behavior
Should not crash.
Actual behavior
Crash.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Review