These days, A part that I was supposed to care was those resulting
from parse_time.c. It accepts only two formats. Please expand it.
I was troubled these formats.
Wed May 27 06:42:40 JST 2015
Sun, 24 May 2015 16:22:38 +0000
This function returns -1. Timestamp is NOT set.
Then, Polipo wants to unlink cache file. But still in use.
"Couldn't unlink <cache file>: Permission denied."
For example, I attach my patch for temporarily apply.
It does not matter not to commit this.
And,
Another attachment is minimal part of patch for appropriate behavior.
Please commit this.
diff -Nur ./polipo-master/config.c ./polipo-1.1.2/config.c
--- ./polipo-master/config.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/config.c Tue Apr 28 18:25:38 2015
@@ -852,7 +852,7 @@
configFloatSetter(ConfigVariablePtr var, void* value)
{
assert(var->type == CONFIG_FLOAT);
- *var->value.i = *(float*)value;
+ *var->value.f = *(float*)value;
return 1;
}
diff -Nur ./polipo-master/util.c ./polipo-1.1.2/util.c
--- ./polipo-master/util.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/util.c Tue Apr 28 18:37:23 2015
@@ -71,8 +71,10 @@
if(n < 0) return -2;
while(i < slen && n < len)
buf[n++] = s[i++];
- if(n < len)
+ if(n < len) {
+ buf[n] = 0;
return n;
+ }
else
return -1;
}
diff -Nur ./polipo-master/object.c ./polipo-1.1.2/object.c
--- ./polipo-master/object.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/object.c Tue Apr 28 18:25:38 2015
@@ -985,8 +985,8 @@
if(object->last_modified >= 0)
/* Again, take care of clock skew */
stale = MIN(stale,
- object->age +
- (date - object->last_modified) * maxAgeFraction);
+ (int) (object->age +
+ (date - object->last_modified) * maxAgeFraction) );
else
stale = MIN(stale, object->age + maxNoModifiedAge);
}
diff -Nur ./polipo-master/server.c ./polipo-1.1.2/server.c
--- ./polipo-master/server.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/server.c Tue Apr 28 18:25:38 2015
@@ -1207,7 +1207,7 @@
request->time0.tv_sec != null_time.tv_sec)
rtt = timeval_minus_usec(&request->time1, &request->time0);
if(size >= 8192 && d > 50000)
- rate = ((double)size / (double)d) * 1000000.0 + 0.5;
+ rate = (int)( ((double)size / (double)d) * 1000000.0 + 0.5 );
}
request->time0 = null_time;
request->time1 = null_time;
diff -Nur ./polipo-master/mingw.c ./polipo-1.1.2/mingw.c
--- ./polipo-master/mingw.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/mingw.c Tue Apr 28 18:25:38 2015
@@ -186,8 +186,8 @@
if(tv) {
GetSystemTimeAsFileTime(&ft);
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
+ li.u.LowPart = ft.dwLowDateTime;
+ li.u.HighPart = ft.dwHighDateTime;
t = li.QuadPart; /* In 100-nanosecond intervals */
t -= EPOCHFILETIME; /* Offset to the Epoch time */
t /= 10; /* In microseconds */
diff -Nur ./polipo-master/diskcache.c ./polipo-1.1.2/diskcache.c
--- ./polipo-master/diskcache.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/diskcache.c Tue May 12 20:47:52 2015
@@ -1008,8 +1008,10 @@
}
}
- if(location)
+ if(location) {
free(location);
+ location = NULL;
+ }
if(headers) {
if(!object->headers)
@@ -1051,8 +1053,10 @@
if(!object->etag)
object->etag = etag;
else {
- if(etag)
+ if(etag) {
free(etag);
+ etag = NULL;
+ }
}
releaseAtom(message);
@@ -1790,6 +1794,7 @@
if(dst->last_modified < 0)
dst->last_modified = src->last_modified;
free(src);
+ src = NULL;
}
DiskObjectPtr
--- ./polipo-master/http_parse.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/http_parse.c Fri May 29 05:26:01 2015
@@ -767,8 +767,8 @@
name_start, name_end, value_start, value_end,
token_start, token_end, end;
AtomPtr name = NULL;
- time_t date = -1, last_modified = -1, expires = -1, polipo_age = -1,
- polipo_access = -1, polipo_body_offset = -1;
+ time_t date = current_time.tv_sec, last_modified = -1, expires = -1,
polipo_age = -1,
+ polipo_access = current_time.tv_sec, polipo_body_offset = -1;
int len = -1;
CacheControlRec cache_control;
char *endptr;
@@ -987,7 +987,8 @@
else if(name == atomXPolipoDate)
polipo_age = t;
else if(name == atomXPolipoAccess)
- polipo_access = t;
+ if(t >= 0)
+ polipo_access = t;
} else if(name == atomAge) {
j = skipWhitespace(buf, value_start);
if(j < 0) {
--- ./polipo-master/parse_time.c Fri Nov 21 09:15:36 2014
+++ ./polipo-1.1.2/parse_time.c Sat May 30 20:10:09 2015
@@ -133,7 +133,7 @@
{
struct tm tm;
time_t t;
- int i = offset;
+ int i = offset, saved_i;
i = skip_word(buf, i, len); if(i < 0) return -1;
i = skip_separator(buf, i, len); if(i < 0) return -1;
@@ -161,7 +161,14 @@
i = skip_separator(buf, i, len); if(i < 0) return -1;
i = parse_int(buf, i, len, &tm.tm_sec); if(i < 0) return -1;
i = skip_separator(buf, i, len); if(i < 0) return -1;
- i = skip_word(buf, i, len); if(i < 0) return -1;
+ saved_i = i;
+ i = skip_word(buf, i, len);
+ if(i < 0) {
+ i = saved_i;
+ if(buf[i] != '+' && buf[i] != '-') return -1;
+ i++;
+ i = parse_int(buf, i, len, &saved_i); if(i < 0) return -1;
+ }
} else { /* funny American format */
i = parse_month(buf, i, len, &tm.tm_mon); if(i < 0) return -1;
i = skip_separator(buf, i, len); if(i < 0) return -1;
@@ -173,7 +180,14 @@
i = skip_separator(buf, i, len); if(i < 0) return -1;
i = parse_int(buf, i, len, &tm.tm_sec); if(i < 0) return -1;
i = skip_separator(buf, i, len); if(i < 0) return -1;
- i = parse_int(buf, i, len, &tm.tm_year); if(i < 0) return -1;
+ saved_i = i;
+ i = parse_int(buf, i, len, &tm.tm_year);
+ if(i < 0) {
+ i = saved_i;
+ i = skip_word(buf, i, len); if(i < 0) return -1;
+ i = skip_separator(buf, i, len); if(i < 0) return -1;
+ i = parse_int(buf, i, len, &tm.tm_year); if(i < 0) return -1;
+ }
if(tm.tm_year < 100)
tm.tm_year += 1900;
if(tm.tm_year < 1937)
------------------------------------------------------------------------------
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users