示例#1
0
int main(int argc, char** argv) {
	RSScript ss, *s = &ss;
	rss_init(s, argc, argv);
	
	rss_http_request* req = rss_get_request(s);
	if(!req) return 1;
	
	if(!rss_is_cookie_authed(s)) {
		rss_redirect_hard(s, SPLITERAL("/login.html"));
		rss_free(s);
		exit(0);
	}
	
	rss_set_cookie_authed(s, NULL);
	
	stringptr *x, *y;
	
	if((kv_find(req->formdata, SPLITERAL("list"), (void**) &x))) {
		y = stringptr_replace(x, SPLITERAL("\r"), SPLITERAL(""));
		stringptr_tofile("/tmp/testfile", y);
		stringptr_free(y);
		rss_redirect_soft(s, SPLITERAL("main.cgi"));
	} else
		rss_respond500(s);
	
	rss_free(s);
	return 0;
}
示例#2
0
int main(int argc, char** argv) {
	stringptr* html = SPLITERAL("<HTML>\n<BODY>\n<A HREF=\"/upload.html\">upload a file</A>\n<A HREF=\"/form.html\">test form</A>\n</BODY>\n</HTML>");

	RSScript ss, *s = &ss;
	rss_init(s, argc, argv);
	
	rss_http_request* req = rss_get_request(s);
	(void) req;
	
	if(!rss_is_cookie_authed(s)) {
		rss_redirect_hard(s, SPLITERAL("/login.html"));
		rss_free(s);
		exit(0);
	}
	
	rss_set_cookie_authed(s, NULL);
	rss_set_responsetype(s, 200);
	rss_set_contenttype(s, SPLITERAL("text/html"));
	rss_respond(s, html);
	rss_submit(s);
	
	rss_free(s);
	return 0;
}
示例#3
0
文件: main.c 项目: Neal/Readebble
int main(void) {
	rss_init();
	app_event_loop();
	rss_deinit();
}