mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-28 05:14:24 +00:00
### Motivation: Many HTTP servers can send compressed responses to clients and it would be a great feature for `AsyncHTTPClient` to support it. But since we want to minizime usage of unsafe APIs in SSWG projects, I propose to consolidate interfacing with zlib to `nio-extras` since it already supports `zlib` compression. ### Modifications: Added `HTTPResponseDecompressor` and accompanying tests ### Result: Users (primarily `AsyncHTTPClient`) can now provide automatic response decompression support.
37 lines
1.2 KiB
C
37 lines
1.2 KiB
C
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef C_NIO_ZLIB_H
|
|
#define C_NIO_ZLIB_H
|
|
|
|
#include <zlib.h>
|
|
|
|
static inline int CNIOExtrasZlib_deflateInit2(z_streamp strm,
|
|
int level,
|
|
int method,
|
|
int windowBits,
|
|
int memLevel,
|
|
int strategy) {
|
|
return deflateInit2(strm, level, method, windowBits, memLevel, strategy);
|
|
}
|
|
|
|
static inline int CNIOExtrasZlib_inflateInit2(z_streamp strm, int windowBits) {
|
|
return inflateInit2(strm, windowBits);
|
|
}
|
|
|
|
static inline Bytef *CNIOExtrasZlib_voidPtr_to_BytefPtr(void *in) {
|
|
return (Bytef *)in;
|
|
}
|
|
|
|
#endif
|