diff options
| -rw-r--r-- | data.c | 8 | ||||
| -rw-r--r-- | xs_curl.h | 4 | ||||
| -rw-r--r-- | xs_socket.h | 6 |
3 files changed, 12 insertions, 6 deletions
| @@ -266,13 +266,19 @@ d_char *_timeline_find_fn(snac *snac, char *id) | |||
| 266 | xs *spec = xs_fmt("%s/timeline/" "*-%s.json", snac->basedir, md5); | 266 | xs *spec = xs_fmt("%s/timeline/" "*-%s.json", snac->basedir, md5); |
| 267 | xs *list = NULL; | 267 | xs *list = NULL; |
| 268 | d_char *fn = NULL; | 268 | d_char *fn = NULL; |
| 269 | int l; | ||
| 269 | 270 | ||
| 270 | list = xs_glob(spec, 0, 0); | 271 | list = xs_glob(spec, 0, 0); |
| 272 | l = xs_list_len(list); | ||
| 271 | 273 | ||
| 272 | /* if there is something, get the first one */ | 274 | /* if there is something, get the first one */ |
| 273 | if (xs_list_len(list) > 0) | 275 | if (l > 0) { |
| 274 | fn = xs_str_new(xs_list_get(list, 0)); | 276 | fn = xs_str_new(xs_list_get(list, 0)); |
| 275 | 277 | ||
| 278 | if (l > 1) | ||
| 279 | snac_log(snac, xs_fmt("**ALERT** _timeline_find_fn %d > 1", l)); | ||
| 280 | } | ||
| 281 | |||
| 276 | return fn; | 282 | return fn; |
| 277 | } | 283 | } |
| 278 | 284 | ||
| @@ -29,11 +29,11 @@ static size_t _header_callback(char *buffer, size_t size, | |||
| 29 | 29 | ||
| 30 | xs_tolower(xs_list_get(knv, 0)); | 30 | xs_tolower(xs_list_get(knv, 0)); |
| 31 | 31 | ||
| 32 | headers = xs_dict_append(headers, xs_list_get(knv, 0), xs_list_get(knv, 1)); | 32 | headers = xs_dict_set(headers, xs_list_get(knv, 0), xs_list_get(knv, 1)); |
| 33 | } | 33 | } |
| 34 | else | 34 | else |
| 35 | if (xs_startswith(l, "HTTP/")) | 35 | if (xs_startswith(l, "HTTP/")) |
| 36 | headers = xs_dict_append(headers, "_proto", l); | 36 | headers = xs_dict_set(headers, "_proto", l); |
| 37 | 37 | ||
| 38 | *userdata = headers; | 38 | *userdata = headers; |
| 39 | 39 | ||
diff --git a/xs_socket.h b/xs_socket.h index c5eab80..e4a18ec 100644 --- a/xs_socket.h +++ b/xs_socket.h | |||
| @@ -82,10 +82,10 @@ FILE *xs_socket_accept(int rs) | |||
| 82 | /* accepts an incoming connection */ | 82 | /* accepts an incoming connection */ |
| 83 | { | 83 | { |
| 84 | int cs = -1; | 84 | int cs = -1; |
| 85 | struct sockaddr_in host; | 85 | struct sockaddr_storage addr; |
| 86 | socklen_t l = sizeof(host); | 86 | socklen_t l = sizeof(addr); |
| 87 | 87 | ||
| 88 | cs = accept(rs, (struct sockaddr *)&host, &l); | 88 | cs = accept(rs, (struct sockaddr *)&addr, &l); |
| 89 | 89 | ||
| 90 | return cs == -1 ? NULL : fdopen(cs, "r+"); | 90 | return cs == -1 ? NULL : fdopen(cs, "r+"); |
| 91 | } | 91 | } |