-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gzip): added gzip to compress server responses.
- Loading branch information
1 parent
4feb6dc
commit 90125a0
Showing
8 changed files
with
367 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef GZIP_H | ||
#define GZIP_H | ||
|
||
#include <stdlib.h> | ||
#include <stdbool.h> | ||
#include <ctype.h> | ||
|
||
#include "zlib.h" | ||
#include "http.h" | ||
|
||
typedef struct gzip_state_t | ||
{ | ||
z_stream strm; | ||
int current_size_in; | ||
int current_size_out; | ||
int current_size_buf_out; | ||
boolean first_chunk; | ||
boolean last_chunk; | ||
char *http_header; | ||
unsigned char *raw_body; | ||
unsigned char *gzip_body; | ||
char *chunk_body; | ||
} gzip_state_t; | ||
|
||
int gzip_init_state(gzip_state_t *state); | ||
void gzip_free_state(gzip_state_t *state); | ||
int gzip_compress(gzip_state_t *state); | ||
void gzip_chunk_compress(gzip_state_t *state); | ||
void gzip_init_headers(gzip_state_t *state, http_response_t *response); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.