not_supported_e = 0, get_e, head_e, post_e
} method_t;
+typedef enum {
+ encoding_plain_e = 0, encoding_gzip_e, encoding_compress_e
+} encoding_t;
+
typedef struct {
char *allow;
char *authorization;
- char *content_encoding;
+ encoding_t content_encoding;
char *content_length;
char *content_type;
char *date;
printf ("Header values\n");
if (header->allow) printf ("allow = '%s'\n", header->allow);
if (header->authorization) printf ("authorization = '%s'\n", header->authorization);
- if (header->content_encoding) printf ("content_encoding = '%s'\n", header->content_encoding);
+ if (header->content_encoding) {
+ printf ("content_encoding = ");
+ switch (header->content_encoding) {
+ case encoding_plain_e: printf ("plain\n"); break;
+ case encoding_gzip_e: printf ("gzip\n"); break;
+ case encoding_compress_e: printf ("compress\n"); break;
+ }
+ }
if (header->content_length) printf ("content_length = '%s'\n", header->content_length);
if (header->content_type) printf ("content_type = '%s'\n", header->content_type);
if (header->date) printf ("date = '%s'\n", header->date);
VERBOSE (DEBUG, PRINT ("Analyse field\n"));
if (strcmp (field, "Allow") == 0) { header.allow = value; }
else if (strcmp (field, "Authorization") == 0) { header.authorization = value; }
- else if (strcmp (field, "Content-Encoding") == 0) { header.content_encoding = value; }
- else if (strcmp (field, "Content-Length") == 0) { header.content_length = value; }
+ else if (strcmp (field, "Content-Encoding") == 0) {
+ if (strcmp (value, "x-gzip") == 0) {
+ header.content_encoding = encoding_gzip_e;
+ } else if (strcmp (value, "x-compress") == 0) {
+ header.content_encoding = encoding_compress_e;
+ } else {
+ VERBOSE (WARNING, PRINT ("Unknown content encoding: %s\n", value));
+ }
+ } else if (strcmp (field, "Content-Length") == 0) { header.content_length = value; }
else if (strcmp (field, "Content-Type") == 0) { header.content_type = value; }
else if (strcmp (field, "Date") == 0) { header.date = value; }
else if (strcmp (field, "Expires") == 0) { header.expires = value; }
if (len != (header.content_length ? atoi (header.content_length) : 0)) {
VERBOSE (WARNING, PRINT ("Incoherent size (%d <> %s)\n", len, header.content_length));
}
+ if (len > 0) {
+ switch (header.content_encoding) {
+ case encoding_plain_e: break;
+ case encoding_gzip_e: VERBOSE (WARNING, PRINT ("Gzip encoding not supported yet\n")); break;
+ case encoding_compress_e: VERBOSE (WARNING, PRINT ("Compress encoding not supported yet\n")); break;
+ }
+ }
/* response */
char *buffer = NULL;