Klaus Demo nginx / bb49607
$request_body_file Igor Sysoev 15 years ago
1 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4848 static ngx_int_t ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
4949 ngx_http_variable_value_t *v, uintptr_t data);
5050 static ngx_int_t ngx_http_variable_request_completion(ngx_http_request_t *r,
51 ngx_http_variable_value_t *v, uintptr_t data);
52 static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r,
5153 ngx_http_variable_value_t *v, uintptr_t data);
5254
5355 static ngx_int_t ngx_http_variable_sent_content_type(ngx_http_request_t *r,
169171 ngx_http_variable_request_completion,
170172 0, 0, 0 },
171173
174 { ngx_string("request_body_file"), NULL,
175 ngx_http_variable_request_body_file,
176 0, 0, 0 },
177
172178 { ngx_string("sent_http_content_type"), NULL,
173179 ngx_http_variable_sent_content_type, 0, 0, 0 },
174180
11331139 }
11341140
11351141
1142 static ngx_int_t
1143 ngx_http_variable_request_body_file(ngx_http_request_t *r,
1144 ngx_http_variable_value_t *v, uintptr_t data)
1145 {
1146 if (r->request_body == NULL || r->request_body->temp_file == NULL) {
1147 v->len = 0;
1148 v->valid = 1;
1149 v->no_cachable = 0;
1150 v->not_found = 0;
1151 v->data = (u_char *) "";
1152
1153 return NGX_OK;
1154 }
1155
1156 v->len = r->request_body->temp_file->file.name.len;
1157 v->valid = 1;
1158 v->no_cachable = 0;
1159 v->not_found = 0;
1160 v->data = r->request_body->temp_file->file.name.data;
1161
1162 return NGX_OK;
1163 }
1164
1165
11361166 ngx_int_t
11371167 ngx_http_variables_add_core_vars(ngx_conf_t *cf)
11381168 {