Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: third_party/mongoose/mongoose.c

Issue 9309008: Initialized the variables root and ri. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased patch. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/mongoose/chrome-mongoose-modifications.diff ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2004-2011 Sergey Lyubka 1 // Copyright (c) 2004-2011 Sergey Lyubka
2 // 2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy 3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal 4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights 5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is 7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions: 8 // furnished to do so, subject to the following conditions:
9 // 9 //
10 // The above copyright notice and this permission notice shall be included in 10 // The above copyright notice and this permission notice shall be included in
(...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 const char *prog, 2813 const char *prog,
2814 struct cgi_env_block *blk) { 2814 struct cgi_env_block *blk) {
2815 const char *s, *slash; 2815 const char *s, *slash;
2816 struct vec var_vec, root; 2816 struct vec var_vec, root;
2817 char *p; 2817 char *p;
2818 int i; 2818 int i;
2819 2819
2820 blk->len = blk->nvars = 0; 2820 blk->len = blk->nvars = 0;
2821 blk->conn = conn; 2821 blk->conn = conn;
2822 2822
2823 memset(&root, 0, sizeof(root));
2824
2823 get_document_root(conn, &root); 2825 get_document_root(conn, &root);
2824 2826
2825 addenv(blk, "SERVER_NAME=%s", conn->ctx->config[AUTHENTICATION_DOMAIN]); 2827 addenv(blk, "SERVER_NAME=%s", conn->ctx->config[AUTHENTICATION_DOMAIN]);
2826 addenv(blk, "SERVER_ROOT=%.*s", root.len, root.ptr); 2828 addenv(blk, "SERVER_ROOT=%.*s", root.len, root.ptr);
2827 addenv(blk, "DOCUMENT_ROOT=%.*s", root.len, root.ptr); 2829 addenv(blk, "DOCUMENT_ROOT=%.*s", root.len, root.ptr);
2828 2830
2829 // Prepare the environment block 2831 // Prepare the environment block
2830 addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1"); 2832 addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1");
2831 addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1"); 2833 addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1");
2832 addenv(blk, "%s", "REDIRECT_STATUS=200"); // For PHP 2834 addenv(blk, "%s", "REDIRECT_STATUS=200"); // For PHP
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2909 2911
2910 static void handle_cgi_request(struct mg_connection *conn, const char *prog) { 2912 static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
2911 int headers_len, data_len, i, fd_stdin[2], fd_stdout[2]; 2913 int headers_len, data_len, i, fd_stdin[2], fd_stdout[2];
2912 const char *status; 2914 const char *status;
2913 char buf[BUFSIZ], *pbuf, dir[PATH_MAX], *p; 2915 char buf[BUFSIZ], *pbuf, dir[PATH_MAX], *p;
2914 struct mg_request_info ri; 2916 struct mg_request_info ri;
2915 struct cgi_env_block blk; 2917 struct cgi_env_block blk;
2916 FILE *in, *out; 2918 FILE *in, *out;
2917 pid_t pid; 2919 pid_t pid;
2918 2920
2921 memset(&ri, 0, sizeof(ri));
2922
2919 prepare_cgi_environment(conn, prog, &blk); 2923 prepare_cgi_environment(conn, prog, &blk);
2920 2924
2921 // CGI must be executed in its own directory. 'dir' must point to the 2925 // CGI must be executed in its own directory. 'dir' must point to the
2922 // directory containing executable program, 'p' must point to the 2926 // directory containing executable program, 'p' must point to the
2923 // executable program name relative to 'dir'. 2927 // executable program name relative to 'dir'.
2924 (void) mg_snprintf(conn, dir, sizeof(dir), "%s", prog); 2928 (void) mg_snprintf(conn, dir, sizeof(dir), "%s", prog);
2925 if ((p = strrchr(dir, DIRSEP)) != NULL) { 2929 if ((p = strrchr(dir, DIRSEP)) != NULL) {
2926 *p++ = '\0'; 2930 *p++ = '\0';
2927 } else { 2931 } else {
2928 dir[0] = '.', dir[1] = '\0'; 2932 dir[0] = '.', dir[1] = '\0';
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) { 4255 for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) {
4252 if (start_thread(ctx, (mg_thread_func_t) worker_thread, ctx) != 0) { 4256 if (start_thread(ctx, (mg_thread_func_t) worker_thread, ctx) != 0) {
4253 cry(fc(ctx), "Cannot start worker thread: %d", ERRNO); 4257 cry(fc(ctx), "Cannot start worker thread: %d", ERRNO);
4254 } else { 4258 } else {
4255 ctx->num_threads++; 4259 ctx->num_threads++;
4256 } 4260 }
4257 } 4261 }
4258 4262
4259 return ctx; 4263 return ctx;
4260 } 4264 }
OLDNEW
« no previous file with comments | « third_party/mongoose/chrome-mongoose-modifications.diff ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698