mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
LibWeb: Implement 'Default User-Agent
value' AO
This commit is contained in:
parent
5ee9feb9cf
commit
6deb5ce9b5
3 changed files with 10 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP.h>
|
||||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
|
#include <LibWeb/Fetch/Infrastructure/HTTP/Headers.h>
|
||||||
#include <LibWeb/Infra/ByteSequences.h>
|
#include <LibWeb/Infra/ByteSequences.h>
|
||||||
|
#include <LibWeb/Loader/ResourceLoader.h>
|
||||||
#include <LibWeb/MimeSniff/MimeType.h>
|
#include <LibWeb/MimeSniff/MimeType.h>
|
||||||
|
|
||||||
namespace Web::Fetch::Infrastructure {
|
namespace Web::Fetch::Infrastructure {
|
||||||
|
@ -686,4 +687,11 @@ Optional<RangeHeaderValue> parse_single_range_header_value(ReadonlyBytes value)
|
||||||
return RangeHeaderValue { move(range_start_value), move(range_end_value) };
|
return RangeHeaderValue { move(range_start_value), move(range_end_value) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://fetch.spec.whatwg.org/#default-user-agent-value
|
||||||
|
ErrorOr<ByteBuffer> default_user_agent_value()
|
||||||
|
{
|
||||||
|
// A default `User-Agent` value is an implementation-defined header value for the `User-Agent` header.
|
||||||
|
return ByteBuffer::copy(default_user_agent.bytes());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,5 +74,6 @@ struct RangeHeaderValue {
|
||||||
[[nodiscard]] bool is_forbidden_response_header_name(ReadonlyBytes);
|
[[nodiscard]] bool is_forbidden_response_header_name(ReadonlyBytes);
|
||||||
[[nodiscard]] bool is_request_body_header_name(ReadonlyBytes);
|
[[nodiscard]] bool is_request_body_header_name(ReadonlyBytes);
|
||||||
[[nodiscard]] Optional<RangeHeaderValue> parse_single_range_header_value(ReadonlyBytes);
|
[[nodiscard]] Optional<RangeHeaderValue> parse_single_range_header_value(ReadonlyBytes);
|
||||||
|
[[nodiscard]] ErrorOr<ByteBuffer> default_user_agent_value();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Web {
|
||||||
# error Unknown OS
|
# error Unknown OS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr auto default_user_agent = "Mozilla/5.0 (" OS_STRING "; " CPU_STRING ") LibWeb+LibJS/1.0 Ladybird/1.0";
|
constexpr auto default_user_agent = "Mozilla/5.0 (" OS_STRING "; " CPU_STRING ") LibWeb+LibJS/1.0 Ladybird/1.0"sv;
|
||||||
|
|
||||||
class ResourceLoaderConnectorRequest : public RefCounted<ResourceLoaderConnectorRequest> {
|
class ResourceLoaderConnectorRequest : public RefCounted<ResourceLoaderConnectorRequest> {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue