Lines Matching +full:stdout +full:- +full:path
10 #include "../util-internal.h"
112 /* Try to guess a good content-type for 'path' */
114 guess_content_type(const char *path) in guess_content_type() argument
118 last_period = strrchr(path, '.'); in guess_content_type()
122 for (ent = &content_type_table[0]; ent->extension; ++ent) { in guess_content_type()
123 if (!evutil_ascii_strcasecmp(ent->extension, extension)) in guess_content_type()
124 return ent->content_type; in guess_content_type()
131 /* Callback used for the /dump URI, and for every non-GET request:
132 * dumps all information to stdout and gives back a trivial 200 ok */
158 for (header = headers->tqh_first; header; in dump_request_cb()
159 header = header->next.tqe_next) { in dump_request_cb()
160 printf(" %s: %s\n", header->key, header->value); in dump_request_cb()
170 (void) fwrite(cbuf, 1, n, stdout); in dump_request_cb()
188 const char *path; in send_document_cb() local
192 int fd = -1; in send_document_cb()
210 /* Let's see what path the user asked for. */ in send_document_cb()
211 path = evhttp_uri_get_path(decoded); in send_document_cb()
212 if (!path) path = "/"; in send_document_cb()
214 /* We need to decode it, to see what path the user really wanted. */ in send_document_cb()
215 decoded_path = evhttp_uridecode(path, 0, NULL); in send_document_cb()
218 /* Don't allow any ".."s in the path, to avoid exposing stuff outside in send_document_cb()
225 len = strlen(decoded_path)+strlen(o->docroot)+2; in send_document_cb()
230 evutil_snprintf(whole_path, len, "%s/%s", o->docroot, decoded_path); in send_document_cb()
253 if (!strlen(path) || path[strlen(path)-1] != '/') in send_document_cb()
275 " <meta charset='utf-8'>\n" in send_document_cb()
282 decoded_path, /* XXX html-escape this. */ in send_document_cb()
283 path, /* XXX html-escape this? */ in send_document_cb()
285 decoded_path /* XXX html-escape this */); in send_document_cb()
291 const char *name = ent->d_name; in send_document_cb()
308 "Content-Type", "text/html"); in send_document_cb()
325 "Content-Type", type); in send_document_cb()
351 " -p - port\n" in print_usage()
352 " -U - bind to unix socket\n" in print_usage()
353 " -u - unlink unix socket before bind\n" in print_usage()
354 " -I - IOCP\n" in print_usage()
355 " -v - verbosity, enables libevent debug logging too\n", prog); in print_usage()
366 while ((opt = getopt(argc, argv, "hp:U:uIv")) != -1) { in parse_opts()
373 case 'h': print_usage(stdout, argv[0], 0); break; in parse_opts()
378 if (optind >= argc || (argc - optind) > 1) { in parse_opts()
379 print_usage(stdout, argv[0], 1); in parse_opts()
403 int got_port = -1; in display_listen_sock()
413 got_port = ntohs(((struct sockaddr_in*)&ss)->sin_port); in display_listen_sock()
414 inaddr = &((struct sockaddr_in*)&ss)->sin_addr; in display_listen_sock()
416 got_port = ntohs(((struct sockaddr_in6*)&ss)->sin6_port); in display_listen_sock()
417 inaddr = &((struct sockaddr_in6*)&ss)->sin6_addr; in display_listen_sock()
421 printf("Listening on <%s>\n", ((struct sockaddr_un*)&ss)->sun_path); in display_listen_sock()
471 setbuf(stdout, NULL); in main()
504 /* The /dump URI will dump all requests to stdout and say 200 ok. */ in main()
525 LEV_OPT_CLOSE_ON_FREE, -1, in main()
540 fprintf(stderr, "-U is not supported on this platform. Exiting.\n"); in main()