Переглянути джерело

Added function http_redo, which does a new request for the same url as an

old request and cancels the old request.
master
Richard Nyberg 18 роки тому
джерело
коміт
0c71b0ceb1
2 змінених файлів з 12 додано та 0 видалено
  1. +11
    -0
      btpd/http.c
  2. +1
    -0
      btpd/http.h

+ 11
- 0
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)
{


+ 1
- 0
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);


Завантаження…
Відмінити
Зберегти