Lines 39-49
Link Here
|
39 |
const auto& value = header->value(); |
39 |
const auto& value = header->value(); |
40 |
|
40 |
|
41 |
if (field == beast::http::field::content_length) { |
41 |
if (field == beast::http::field::content_length) { |
42 |
env.set("CONTENT_LENGTH", value.to_string()); |
42 |
env.set("CONTENT_LENGTH", value); |
43 |
continue; |
43 |
continue; |
44 |
} |
44 |
} |
45 |
if (field == beast::http::field::content_type) { |
45 |
if (field == beast::http::field::content_type) { |
46 |
env.set("CONTENT_TYPE", value.to_string()); |
46 |
env.set("CONTENT_TYPE", value); |
47 |
continue; |
47 |
continue; |
48 |
} |
48 |
} |
49 |
|
49 |
|
Lines 62-87
Link Here
|
62 |
} |
62 |
} |
63 |
*dest = '\0'; |
63 |
*dest = '\0'; |
64 |
|
64 |
|
65 |
env.set(buf, value.to_string()); |
65 |
env.set(buf, value); |
66 |
} |
66 |
} |
67 |
|
67 |
|
68 |
int major = request.version() / 10; |
68 |
int major = request.version() / 10; |
69 |
int minor = request.version() % 10; |
69 |
int minor = request.version() % 10; |
70 |
env.set("HTTP_VERSION", std::to_string(major) + '.' + std::to_string(minor)); |
70 |
env.set("HTTP_VERSION", std::to_string(major) + '.' + std::to_string(minor)); |
71 |
|
71 |
|
72 |
env.set("REQUEST_METHOD", request.method_string().to_string()); |
72 |
env.set("REQUEST_METHOD", request.method_string()); |
73 |
|
73 |
|
74 |
// split uri from query |
74 |
// split uri from query |
75 |
auto uri = request.target(); |
75 |
auto uri = request.target(); |
76 |
auto pos = uri.find('?'); |
76 |
auto pos = uri.find('?'); |
77 |
if (pos != uri.npos) { |
77 |
if (pos != uri.npos) { |
78 |
auto query = uri.substr(pos + 1); |
78 |
auto query = uri.substr(pos + 1); |
79 |
env.set("QUERY_STRING", query.to_string()); |
79 |
env.set("QUERY_STRING", query); |
80 |
uri = uri.substr(0, pos); |
80 |
uri = uri.substr(0, pos); |
81 |
} |
81 |
} |
82 |
env.set("SCRIPT_URI", uri.to_string()); |
82 |
env.set("SCRIPT_URI", uri); |
83 |
|
83 |
|
84 |
env.set("REQUEST_URI", request.target().to_string()); |
84 |
env.set("REQUEST_URI", request.target()); |
85 |
|
85 |
|
86 |
char port_buf[16]; |
86 |
char port_buf[16]; |
87 |
snprintf(port_buf, sizeof(port_buf), "%d", local_endpoint.port()); |
87 |
snprintf(port_buf, sizeof(port_buf), "%d", local_endpoint.port()); |