summaryrefslogtreecommitdiffstats
path: root/src/core.c
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-13 11:32:21 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-29 15:48:14 +0200
commitcbcc71db72efb91adf7d7dac275de8ba4e12af0c (patch)
tree2e45415475032a1672d28861f65ceafb950eadc5 /src/core.c
parentd6dbb6c979bc785e501cf109a7d155635b1647ea (diff)
add support for HEAD method
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core.c b/src/core.c
index b018207..c3d4c03 100644
--- a/src/core.c
+++ b/src/core.c
@@ -48,10 +48,12 @@ static void tip_client_release(struct ev_loop *loop, struct tip_client *cli)
free((void *)cli->uri);
free((void *)cli->path);
- num_clients--;
- if (tip_client_large_file(cli))
- tip_client_activate_pending();
+ if (cli->method == TIP_METHOD_GET) {
+ num_clients--;
+ if (tip_client_large_file(cli))
+ tip_client_activate_pending();
+ }
free(cli);
}
@@ -161,11 +163,15 @@ static void tip_client_read_cb(struct ev_loop *loop, struct ev_io *io, int event
ntohs(cli->addr.sin_port));
goto close;
}
-
- syslog(LOG_INFO, "client %s:%hu starts download for %s\n",
- inet_ntoa(cli->addr.sin_addr),
- ntohs(cli->addr.sin_port), cli->uri);
-
+ if (cli->method == TIP_METHOD_GET) {
+ syslog(LOG_INFO, "client %s:%hu starts download for %s\n",
+ inet_ntoa(cli->addr.sin_addr),
+ ntohs(cli->addr.sin_port), cli->uri);
+ } else {
+ syslog(LOG_INFO, "client %s:%hu checks if %s exists\n",
+ inet_ntoa(cli->addr.sin_addr),
+ ntohs(cli->addr.sin_port), cli->uri);
+ }
ev_io_stop(loop, &cli->io);
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
ev_io_start(loop, &cli->io);