mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibWeb: Don't crash when handling invalid HTTP status codes
Example crash: https://wpt.live/fetch/h1-parsing/status-code.window.html There is still work to make the above tests pass.
This commit is contained in:
parent
24da7b006e
commit
6c3ceb9284
Notes:
github-actions[bot]
2025-05-27 18:59:12 +00:00
Author: https://github.com/Calme1709
Commit: 6c3ceb9284
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4877
Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 6 additions and 2 deletions
|
@ -443,8 +443,12 @@ void ResourceLoader::load(LoadRequest& request, GC::Root<SuccessCallback> succes
|
|||
else
|
||||
error_builder.append("Load failed"sv);
|
||||
|
||||
if (status_code.has_value() && *status_code > 0)
|
||||
error_builder.appendff(" (status: {} {})", *status_code, HTTP::HttpResponse::reason_phrase_for_code(*status_code));
|
||||
if (status_code.has_value()) {
|
||||
if (*status_code >= 100 && *status_code <= 599)
|
||||
error_builder.appendff(" (status: {} {})", *status_code, HTTP::HttpResponse::reason_phrase_for_code(*status_code));
|
||||
else
|
||||
error_builder.appendff(" (status: {})", *status_code);
|
||||
}
|
||||
|
||||
log_failure(request, error_builder.string_view());
|
||||
if (error_callback)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue