diff options
author | tiptorrent development team <tiptorrent@soleta.eu> | 2021-09-13 11:32:21 +0200 |
---|---|---|
committer | tiptorrent development team <tiptorrent@soleta.eu> | 2021-09-29 15:48:14 +0200 |
commit | cbcc71db72efb91adf7d7dac275de8ba4e12af0c (patch) | |
tree | 2e45415475032a1672d28861f65ceafb950eadc5 /src/core.c | |
parent | d6dbb6c979bc785e501cf109a7d155635b1647ea (diff) |
add support for HEAD method
Diffstat (limited to 'src/core.c')
-rw-r--r-- | src/core.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -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); |