Permalink
Browse files

fix wip code

  • Loading branch information...
1 parent b0fd8f0 commit 64eedc0af945a8270a46f66f0ddee965e2bc2798 @thejh committed May 31, 2012
Showing with 11 additions and 6 deletions.
  1. +5 −2 src/blacklist.c
  2. +3 −1 src/blacklist.h
  3. +3 −3 src/main.c
View
@@ -5,6 +5,9 @@
#include <string.h>
#include <stdlib.h>
+#include "helpers.h"
+#include "blacklist.h"
+
struct bl_entry {
char *domain;
@@ -31,7 +34,7 @@ static struct bl_entry *get_bl_entry(char *host) {
return NULL;
}
-static struct bl_entry *get_bl_entry_by_url(char *url, char *url_size) {
+static struct bl_entry *get_bl_entry_by_url(char *url, int url_size) {
// WARNING: duplicate code! (see main.c)
char *hostname_end = memchr(url + 7, '/', url_size - 7);
assert(hostname_end != NULL);
@@ -75,5 +78,5 @@ data_filter *bl_get_data_filter(char *url, int url_size) {
struct bl_entry *e = get_bl_entry_by_url(url, url_size);
if (e == NULL) return NULL;
-
+ YADA return NULL;
}
View
@@ -1,3 +1,5 @@
+typedef int data_filter; // FIXME!
+
void reload_blacklist();
int bl_check(char *host);
-data_filter *bl_get_data_filter(char *url, int url_size);
+data_filter *bl_get_data_filter(char *url, int url_size);
View
@@ -88,7 +88,7 @@ struct http_agent {
struct client_fd_watcher *client;
struct http_header *response_headers;
- data_filter data_filter;
+ data_filter *data_filter;
char ungzip_needed;
struct http_agent *prev, *next;
@@ -300,8 +300,8 @@ int on_server_headers_complete(http_parser *p) {
h = h->next;
}
a->data_filter = NULL;
-preserve_filter:
}
+preserve_filter:
a->ungzip_needed = 0;
@@ -315,7 +315,7 @@ int on_server_headers_complete(http_parser *p) {
if (strcasecmp(h->key, "Content-Length") == 0 || strcasecmp(h->key, "Transfer-Encoding") == 0) {
goto discard_header;
}
- if (intercept_response == 1) {
+ if (a->data_filter != NULL) {
if (strcasecmp(h->key, "Content-Encoding") == 0 && strcasecmp(h->value, "gzip") == 0) {
a->ungzip_needed = 1;
goto discard_header;

0 comments on commit 64eedc0

Please sign in to comment.