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) 2010-2015 Reyk Floeter <reyk@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 enum {18 IMSG_NONE,19 IMSG_CTL_OK,20 IMSG_CTL_FAIL,21 IMSG_CTL_VERBOSE,22 IMSG_CTL_NOTIFY,23 IMSG_CTL_RESET,24 IMSG_CTL_PROCFD,25 IMSG_PROC_MAX26 };28 /* imsg */29 struct imsgev {30 struct imsgbuf ibuf;31 void (*handler)(int, short, void *);32 struct event ev;33 struct privsep_proc *proc;34 void *data;35 short events;36 };38 #define IMSG_SIZE_CHECK(imsg, p) do { \39 if (IMSG_DATA_SIZE(imsg) < sizeof(*p)) \40 fatalx("bad length imsg received (%s)", #p); \41 } while (0)42 #define IMSG_DATA_SIZE(imsg) ((imsg)->hdr.len - IMSG_HEADER_SIZE)44 struct ctl_conn {45 TAILQ_ENTRY(ctl_conn) entry;46 uint8_t flags;47 unsigned int waiting;48 #define CTL_CONN_NOTIFY 0x0149 struct imsgev iev;50 uid_t uid;51 };52 TAILQ_HEAD(ctl_connlist, ctl_conn);53 extern struct ctl_connlist ctl_conns;55 /* privsep */56 enum privsep_procid {57 PROC_GOTWEBD = 0,58 PROC_SOCKS,59 PROC_MAX,60 };61 extern enum privsep_procid privsep_process;63 #define CONFIG_RELOAD 0x0064 #define CONFIG_SOCKS 0x0165 #define CONFIG_ALL 0xff67 struct privsep_pipes {68 int *pp_pipes[PROC_MAX];69 };71 struct privsep {72 struct privsep_pipes *ps_pipes[PROC_MAX];73 struct privsep_pipes *ps_pp;75 struct imsgev *ps_ievs[PROC_MAX];76 const char *ps_title[PROC_MAX];77 uint8_t ps_what[PROC_MAX];79 struct passwd *ps_pw;80 int ps_noaction;82 unsigned int ps_instances[PROC_MAX];83 unsigned int ps_instance;85 /* Event and signal handlers */86 struct event ps_evsigint;87 struct event ps_evsigterm;88 struct event ps_evsigchld;89 struct event ps_evsighup;90 struct event ps_evsigpipe;91 struct event ps_evsigusr1;93 void *ps_env;94 };96 struct privsep_proc {97 const char *p_title;98 enum privsep_procid p_id;99 int (*p_cb)(int, struct privsep_proc *,100 struct imsg *);101 void (*p_init)(struct privsep *,102 struct privsep_proc *);103 void (*p_shutdown)(void);104 const char *p_chroot;105 struct passwd *p_pw;106 struct privsep *p_ps;107 };109 struct privsep_fd {110 enum privsep_procid pf_procid;111 unsigned int pf_instance;112 };114 #if DEBUG115 #define DPRINTF log_debug116 #else117 #define DPRINTF(x...) do {} while(0)118 #endif120 #define PROC_GOTWEBD_SOCK_FILENO 3121 #define PROC_MAX_INSTANCES 32123 /* proc.c */124 void proc_init(struct privsep *, struct privsep_proc *, unsigned int,125 int, char **, enum privsep_procid);126 void proc_kill(struct privsep *);127 void proc_connect(struct privsep *ps);128 void proc_dispatch(int, short event, void *);129 void proc_range(struct privsep *, enum privsep_procid, int *, int *);130 void proc_run(struct privsep *, struct privsep_proc *,131 struct privsep_proc *, unsigned int,132 void (*)(struct privsep *, struct privsep_proc *, void *), void *);133 void imsg_event_add(struct imsgev *);134 int imsg_compose_event(struct imsgev *, uint16_t, uint32_t,135 pid_t, int, void *, uint16_t);136 int imsg_composev_event(struct imsgev *, uint16_t, uint32_t,137 pid_t, int, const struct iovec *, int);138 int proc_compose_imsg(struct privsep *, enum privsep_procid, int,139 uint16_t, uint32_t, int, void *, uint16_t);140 int proc_compose(struct privsep *, enum privsep_procid,141 uint16_t, void *data, uint16_t);142 int proc_composev_imsg(struct privsep *, enum privsep_procid, int,143 uint16_t, uint32_t, int, const struct iovec *, int);144 int proc_composev(struct privsep *, enum privsep_procid,145 uint16_t, const struct iovec *, int);146 int proc_forward_imsg(struct privsep *, struct imsg *,147 enum privsep_procid, int);148 struct imsgbuf *149 proc_ibuf(struct privsep *, enum privsep_procid, int);150 struct imsgev *151 proc_iev(struct privsep *, enum privsep_procid, int);152 enum privsep_procid153 proc_getid(struct privsep_proc *, unsigned int, const char *);154 int proc_flush_imsg(struct privsep *, enum privsep_procid, int);156 /* log.c */157 void log_init(int, int);158 void log_procinit(const char *);159 void log_setverbose(int);160 int log_getverbose(void);161 void log_warn(const char *, ...)162 __attribute__((__format__ (printf, 1, 2)));163 void log_warnx(const char *, ...)164 __attribute__((__format__ (printf, 1, 2)));165 void log_info(const char *, ...)166 __attribute__((__format__ (printf, 1, 2)));167 void log_debug(const char *, ...)168 __attribute__((__format__ (printf, 1, 2)));169 void logit(int, const char *, ...)170 __attribute__((__format__ (printf, 2, 3)));171 void vlog(int, const char *, va_list)172 __attribute__((__format__ (printf, 2, 0)));173 __dead void fatal(const char *, ...)174 __attribute__((__format__ (printf, 1, 2)));175 __dead void fatalx(const char *, ...)176 __attribute__((__format__ (printf, 1, 2)));