Blob
- Date:
- Message:
- import gotwebd thread fcgi response to client for rendering in browser as data is returned fix potential problem with a stuck loop if the client is hammering the server with random clicks and stop/restarts render our index! WOOHOO! small var refactoring. fcgi.c to handle all clean-up, various error clean-up remove output used to trace down got bug temporarily stop overloading a socket, but a better solution needs to be found return on fcgi_gen_response, so we can track if a client is writable or not this stops page creation when the client is unavailable remove old comments enable profile building, although, i don't think this works thoroughly in a priv/proc daemon catch more errors correctly count repos remove temp logger we don't need to start our responder thread so early. move it to fcgi.c and start when we start processing html kill the unneeded thread, stop queueing responses, and just write to clients immediately clean up some memory leaks and dead stores rework querystring so an error can be displayed instead of showing the index on querystring error get framework in place for the rest of the content add server struct to response struct bo last commit get back a usable gotweb. not sure what i was thinking yesterday properly move our structs around this time remember index page for sitelink, fix leak unused var is annoying, so stop it for now. don't forget to change this! style briefs nearly completed. finish briefs output add briefs to summary cleanup some html properly retrieve next and previous commit ids for list navigation follow naddy's stailq macro change we will never have a previous link on the summary page goto correct label, so we get a previous link on the last page of briefs don't wrap short line simplify got_get_repo_commits code start rendering a diff start rendering a diff this was by accident finish diff output functions cleanup prepare for fd request that was a stupid idea, just flush the priv_fd bo that too. that won't work eith with append in mkstemp that isn't going to work actually zero out the priv_fd missed seek to beginning of file was overwriting first line of diff fsync our fd as well add link to repo path by sitelink and add back verbose fcgi debugging that was removed add modest write heuristics to fcgi_send_response fix dead assignments and XXX comment where a leak is happening that I can't find right now there was no leak. stsp is brilliant and knew it was the cache growing prevent double-free, render prettier err output if we can remove unused variables correctly fix double-free fix gotwebd to build with main's changes after rebase fix double-free don't error on index if pack files missing and fixup some error handling render commits finish up tag briefs and start the tag page finish up tag page unbreak TAGS and SUMMARY actions grab the correct tag from the queue unbreak TAGS and SUMMARY actions again update some error handling clean up unneeded code and start tree output render tree render branches remove tags from summary if there aren't any fix tree div structure and start blob render render blob render blame fix tree href in briefs clean up some css add headref to querystrings load correct commit for tree and diff fixup some error output update some copyright dates add full SNI support rm debug line found by Lucas6023, notified via IRC. thanks!! fix tree fix crash when querystring is manipulated to not have a commit id in certain instances. also break a stuck while loop on client error. fix for new got_object_id_by_path arguments rebase and fix prep for multiple fds per socket, instead of just one fix overlooked shift/reduce conflicts backout priv_fds as a list. after discussion with stsp, an array and length are the better direction prepare array of fds to pass into got functions make a new set of pack fds, which will be passed to got_repo_open work with new pack_fds in got_repo_open give output when no tags exist escape html in blame output change files listed in tree view to show blob, file commits, and blame, instead of blob, blob, blame. idea from mp4 on irc. this is way more handy. stop populating the queue from the headref and figure out previous commit id while iterating. this should reduce some overhead. actually purge our sockets instead of not using the function start work with new blob rm volatile use new diff change func names no more temp files increase blame number line width set content-type to text/plain so firefox won't download files rm test infra for now account for -Wwrite-strings fix for sigs and algorithm choice clean up some leaks and other mistakes
- Actions:
- History | Blame | Raw File
1 /*2 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>3 *4 * Permission to use, copy, modify, and distribute this software for any5 * purpose with or without fee is hereby granted, provided that the above6 * copyright notice and this permission notice appear in all copies.7 *8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.15 */17 #include <stdio.h>18 #include <stdlib.h>19 #include <stdarg.h>20 #include <string.h>21 #include <syslog.h>22 #include <errno.h>23 #include <time.h>25 static int debug;26 static int verbose;27 const char *log_procname;29 void log_init(int, int);30 void log_procinit(const char *);31 void log_setverbose(int);32 int log_getverbose(void);33 void log_warn(const char *, ...)34 __attribute__((__format__ (printf, 1, 2)));35 void log_warnx(const char *, ...)36 __attribute__((__format__ (printf, 1, 2)));37 void log_info(const char *, ...)38 __attribute__((__format__ (printf, 1, 2)));39 void log_debug(const char *, ...)40 __attribute__((__format__ (printf, 1, 2)));41 void logit(int, const char *, ...)42 __attribute__((__format__ (printf, 2, 3)));43 void vlog(int, const char *, va_list)44 __attribute__((__format__ (printf, 2, 0)));45 __dead void fatal(const char *, ...)46 __attribute__((__format__ (printf, 1, 2)));47 __dead void fatalx(const char *, ...)48 __attribute__((__format__ (printf, 1, 2)));50 void51 log_init(int n_debug, int facility)52 {53 debug = n_debug;54 verbose = n_debug;55 log_procinit(getprogname());57 if (!debug)58 openlog(getprogname(), LOG_PID | LOG_NDELAY, facility);60 tzset();61 }63 void64 log_procinit(const char *procname)65 {66 if (procname != NULL)67 log_procname = procname;68 }70 void71 log_setverbose(int v)72 {73 verbose = v;74 }76 int77 log_getverbose(void)78 {79 return (verbose);80 }82 void83 logit(int pri, const char *fmt, ...)84 {85 va_list ap;87 va_start(ap, fmt);88 vlog(pri, fmt, ap);89 va_end(ap);90 }92 void93 vlog(int pri, const char *fmt, va_list ap)94 {95 char *nfmt;96 int saved_errno = errno;98 if (debug) {99 /* best effort in out of mem situations */100 if (asprintf(&nfmt, "%s\n", fmt) == -1) {101 vfprintf(stderr, fmt, ap);102 fprintf(stderr, "\n");103 } else {104 vfprintf(stderr, nfmt, ap);105 free(nfmt);106 }107 fflush(stderr);108 } else109 vsyslog(pri, fmt, ap);111 errno = saved_errno;112 }114 void115 log_warn(const char *emsg, ...)116 {117 char *nfmt;118 va_list ap;119 int saved_errno = errno;121 /* best effort to even work in out of memory situations */122 if (emsg == NULL)123 logit(LOG_CRIT, "%s", strerror(saved_errno));124 else {125 va_start(ap, emsg);127 if (asprintf(&nfmt, "%s: %s", emsg,128 strerror(saved_errno)) == -1) {129 /* we tried it... */130 vlog(LOG_CRIT, emsg, ap);131 logit(LOG_CRIT, "%s", strerror(saved_errno));132 } else {133 vlog(LOG_CRIT, nfmt, ap);134 free(nfmt);135 }136 va_end(ap);137 }139 errno = saved_errno;140 }142 void143 log_warnx(const char *emsg, ...)144 {145 va_list ap;147 va_start(ap, emsg);148 vlog(LOG_CRIT, emsg, ap);149 va_end(ap);150 }152 void153 log_info(const char *emsg, ...)154 {155 va_list ap;157 va_start(ap, emsg);158 vlog(LOG_INFO, emsg, ap);159 va_end(ap);160 }162 void163 log_debug(const char *emsg, ...)164 {165 va_list ap;167 if (verbose > 1) {168 va_start(ap, emsg);169 vlog(LOG_DEBUG, emsg, ap);170 va_end(ap);171 }172 }174 static void175 vfatalc(int code, const char *emsg, va_list ap)176 {177 static char s[BUFSIZ];178 const char *sep;180 if (emsg != NULL) {181 (void)vsnprintf(s, sizeof(s), emsg, ap);182 sep = ": ";183 } else {184 s[0] = '\0';185 sep = "";186 }187 if (code)188 logit(LOG_CRIT, "%s: %s%s%s",189 log_procname, s, sep, strerror(code));190 else191 logit(LOG_CRIT, "%s%s%s", log_procname, sep, s);192 }194 void195 fatal(const char *emsg, ...)196 {197 va_list ap;199 va_start(ap, emsg);200 vfatalc(errno, emsg, ap);201 va_end(ap);202 exit(1);203 }205 void206 fatalx(const char *emsg, ...)207 {208 va_list ap;210 va_start(ap, emsg);211 vfatalc(0, emsg, ap);212 va_end(ap);213 exit(1);214 }