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.

156 lines
4.1 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 - 2010 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 2010-09-01 12:32:57.000000000 +0000
  41. +++ ./Makefile 2010-09-09 13:34:31.000000000 +0000
  42. @@ -71,7 +71,7 @@
  43. $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
  44. -EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread
  45. +EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread -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 2010-09-01 12:32:57.000000000 +0000
  85. +++ ./cgit.c 2010-09-09 14:28:04.000000000 +0000
  86. @@ -7,6 +7,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. @@ -720,12 +721,13 @@
  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 *path;
  100. + char *path;
  101. char *qry;
  102. - int err, ttl;
  103. + while (FCGI_Accept() >= 0) {
  104. + int err, ttl;
  105. prepare_context(&ctx);
  106. cgit_repolist.length = 0;
  107. cgit_repolist.count = 0;
  108. @@ -748,7 +750,6 @@
  109. * long as PATH_INFO is included in the cache lookup key).
  110. */
  111. path = ctx.env.path_info;
  112. - if (!ctx.qry.url && path) {
  113. if (path[0] == '/')
  114. path++;
  115. ctx.qry.url = xstrdup(path);
  116. @@ -759,7 +760,6 @@
  117. } else
  118. ctx.qry.raw = xstrdup(ctx.qry.url);
  119. cgit_parse_url(ctx.qry.url);
  120. - }
  121. ttl = calc_ttl();
  122. ctx.page.expires += ttl*60;
  123. @@ -772,5 +772,6 @@
  124. if (err)
  125. cgit_print_error(fmt("Error processing page: %s (%d)",
  126. strerror(err), err));
  127. - return err;
  128. + }
  129. + return 0;
  130. }
  131. --- ./html.c.orig 2009-03-05 22:54:24.000000000 +0200
  132. +++ ./html.c 2009-03-05 22:54:37.000000000 +0200
  133. @@ -7,7 +7,7 @@
  134. */
  135. #include <unistd.h>
  136. -#include <stdio.h>
  137. +#include <fcgi_stdio.h>
  138. #include <stdlib.h>
  139. #include <stdarg.h>
  140. #include <string.h>