mirror of https://github.com/nealey/eris.git
fix for when if-modified-since not sent
This commit is contained in:
parent
03fb0e042c
commit
72e5fbb1d8
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ CXX=g++
|
||||||
#LIBOWFAT=../libowfat/
|
#LIBOWFAT=../libowfat/
|
||||||
#DIET=diet -Os
|
#DIET=diet -Os
|
||||||
|
|
||||||
CFLAGS=-Os -fomit-frame-pointer
|
CFLAGS += -Os -fomit-frame-pointer
|
||||||
#CFLAGS=-g
|
#CFLAGS=-g
|
||||||
|
|
||||||
all: fnord fnord-cgi fnord-idx
|
all: fnord fnord-cgi fnord-idx
|
||||||
|
|
14
httpd.c
14
httpd.c
|
@ -940,7 +940,6 @@ static struct stat st;
|
||||||
static int doit(char* buf,int buflen,char* url,int explicit) {
|
static int doit(char* buf,int buflen,char* url,int explicit) {
|
||||||
int fd=-1;
|
int fd=-1;
|
||||||
char* accept;
|
char* accept;
|
||||||
time_t ims;
|
|
||||||
while (url[0]=='/') ++url;
|
while (url[0]=='/') ++url;
|
||||||
getmimetype(url,explicit);
|
getmimetype(url,explicit);
|
||||||
{
|
{
|
||||||
|
@ -967,9 +966,16 @@ ok:
|
||||||
if (S_ISDIR(st.st_mode)) goto bad;
|
if (S_ISDIR(st.st_mode)) goto bad;
|
||||||
/* see if the peer accepts MIME type */
|
/* see if the peer accepts MIME type */
|
||||||
/* see if the document has been changed */
|
/* see if the document has been changed */
|
||||||
ims=timerfc(header(buf,buflen,"If-Modified-Since"));
|
{
|
||||||
//fprintf(stderr, "ims: %lu %lu %d\n", ims, st.st_mtime, st.st_mtime - ims);
|
char *field = header(buf,buflen,"If-Modified-Since");
|
||||||
if ((ims!=(time_t)-1) && (st.st_mtime<=ims)) { retcode=304; goto bad; }
|
|
||||||
|
if (field) {
|
||||||
|
time_t ims;
|
||||||
|
|
||||||
|
ims = timerfc(field);
|
||||||
|
if ((ims!=(time_t)-1) && (st.st_mtime<=ims)) { retcode=304; goto bad; }
|
||||||
|
}
|
||||||
|
}
|
||||||
rangestart=0; rangeend=st.st_size;
|
rangestart=0; rangeend=st.st_size;
|
||||||
if ((accept=header(buf,buflen,"Range"))) {
|
if ((accept=header(buf,buflen,"Range"))) {
|
||||||
/* format: "bytes=17-23", "bytes=23-" */
|
/* format: "bytes=17-23", "bytes=23-" */
|
||||||
|
|
Loading…
Reference in New Issue