diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-02-01 21:19:35 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-02-01 21:19:35 +0000 |
| commit | 0c71b0ceb1f11ecc9dbca6751e861ac3b9e6c1b9 (patch) | |
| tree | 0d88cd6756847436472069777115a55a5c113baa | |
| parent | 9af6e550817e99d669e458ea50b8dbe28f8f66fc (diff) | |
| download | btpd-0c71b0ceb1f11ecc9dbca6751e861ac3b9e6c1b9.tar.gz btpd-0c71b0ceb1f11ecc9dbca6751e861ac3b9e6c1b9.zip | |
Added function http_redo, which does a new request for the same url as an
old request and cancels the old request.
| -rw-r--r-- | btpd/http.c | 11 | ||||
| -rw-r--r-- | btpd/http.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/btpd/http.c b/btpd/http.c index cd42cfb..e75261a 100644 --- a/btpd/http.c +++ b/btpd/http.c @@ -88,6 +88,17 @@ http_get(struct http **ret, return 0; } +int +http_redo(struct http **http) +{ + int err; + struct http *ret; + err = http_get(&ret, (*http)->cb, "%s", (*http)->url); + http_cancel(*http); + *http = ret; + return err; +} + void http_cancel(struct http *http) { diff --git a/btpd/http.h b/btpd/http.h index 55a504f..4802f4e 100644 --- a/btpd/http.h +++ b/btpd/http.h @@ -20,6 +20,7 @@ int http_get(struct http **ret, void (*cb)(struct http *, struct http_res *, void *), void *arg, const char *fmt, ...); +int http_redo(struct http **http); void http_cancel(struct http *http); int http_succeeded(struct http_res *res); |