summaryrefslogtreecommitdiff
path: root/sys/src/libhttpd/checkcontent.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/libhttpd/checkcontent.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/libhttpd/checkcontent.c')
-rwxr-xr-xsys/src/libhttpd/checkcontent.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/src/libhttpd/checkcontent.c b/sys/src/libhttpd/checkcontent.c
new file mode 100755
index 000000000..1b535ec91
--- /dev/null
+++ b/sys/src/libhttpd/checkcontent.c
@@ -0,0 +1,33 @@
+#include <u.h>
+#include <libc.h>
+#include <bin.h>
+#include <httpd.h>
+
+int
+hcheckcontent(HContent *me, HContent *oks, char *list, int size)
+{
+ HContent *ok;
+
+ if(oks == nil || me == nil)
+ return 1;
+ for(ok = oks; ok != nil; ok = ok->next){
+ if((cistrcmp(ok->generic, me->generic) == 0 || strcmp(ok->generic, "*") == 0)
+ && (me->specific == nil || cistrcmp(ok->specific, me->specific) == 0 || strcmp(ok->specific, "*") == 0)){
+ if(ok->mxb > 0 && size > ok->mxb)
+ return 0;
+ return 1;
+ }
+ }
+
+ USED(list);
+ if(0){
+ fprint(2, "list: %s/%s not found\n", me->generic, me->specific);
+ for(; oks != nil; oks = oks->next){
+ if(oks->specific)
+ fprint(2, "\t%s/%s\n", oks->generic, oks->specific);
+ else
+ fprint(2, "\t%s\n", oks->generic);
+ }
+ }
+ return 0;
+}