mirror of
https://github.com/RGBCube/serenity
synced 2025-07-22 22:27:39 +00:00
LibCore: Rename class Gzip -> CGZip
This commit is contained in:
parent
edd0959c83
commit
a353d16ff4
3 changed files with 5 additions and 5 deletions
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <LibDraw/puff.h>
|
#include <LibDraw/puff.h>
|
||||||
|
|
||||||
bool Gzip::is_compressed(const ByteBuffer& data)
|
bool CGzip::is_compressed(const ByteBuffer& data)
|
||||||
{
|
{
|
||||||
return data.size() > 2 && data[0] == 0x1F && data[1] == 0x8b;
|
return data.size() > 2 && data[0] == 0x1F && data[1] == 0x8b;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||||
return data.slice(current, new_size);
|
return data.slice(current, new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
|
Optional<ByteBuffer> CGzip::decompress(const ByteBuffer& data)
|
||||||
{
|
{
|
||||||
ASSERT(is_compressed(data));
|
ASSERT(is_compressed(data));
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
|
||||||
class Gzip {
|
class CGzip {
|
||||||
public:
|
public:
|
||||||
static bool is_compressed(const ByteBuffer& data);
|
static bool is_compressed(const ByteBuffer& data);
|
||||||
static Optional<ByteBuffer> decompress(const ByteBuffer& data);
|
static Optional<ByteBuffer> decompress(const ByteBuffer& data);
|
||||||
|
|
|
@ -13,13 +13,13 @@ static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& c
|
||||||
dbg() << "CHttpJob::handle_content_encoding: buf has content_encoding = " << content_encoding;
|
dbg() << "CHttpJob::handle_content_encoding: buf has content_encoding = " << content_encoding;
|
||||||
|
|
||||||
if (content_encoding == "gzip") {
|
if (content_encoding == "gzip") {
|
||||||
if (!Gzip::is_compressed(buf)) {
|
if (!CGzip::is_compressed(buf)) {
|
||||||
dbg() << "CHttpJob::handle_content_encoding: buf is not gzip compressed!";
|
dbg() << "CHttpJob::handle_content_encoding: buf is not gzip compressed!";
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg() << "CHttpJob::handle_content_encoding: buf is gzip compressed!";
|
dbg() << "CHttpJob::handle_content_encoding: buf is gzip compressed!";
|
||||||
|
|
||||||
auto uncompressed = Gzip::decompress(buf);
|
auto uncompressed = CGzip::decompress(buf);
|
||||||
if (!uncompressed.has_value()) {
|
if (!uncompressed.has_value()) {
|
||||||
dbg() << "CHttpJob::handle_content_encoding: Gzip::decompress() failed. Returning original buffer.";
|
dbg() << "CHttpJob::handle_content_encoding: Gzip::decompress() failed. Returning original buffer.";
|
||||||
return buf;
|
return buf;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue