|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
|
|
#
|
|
|
|
# Filename: package/.../cgit/fastcgi.diff
|
|
|
|
# Copyright (C) 2009 - 2010 The OpenSDE Project
|
|
|
|
#
|
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
|
#
|
|
|
|
# This patch file is dual-licensed. It is available under the license the
|
|
|
|
# patched project is licensed under, as long as it is an OpenSource license
|
|
|
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
|
|
|
# of the GNU General Public License as published by the Free Software
|
|
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
# version.
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
stolen from http://www.docunext.com/wiki/Cgit
|
|
|
|
|
|
|
|
--- ./git/wrapper.c.orig 2009-03-05 22:58:00.000000000 +0200
|
|
|
|
+++ ./git/wrapper.c 2009-03-05 22:59:49.000000000 +0200
|
|
|
|
@@ -133,6 +133,11 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ssize_t ywrite(int fd, const void *buf, size_t len)
|
|
|
|
+{
|
|
|
|
+ return printf("%.*s",len,buf);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
ssize_t read_in_full(int fd, void *buf, size_t count)
|
|
|
|
{
|
|
|
|
char *p = buf;
|
|
|
|
--- ./git/git-compat-util.h.orig 2009-03-05 22:57:28.000000000 +0200
|
|
|
|
+++ ./git/git-compat-util.h 2009-03-05 22:57:51.000000000 +0200
|
|
|
|
@@ -48,7 +48,7 @@
|
|
|
|
#define _BSD_SOURCE 1
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
-#include <stdio.h>
|
|
|
|
+#include <fcgi_stdio.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
--- ./Makefile.orig 2010-09-01 12:32:57.000000000 +0000
|
|
|
|
+++ ./Makefile 2010-09-09 13:34:31.000000000 +0000
|
|
|
|
@@ -71,7 +71,7 @@
|
|
|
|
$(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
|
|
|
|
|
|
|
|
|
|
|
|
-EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread
|
|
|
|
+EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread -lfcgi
|
|
|
|
OBJECTS =
|
|
|
|
OBJECTS += cache.o
|
|
|
|
OBJECTS += cgit.o
|
|
|
|
--- ./cache.c.orig 2009-03-05 22:36:46.000000000 +0200
|
|
|
|
+++ ./cache.c 2009-03-05 22:42:26.000000000 +0200
|
|
|
|
@@ -19,7 +19,7 @@
|
|
|
|
#define CACHE_BUFSIZE (1024 * 4)
|
|
|
|
|
|
|
|
struct cache_slot {
|
|
|
|
- const char *key;
|
|
|
|
+ char *key;
|
|
|
|
int keylen;
|
|
|
|
int ttl;
|
|
|
|
cache_fill_fn fn;
|
|
|
|
@@ -90,7 +90,7 @@
|
|
|
|
do {
|
|
|
|
i = j = xread(slot->cache_fd, slot->buf, sizeof(slot->buf));
|
|
|
|
if (i > 0)
|
|
|
|
- j = xwrite(STDOUT_FILENO, slot->buf, i);
|
|
|
|
+ j = ywrite(STDOUT_FILENO, slot->buf, i);
|
|
|
|
} while (i > 0 && j == i);
|
|
|
|
|
|
|
|
if (i < 0 || j != i)
|
|
|
|
@@ -308,7 +308,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print cached content to stdout, generate the content if necessary. */
|
|
|
|
-int cache_process(int size, const char *path, const char *key, int ttl,
|
|
|
|
+int cache_process(int size, char *path, const char *key, int ttl,
|
|
|
|
cache_fill_fn fn, void *cbdata)
|
|
|
|
{
|
|
|
|
unsigned long hash;
|
|
|
|
--- ./cache.h.orig 2009-03-05 22:44:25.000000000 +0200
|
|
|
|
+++ ./cache.h 2009-03-05 22:45:26.000000000 +0200
|
|
|
|
@@ -22,7 +22,7 @@
|
|
|
|
* Return value
|
|
|
|
* 0 indicates success, everyting else is an error
|
|
|
|
*/
|
|
|
|
-extern int cache_process(int size, const char *path, const char *key, int ttl,
|
|
|
|
+extern int cache_process(int size, char *path, const char *key, int ttl,
|
|
|
|
cache_fill_fn fn, void *cbdata);
|
|
|
|
|
|
|
|
|
|
|
|
--- ./cgit.c.orig 2010-09-01 12:32:57.000000000 +0000
|
|
|
|
+++ ./cgit.c 2010-09-09 14:28:04.000000000 +0000
|
|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
* (see COPYING for full license text)
|
|
|
|
*/
|
|
|
|
|
|
|
|
+#include <fcgi_stdio.h>
|
|
|
|
#include "cgit.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
@@ -720,12 +721,13 @@
|
|
|
|
return ctx.cfg.cache_repo_ttl;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int main(int argc, const char **argv)
|
|
|
|
+int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
- const char *path;
|
|
|
|
+ char *path;
|
|
|
|
char *qry;
|
|
|
|
- int err, ttl;
|
|
|
|
|
|
|
|
+ while (FCGI_Accept() >= 0) {
|
|
|
|
+ int err, ttl;
|
|
|
|
prepare_context(&ctx);
|
|
|
|
cgit_repolist.length = 0;
|
|
|
|
cgit_repolist.count = 0;
|
|
|
|
@@ -748,7 +750,6 @@
|
|
|
|
* long as PATH_INFO is included in the cache lookup key).
|
|
|
|
*/
|
|
|
|
path = ctx.env.path_info;
|
|
|
|
- if (!ctx.qry.url && path) {
|
|
|
|
if (path[0] == '/')
|
|
|
|
path++;
|
|
|
|
ctx.qry.url = xstrdup(path);
|
|
|
|
@@ -759,7 +760,6 @@
|
|
|
|
} else
|
|
|
|
ctx.qry.raw = xstrdup(ctx.qry.url);
|
|
|
|
cgit_parse_url(ctx.qry.url);
|
|
|
|
- }
|
|
|
|
|
|
|
|
ttl = calc_ttl();
|
|
|
|
ctx.page.expires += ttl*60;
|
|
|
|
@@ -772,5 +772,6 @@
|
|
|
|
if (err)
|
|
|
|
cgit_print_error(fmt("Error processing page: %s (%d)",
|
|
|
|
strerror(err), err));
|
|
|
|
- return err;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
}
|
|
|
|
--- ./html.c.orig 2009-03-05 22:54:24.000000000 +0200
|
|
|
|
+++ ./html.c 2009-03-05 22:54:37.000000000 +0200
|
|
|
|
@@ -7,7 +7,7 @@
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
-#include <stdio.h>
|
|
|
|
+#include <fcgi_stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|