Lines Matching full:env

10742 static void addenv(struct cgi_environment *env,
10747 * pointer into the vars array. Assumes env != NULL and fmt != NULL. */
10749 addenv(struct cgi_environment *env, const char *fmt, ...) argument
10756 if ((env->varlen - env->varused) < 2) {
10757 mg_cry_internal(env->conn,
10765 space = (env->buflen - env->bufused);
10771 n = env->buflen + CGI_ENVIRONMENT_SIZE;
10772 added = (char *)mg_realloc_ctx(env->buf, n, env->conn->phys_ctx);
10776 env->conn,
10783 env->buf = added;
10784 env->buflen = n;
10785 for (i = 0, n = 0; i < env->varused; i++) {
10786 env->var[i] = added + n;
10789 space = (env->buflen - env->bufused);
10793 added = env->buf + env->bufused;
10797 mg_vsnprintf(env->conn, &truncated, added, space - 1, fmt, ap);
10809 env->bufused += n;
10812 env->var[env->varused] = added;
10813 env->varused++;
10821 struct cgi_environment *env) argument
10828 if ((conn == NULL) || (prog == NULL) || (env == NULL)) {
10832 env->conn = conn;
10833 env->buflen = CGI_ENVIRONMENT_SIZE;
10834 env->bufused = 0;
10835 env->buf = (char *)mg_malloc_ctx(env->buflen, conn->phys_ctx);
10836 if (env->buf == NULL) {
10842 env->varlen = MAX_CGI_ENVIR_VARS;
10843 env->varused = 0;
10844 env->var =
10845 (char **)mg_malloc_ctx(env->varlen * sizeof(char *), conn->phys_ctx);
10846 if (env->var == NULL) {
10850 mg_free(env->buf);
10854 addenv(env, "SERVER_NAME=%s", conn->dom_ctx->config[AUTHENTICATION_DOMAIN]);
10855 addenv(env, "SERVER_ROOT=%s", conn->dom_ctx->config[DOCUMENT_ROOT]);
10856 addenv(env, "DOCUMENT_ROOT=%s", conn->dom_ctx->config[DOCUMENT_ROOT]);
10857 addenv(env, "SERVER_SOFTWARE=CivetWeb/%s", mg_version());
10860 addenv(env, "%s", "GATEWAY_INTERFACE=CGI/1.1");
10861 addenv(env, "%s", "SERVER_PROTOCOL=HTTP/1.1");
10862 addenv(env, "%s", "REDIRECT_STATUS=200"); /* For PHP */
10866 addenv(env, "SERVER_PORT=%d", ntohs(conn->client.lsa.sin6.sin6_port));
10870 addenv(env, "SERVER_PORT=%d", ntohs(conn->client.lsa.sin.sin_port));
10874 addenv(env, "REMOTE_ADDR=%s", src_addr);
10876 addenv(env, "REQUEST_METHOD=%s", conn->request_info.request_method);
10877 addenv(env, "REMOTE_PORT=%d", conn->request_info.remote_port);
10879 addenv(env, "REQUEST_URI=%s", conn->request_info.request_uri);
10880 addenv(env, "LOCAL_URI=%s", conn->request_info.local_uri);
10887 addenv(env, "SCRIPT_NAME=%s", conn->request_info.local_uri);
10892 addenv(env,
10900 addenv(env,
10906 addenv(env, "SCRIPT_FILENAME=%s", prog);
10908 addenv(env, "PATH_TRANSLATED=%s", conn->dom_ctx->config[DOCUMENT_ROOT]);
10910 addenv(env,
10916 addenv(env, "HTTPS=%s", (conn->ssl == NULL) ? "off" : "on");
10919 addenv(env, "CONTENT_TYPE=%s", s);
10922 addenv(env, "QUERY_STRING=%s", conn->request_info.query_string);
10925 addenv(env, "CONTENT_LENGTH=%s", s);
10928 addenv(env, "PATH=%s", s);
10931 addenv(env, "PATH_INFO=%s", conn->path_info);
10936 addenv(env, "STATUS=%d", conn->status_code);
10941 addenv(env, "COMSPEC=%s", s);
10944 addenv(env, "SYSTEMROOT=%s", s);
10947 addenv(env, "SystemDrive=%s", s);
10950 addenv(env, "ProgramFiles=%s", s);
10953 addenv(env, "ProgramFiles(x86)=%s", s);
10957 addenv(env, "LD_LIBRARY_PATH=%s", s);
10962 addenv(env, "PERLLIB=%s", s);
10966 addenv(env, "REMOTE_USER=%s", conn->request_info.remote_user);
10967 addenv(env, "%s", "AUTH_TYPE=Digest");
10996 addenv(env,
11005 addenv(env, "%.*s", (int)var_vec.len, var_vec.ptr);
11008 env->var[env->varused] = NULL;
11009 env->buf[env->bufused] = '\0';