[4e2dfa]: sighttpd-oggbuffersize.patch Maximize Restore History

Download this file

sighttpd-oggbuffersize.patch    59 lines (50 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff -rupN sighttpd-1.1.0/src/ogg-stdin.c sighttpd-1.1.0-buffer-patch/src/ogg-stdin.c
--- sighttpd-1.1.0/src/ogg-stdin.c 2010-05-10 19:55:48.000000000 -0400
+++ sighttpd-1.1.0-buffer-patch/src/ogg-stdin.c 2013-06-03 05:58:49.767651809 -0400
@@ -8,6 +8,7 @@
#include <sys/stat.h>
#include <sys/sendfile.h>
#include <fcntl.h>
+#include <errno.h>
#include <pthread.h>
#include <oggz/oggz.h>
@@ -177,11 +178,11 @@ oggstdin_delete (void * data)
}
struct resource *
-oggstdin_resource (const char * path, const char * content_type)
+oggstdin_resource (const char * path, const char * content_type, size_t len)
{
struct oggstdin * st = &oggstdin_pvt;
unsigned char * data, * headers;
- size_t len = 4096*16*32;
+ //size_t len = 4096*16*32;
size_t header_len = 10 * 1024;
if ((data = malloc (len)) == NULL) {
@@ -220,16 +221,31 @@ oggstdin_resources (Dictionary * config)
list_t * l;
const char * path;
const char * ctype;
+ const char * buffersize;
+ size_t len;
l = list_new();
path = dictionary_lookup (config, "Path");
ctype = dictionary_lookup (config, "Type");
+ buffersize = dictionary_lookup (config, "BufferSize");
if (!ctype) ctype = DEFAULT_CONTENT_TYPE;
+ if(!buffersize)
+ {
+ len = 4096*16*32;
+ } else {
+ errno = 0;
+ len = (size_t)strtol(buffersize,NULL,10);
+ if(errno == ERANGE)
+ len = 4096*16*32;
+ if(len > (4096*4)) len = 4096*4;
+ len += len % (4096*4);
+ }
+
if (path)
- l = list_append (l, oggstdin_resource (path, ctype));
+ l = list_append (l, oggstdin_resource (path, ctype, len));
return l;
}