Skip to content

Commit

Permalink
improve format
Browse files Browse the repository at this point in the history
  • Loading branch information
Strive-Sun committed Mar 6, 2024
1 parent 1a37a1b commit 20becee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ endif()

option(SENTRY_PIC "Build sentry (and dependent) libraries as position independent libraries" ON)

option(SENTRY_TRANSPORT_COMPRESSION " Enable transport gzip compression" OFF)
option(SENTRY_TRANSPORT_COMPRESSION "Enable transport gzip compression" OFF)

option(SENTRY_BUILD_TESTS "Build sentry-native tests" "${SENTRY_MAIN_PROJECT}")
option(SENTRY_BUILD_EXAMPLES "Build sentry-native example(s)" "${SENTRY_MAIN_PROJECT}")
Expand Down Expand Up @@ -299,8 +299,7 @@ if(SENTRY_TRANSPORT_COMPRESSION)
endif()

target_link_libraries(sentry PRIVATE ZLIB::ZLIB)

add_definitions(-DGZIP_COMPRESSION)
add_definitions(-DSENTRY_GZIPPED_COMPRESSION)
endif()

set_property(TARGET sentry PROPERTY C_VISIBILITY_PRESET hidden)
Expand Down
9 changes: 5 additions & 4 deletions src/sentry_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
#include "sentry_ratelimiter.h"
#include "sentry_string.h"

#ifdef GZIP_COMPRESSION
#ifdef SENTRY_GZIPPED_COMPRESSION
#include "zlib.h"
#endif

#define ENVELOPE_MIME "application/x-sentry-envelope"
// The headers we use are: `x-sentry-auth`, `content-type`, `content-encoding`, `content-length`
// The headers we use are: `x-sentry-auth`, `content-type`, `content-encoding`,
// `content-length`
#define MAX_HTTP_HEADERS 4

typedef struct sentry_transport_s {
Expand Down Expand Up @@ -152,7 +153,7 @@ sentry_transport_free(sentry_transport_t *transport)
sentry_free(transport);
}

#ifdef GZIP_COMPRESSION
#ifdef SENTRY_GZIPPED_COMPRESSION
static bool
gzipped_with_compression(const char *body, const size_t body_len,
char **compressed_body, size_t *compressed_body_len)
Expand Down Expand Up @@ -220,7 +221,7 @@ sentry__prepare_http_request(sentry_envelope_t *envelope,
}

bool compressed = false;
#ifdef GZIP_COMPRESSION
#ifdef SENTRY_GZIPPED_COMPRESSION
char *compressed_body = NULL;
size_t compressed_body_len = 0;
compressed = gzipped_with_compression(
Expand Down

0 comments on commit 20becee

Please sign in to comment.