aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-10-27 18:57:20 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-10-27 18:57:20 +0100
commit259155baae3365b963d3522b813111f9a70b5810 (patch)
treed870024c72e9307d7506df6e3dc8f88647f9e122
parent34fc1a5dfc7c6fe730ec554f9244f1e10a62c60d (diff)
downloadpaccache-259155baae3365b963d3522b813111f9a70b5810.tar.gz
paccache-259155baae3365b963d3522b813111f9a70b5810.tar.zst
do not check for pacman db files
-rw-r--r--pacredir.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/pacredir.c b/pacredir.c
index a197012..d465a8c 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -254,28 +254,38 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection, const char *
}
if (*upload_data_size != 0)
return MHD_NO; /* upload data in a GET!? */
- *ptr = NULL; /* clear context pointer */
- /* try to find a server */
- while (tmphosts->host != NULL) {
- gettimeofday(&tv, NULL);
+ /* clear context pointer */
+ *ptr = NULL;
- /* skip host if offline or had a bad request within last BADTIME seconds */
- if (tmphosts->offline == 1 || tmphosts->bad + BADTIME > tv.tv_sec) {
- tmphosts = tmphosts->next;
- continue;
- }
+ /* do not process db requests */
+ /* TODO: do some timestamp magic to find suitable db files */
+ if (strcmp(basename + strlen(basename) - 3, ".db") == 0) {
+# if defined DEBUG
+ printf("Not precessing db file request for %s\n", basename);
+# endif
+ } else {
+ /* try to find a server */
+ while (tmphosts->host != NULL) {
+ gettimeofday(&tv, NULL);
- url = malloc(10 + strlen(tmphosts->host) + 5 + strlen(basename));
- sprintf(url, "http://%s:%d/%s", tmphosts->host, tmphosts->port, basename);
+ /* skip host if offline or had a bad request within last BADTIME seconds */
+ if (tmphosts->offline == 1 || tmphosts->bad + BADTIME > tv.tv_sec) {
+ tmphosts = tmphosts->next;
+ continue;
+ }
- printf("Trying %s\n", url);
- if ((http_code = get_http_code(tmphosts->host, tmphosts->port, url)) == MHD_HTTP_OK)
- break;
- else if (http_code == -1)
- tmphosts->bad = tv.tv_sec;
+ url = malloc(10 + strlen(tmphosts->host) + 5 + strlen(basename));
+ sprintf(url, "http://%s:%d/%s", tmphosts->host, tmphosts->port, basename);
- tmphosts = tmphosts->next;
+ printf("Trying %s\n", url);
+ if ((http_code = get_http_code(tmphosts->host, tmphosts->port, url)) == MHD_HTTP_OK)
+ break;
+ else if (http_code == -1)
+ tmphosts->bad = tv.tv_sec;
+
+ tmphosts = tmphosts->next;
+ }
}
/* give response */