OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.2 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../cgit/fastcgi.diff
  5. # Copyright (C) 2009 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. stolen from http://www.docunext.com/wiki/Cgit
  17. --- ./git/wrapper.c.orig 2009-03-05 22:58:00.000000000 +0200
  18. +++ ./git/wrapper.c 2009-03-05 22:59:49.000000000 +0200
  19. @@ -133,6 +133,11 @@
  20. }
  21. }
  22. +ssize_t ywrite(int fd, const void *buf, size_t len)
  23. +{
  24. + return printf("%.*s",len,buf);
  25. +}
  26. +
  27. ssize_t read_in_full(int fd, void *buf, size_t count)
  28. {
  29. char *p = buf;
  30. --- ./git/git-compat-util.h.orig 2009-03-05 22:57:28.000000000 +0200
  31. +++ ./git/git-compat-util.h 2009-03-05 22:57:51.000000000 +0200
  32. @@ -48,7 +48,7 @@
  33. #define _BSD_SOURCE 1
  34. #include <unistd.h>
  35. -#include <stdio.h>
  36. +#include <fcgi_stdio.h>
  37. #include <sys/stat.h>
  38. #include <fcntl.h>
  39. #include <stddef.h>
  40. --- ./Makefile.orig 2009-03-05 22:36:24.000000000 +0200
  41. +++ ./Makefile 2009-03-05 22:36:39.000000000 +0200
  42. @@ -68,7 +68,7 @@
  43. $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
  44. -EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto
  45. +EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto -lfcgi
  46. OBJECTS =
  47. OBJECTS += cache.o
  48. OBJECTS += cgit.o
  49. --- ./cache.c.orig 2009-03-05 22:36:46.000000000 +0200
  50. +++ ./cache.c 2009-03-05 22:42:26.000000000 +0200
  51. @@ -19,7 +19,7 @@
  52. #define CACHE_BUFSIZE (1024 * 4)
  53. struct cache_slot {
  54. - const char *key;
  55. + char *key;
  56. int keylen;
  57. int ttl;
  58. cache_fill_fn fn;
  59. @@ -90,7 +90,7 @@
  60. do {
  61. i = j = xread(slot->cache_fd, slot->buf, sizeof(slot->buf));
  62. if (i > 0)
  63. - j = xwrite(STDOUT_FILENO, slot->buf, i);
  64. + j = ywrite(STDOUT_FILENO, slot->buf, i);
  65. } while (i > 0 && j == i);
  66. if (i < 0 || j != i)
  67. @@ -308,7 +308,7 @@
  68. }
  69. /* Print cached content to stdout, generate the content if necessary. */
  70. -int cache_process(int size, const char *path, const char *key, int ttl,
  71. +int cache_process(int size, char *path, const char *key, int ttl,
  72. cache_fill_fn fn, void *cbdata)
  73. {
  74. unsigned long hash;
  75. --- ./cache.h.orig 2009-03-05 22:44:25.000000000 +0200
  76. +++ ./cache.h 2009-03-05 22:45:26.000000000 +0200
  77. @@ -22,7 +22,7 @@
  78. * Return value
  79. * 0 indicates success, everyting else is an error
  80. */
  81. -extern int cache_process(int size, const char *path, const char *key, int ttl,
  82. +extern int cache_process(int size, char *path, const char *key, int ttl,
  83. cache_fill_fn fn, void *cbdata);
  84. --- ./cgit.c.orig 2009-03-05 22:49:34.000000000 +0200
  85. +++ ./cgit.c 2009-03-05 22:53:58.000000000 +0200
  86. @@ -6,6 +6,7 @@
  87. * (see COPYING for full license text)
  88. */
  89. +#include <fcgi_stdio.h>
  90. #include "cgit.h"
  91. #include "cache.h"
  92. #include "cmd.h"
  93. @@ -426,13 +427,15 @@
  94. return ctx.cfg.cache_repo_ttl;
  95. }
  96. -int main(int argc, const char **argv)
  97. +int main(int argc, char **argv)
  98. {
  99. - const char *cgit_config_env = getenv("CGIT_CONFIG");
  100. - const char *path;
  101. + char *path;
  102. char *qry;
  103. - int err, ttl;
  104. + while (FCGI_Accept() >= 0) {
  105. + const char *cgit_config_env = getenv("CGIT_CONFIG");
  106. + int err, ttl;
  107. +
  108. prepare_context(&ctx);
  109. cgit_repolist.length = 0;
  110. cgit_repolist.count = 0;
  111. @@ -460,7 +463,6 @@
  112. * long as PATH_INFO is included in the cache lookup key).
  113. */
  114. path = getenv("PATH_INFO");
  115. - if (!ctx.qry.url && path) {
  116. if (path[0] == '/')
  117. path++;
  118. ctx.qry.url = xstrdup(path);
  119. @@ -471,7 +473,6 @@
  120. } else
  121. ctx.qry.raw = ctx.qry.url;
  122. cgit_parse_url(ctx.qry.url);
  123. - }
  124. ttl = calc_ttl();
  125. ctx.page.expires += ttl*60;
  126. @@ -482,5 +483,6 @@
  127. if (err)
  128. cgit_print_error(fmt("Error processing page: %s (%d)",
  129. strerror(err), err));
  130. - return err;
  131. + }
  132. + return 0;
  133. }
  134. --- ./html.c.orig 2009-03-05 22:54:24.000000000 +0200
  135. +++ ./html.c 2009-03-05 22:54:37.000000000 +0200
  136. @@ -7,7 +7,7 @@
  137. */
  138. #include <unistd.h>
  139. -#include <stdio.h>
  140. +#include <fcgi_stdio.h>
  141. #include <stdlib.h>
  142. #include <stdarg.h>
  143. #include <string.h>