mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
content encoding: New function accept_encoding_header.
This commit is contained in:
parent
8492e6b1af
commit
902522fbdf
@ -344,3 +344,30 @@ read_encoded_file(struct string *filename, struct string *page)
|
|||||||
close(fd);
|
close(fd);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
accept_encoding_header(struct string *header)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2) || defined(CONFIG_LZMA)
|
||||||
|
int comma = 0;
|
||||||
|
|
||||||
|
add_to_string(header, "Accept-Encoding: ");
|
||||||
|
|
||||||
|
#ifdef CONFIG_BZIP2
|
||||||
|
add_to_string(header, "bzip2");
|
||||||
|
comma = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_GZIP
|
||||||
|
if (comma) add_to_string(header, ", ");
|
||||||
|
add_to_string(header, "deflate, gzip");
|
||||||
|
comma = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LZMA
|
||||||
|
if (comma) add_to_string(header, ", ");
|
||||||
|
add_to_string(header, "lzma");
|
||||||
|
#endif
|
||||||
|
add_crlf_to_string(header);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -45,4 +45,6 @@ read_file(struct stream_encoded *stream, int readsize, struct string *page);
|
|||||||
/* Reads the file with the given @filename into the string @source. */
|
/* Reads the file with the given @filename into the string @source. */
|
||||||
enum connection_state read_encoded_file(struct string *filename, struct string *source);
|
enum connection_state read_encoded_file(struct string *filename, struct string *source);
|
||||||
|
|
||||||
|
void accept_encoding_header(struct string *header);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "cache/cache.h"
|
#include "cache/cache.h"
|
||||||
#include "config/options.h"
|
#include "config/options.h"
|
||||||
#include "cookies/cookies.h"
|
#include "cookies/cookies.h"
|
||||||
|
#include "encoding/encoding.h"
|
||||||
#include "intl/charsets.h"
|
#include "intl/charsets.h"
|
||||||
#include "intl/gettext/libintl.h"
|
#include "intl/gettext/libintl.h"
|
||||||
#include "main/module.h"
|
#include "main/module.h"
|
||||||
@ -745,24 +746,7 @@ http_send_header(struct socket *socket)
|
|||||||
add_to_string(&header, "Accept: */*");
|
add_to_string(&header, "Accept: */*");
|
||||||
add_crlf_to_string(&header);
|
add_crlf_to_string(&header);
|
||||||
|
|
||||||
/* TODO: Make this encoding.c function. */
|
accept_encoding_header(&header);
|
||||||
#if defined(CONFIG_GZIP) || defined(CONFIG_BZIP2)
|
|
||||||
add_to_string(&header, "Accept-Encoding: ");
|
|
||||||
|
|
||||||
#ifdef CONFIG_BZIP2
|
|
||||||
add_to_string(&header, "bzip2");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_GZIP
|
|
||||||
|
|
||||||
#ifdef CONFIG_BZIP2
|
|
||||||
add_to_string(&header, ", ");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
add_to_string(&header, "deflate, gzip");
|
|
||||||
#endif
|
|
||||||
add_crlf_to_string(&header);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!accept_charset) {
|
if (!accept_charset) {
|
||||||
init_accept_charset();
|
init_accept_charset();
|
||||||
|
Loading…
Reference in New Issue
Block a user