author | Lars Hjemli <hjemli@gmail.com> | 2009-08-10 07:20:17 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-08-10 07:20:17 (UTC) |
commit | 8b2252b0b61617e9de9d9e9ba743881ad62523af (patch) (unidiff) | |
tree | 2d0f02d2c4a213644a1031a88af6578c032edbe6 /cgit.h | |
parent | 60a26272e0ca529407fe6b613f061f04ba585d53 (diff) | |
download | cgit-8b2252b0b61617e9de9d9e9ba743881ad62523af.zip cgit-8b2252b0b61617e9de9d9e9ba743881ad62523af.tar.gz cgit-8b2252b0b61617e9de9d9e9ba743881ad62523af.tar.bz2 |
ui-shared: add support for NO_HTTP=1/--nohttp
cgit_print_http_headers() used to do nothing if 'embedded' was
specified in cgitrc, but that was wrong - we never want to skip the
headers when invoked as a CGI app. Sadly, there's no easy way to
detect if we're invoked as a CGI app or if we're invoked by another
CGI app, so for the latter case cgit needs to be invoked with either
--nohttp on the command line or NO_HTTP=1 in the environment.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -118,169 +118,170 @@ struct reflist { | |||
118 | struct refinfo **refs; | 118 | struct refinfo **refs; |
119 | int alloc; | 119 | int alloc; |
120 | int count; | 120 | int count; |
121 | }; | 121 | }; |
122 | 122 | ||
123 | struct cgit_query { | 123 | struct cgit_query { |
124 | int has_symref; | 124 | int has_symref; |
125 | int has_sha1; | 125 | int has_sha1; |
126 | char *raw; | 126 | char *raw; |
127 | char *repo; | 127 | char *repo; |
128 | char *page; | 128 | char *page; |
129 | char *search; | 129 | char *search; |
130 | char *grep; | 130 | char *grep; |
131 | char *head; | 131 | char *head; |
132 | char *sha1; | 132 | char *sha1; |
133 | char *sha2; | 133 | char *sha2; |
134 | char *path; | 134 | char *path; |
135 | char *name; | 135 | char *name; |
136 | char *mimetype; | 136 | char *mimetype; |
137 | char *url; | 137 | char *url; |
138 | char *period; | 138 | char *period; |
139 | int ofs; | 139 | int ofs; |
140 | int nohead; | 140 | int nohead; |
141 | char *sort; | 141 | char *sort; |
142 | int showmsg; | 142 | int showmsg; |
143 | }; | 143 | }; |
144 | 144 | ||
145 | struct cgit_config { | 145 | struct cgit_config { |
146 | char *agefile; | 146 | char *agefile; |
147 | char *cache_root; | 147 | char *cache_root; |
148 | char *clone_prefix; | 148 | char *clone_prefix; |
149 | char *css; | 149 | char *css; |
150 | char *favicon; | 150 | char *favicon; |
151 | char *footer; | 151 | char *footer; |
152 | char *head_include; | 152 | char *head_include; |
153 | char *header; | 153 | char *header; |
154 | char *index_header; | 154 | char *index_header; |
155 | char *index_info; | 155 | char *index_info; |
156 | char *logo; | 156 | char *logo; |
157 | char *logo_link; | 157 | char *logo_link; |
158 | char *module_link; | 158 | char *module_link; |
159 | char *repo_group; | 159 | char *repo_group; |
160 | char *robots; | 160 | char *robots; |
161 | char *root_title; | 161 | char *root_title; |
162 | char *root_desc; | 162 | char *root_desc; |
163 | char *root_readme; | 163 | char *root_readme; |
164 | char *script_name; | 164 | char *script_name; |
165 | char *virtual_root; | 165 | char *virtual_root; |
166 | int cache_size; | 166 | int cache_size; |
167 | int cache_dynamic_ttl; | 167 | int cache_dynamic_ttl; |
168 | int cache_max_create_time; | 168 | int cache_max_create_time; |
169 | int cache_repo_ttl; | 169 | int cache_repo_ttl; |
170 | int cache_root_ttl; | 170 | int cache_root_ttl; |
171 | int cache_static_ttl; | 171 | int cache_static_ttl; |
172 | int embedded; | 172 | int embedded; |
173 | int enable_index_links; | 173 | int enable_index_links; |
174 | int enable_log_filecount; | 174 | int enable_log_filecount; |
175 | int enable_log_linecount; | 175 | int enable_log_linecount; |
176 | int local_time; | 176 | int local_time; |
177 | int max_repo_count; | 177 | int max_repo_count; |
178 | int max_commit_count; | 178 | int max_commit_count; |
179 | int max_lock_attempts; | 179 | int max_lock_attempts; |
180 | int max_msg_len; | 180 | int max_msg_len; |
181 | int max_repodesc_len; | 181 | int max_repodesc_len; |
182 | int max_stats; | 182 | int max_stats; |
183 | int nocache; | 183 | int nocache; |
184 | int noplainemail; | 184 | int noplainemail; |
185 | int noheader; | 185 | int noheader; |
186 | int renamelimit; | 186 | int renamelimit; |
187 | int snapshots; | 187 | int snapshots; |
188 | int summary_branches; | 188 | int summary_branches; |
189 | int summary_log; | 189 | int summary_log; |
190 | int summary_tags; | 190 | int summary_tags; |
191 | struct string_list mimetypes; | 191 | struct string_list mimetypes; |
192 | struct cgit_filter *about_filter; | 192 | struct cgit_filter *about_filter; |
193 | struct cgit_filter *commit_filter; | 193 | struct cgit_filter *commit_filter; |
194 | struct cgit_filter *source_filter; | 194 | struct cgit_filter *source_filter; |
195 | }; | 195 | }; |
196 | 196 | ||
197 | struct cgit_page { | 197 | struct cgit_page { |
198 | time_t modified; | 198 | time_t modified; |
199 | time_t expires; | 199 | time_t expires; |
200 | size_t size; | 200 | size_t size; |
201 | char *mimetype; | 201 | char *mimetype; |
202 | char *charset; | 202 | char *charset; |
203 | char *filename; | 203 | char *filename; |
204 | char *etag; | 204 | char *etag; |
205 | char *title; | 205 | char *title; |
206 | int status; | 206 | int status; |
207 | char *statusmsg; | 207 | char *statusmsg; |
208 | }; | 208 | }; |
209 | 209 | ||
210 | struct cgit_environment { | 210 | struct cgit_environment { |
211 | char *cgit_config; | 211 | char *cgit_config; |
212 | char *http_host; | 212 | char *http_host; |
213 | char *https; | 213 | char *https; |
214 | char *no_http; | ||
214 | char *path_info; | 215 | char *path_info; |
215 | char *query_string; | 216 | char *query_string; |
216 | char *request_method; | 217 | char *request_method; |
217 | char *script_name; | 218 | char *script_name; |
218 | char *server_name; | 219 | char *server_name; |
219 | char *server_port; | 220 | char *server_port; |
220 | }; | 221 | }; |
221 | 222 | ||
222 | struct cgit_context { | 223 | struct cgit_context { |
223 | struct cgit_environment env; | 224 | struct cgit_environment env; |
224 | struct cgit_query qry; | 225 | struct cgit_query qry; |
225 | struct cgit_config cfg; | 226 | struct cgit_config cfg; |
226 | struct cgit_repo *repo; | 227 | struct cgit_repo *repo; |
227 | struct cgit_page page; | 228 | struct cgit_page page; |
228 | }; | 229 | }; |
229 | 230 | ||
230 | struct cgit_snapshot_format { | 231 | struct cgit_snapshot_format { |
231 | const char *suffix; | 232 | const char *suffix; |
232 | const char *mimetype; | 233 | const char *mimetype; |
233 | write_archive_fn_t write_func; | 234 | write_archive_fn_t write_func; |
234 | int bit; | 235 | int bit; |
235 | }; | 236 | }; |
236 | 237 | ||
237 | extern const char *cgit_version; | 238 | extern const char *cgit_version; |
238 | 239 | ||
239 | extern struct cgit_repolist cgit_repolist; | 240 | extern struct cgit_repolist cgit_repolist; |
240 | extern struct cgit_context ctx; | 241 | extern struct cgit_context ctx; |
241 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; | 242 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; |
242 | 243 | ||
243 | extern struct cgit_repo *cgit_add_repo(const char *url); | 244 | extern struct cgit_repo *cgit_add_repo(const char *url); |
244 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); | 245 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); |
245 | extern void cgit_repo_config_cb(const char *name, const char *value); | 246 | extern void cgit_repo_config_cb(const char *name, const char *value); |
246 | 247 | ||
247 | extern int chk_zero(int result, char *msg); | 248 | extern int chk_zero(int result, char *msg); |
248 | extern int chk_positive(int result, char *msg); | 249 | extern int chk_positive(int result, char *msg); |
249 | extern int chk_non_negative(int result, char *msg); | 250 | extern int chk_non_negative(int result, char *msg); |
250 | 251 | ||
251 | extern char *trim_end(const char *str, char c); | 252 | extern char *trim_end(const char *str, char c); |
252 | extern char *strlpart(char *txt, int maxlen); | 253 | extern char *strlpart(char *txt, int maxlen); |
253 | extern char *strrpart(char *txt, int maxlen); | 254 | extern char *strrpart(char *txt, int maxlen); |
254 | 255 | ||
255 | extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); | 256 | extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); |
256 | extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, | 257 | extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, |
257 | int flags, void *cb_data); | 258 | int flags, void *cb_data); |
258 | 259 | ||
259 | extern void *cgit_free_commitinfo(struct commitinfo *info); | 260 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
260 | 261 | ||
261 | extern int cgit_diff_files(const unsigned char *old_sha1, | 262 | extern int cgit_diff_files(const unsigned char *old_sha1, |
262 | const unsigned char *new_sha1, | 263 | const unsigned char *new_sha1, |
263 | unsigned long *old_size, unsigned long *new_size, | 264 | unsigned long *old_size, unsigned long *new_size, |
264 | int *binary, linediff_fn fn); | 265 | int *binary, linediff_fn fn); |
265 | 266 | ||
266 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 267 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
267 | const unsigned char *new_sha1, | 268 | const unsigned char *new_sha1, |
268 | filepair_fn fn, const char *prefix); | 269 | filepair_fn fn, const char *prefix); |
269 | 270 | ||
270 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); | 271 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
271 | 272 | ||
272 | extern char *fmt(const char *format,...); | 273 | extern char *fmt(const char *format,...); |
273 | 274 | ||
274 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 275 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
275 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 276 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
276 | extern void cgit_parse_url(const char *url); | 277 | extern void cgit_parse_url(const char *url); |
277 | 278 | ||
278 | extern const char *cgit_repobasename(const char *reponame); | 279 | extern const char *cgit_repobasename(const char *reponame); |
279 | 280 | ||
280 | extern int cgit_parse_snapshots_mask(const char *str); | 281 | extern int cgit_parse_snapshots_mask(const char *str); |
281 | 282 | ||
282 | extern int cgit_open_filter(struct cgit_filter *filter); | 283 | extern int cgit_open_filter(struct cgit_filter *filter); |
283 | extern int cgit_close_filter(struct cgit_filter *filter); | 284 | extern int cgit_close_filter(struct cgit_filter *filter); |
284 | 285 | ||
285 | 286 | ||
286 | #endif /* CGIT_H */ | 287 | #endif /* CGIT_H */ |