|
|
| version 1.12, 2020/12/15 17:23:56 | version 1.16, 2024/07/14 16:54:18 |
|---|---|
| Line 95 class SAPI_Info_HTTPD : public SAPI_Info | Line 95 class SAPI_Info_HTTPD : public SAPI_Info |
| public: | public: |
| HTTPD_Connection &connection; | HTTPD_Connection &connection; |
| String output; | String::Body output; |
| HashStringString env; | HashStringString env; |
| SAPI_Info_HTTPD(HTTPD_Connection &aconnection) : connection(aconnection) {} | SAPI_Info_HTTPD(HTTPD_Connection &aconnection) : connection(aconnection) {} |
| Line 122 public: | Line 122 public: |
| env.put("QUERY_STRING", connection.query()); | env.put("QUERY_STRING", connection.query()); |
| env.put("SERVER_NAME", host); | env.put("SERVER_NAME", host); |
| env.put("SERVER_PORT", HTTPD_Server::port); | |
| env.put("REMOTE_ADDR", connection.remote_addr); | env.put("REMOTE_ADDR", connection.remote_addr); |
| } | } |
| virtual char* get_env(const char* name) { | virtual char* get_env(const char* name) { |
| String::Body value = env.get(name); | String::Body request_value = env.get(name); |
| return !value ? NULL : value.cstrm(); | if(!request_value.is_empty()) |
| return request_value.cstrm(); | |
| if(char *server_value=getenv(name)) | |
| return pa_strdup(server_value); | |
| return NULL; | |
| } | } |
| virtual bool set_env(const char* name, const char* value) { | virtual bool set_env(const char* name, const char* value) { |
| Line 161 public: | Line 166 public: |
| output << capitalize(dont_store_key) << ": " << pa_strdup(dont_store_value) << "\r\n"; | output << capitalize(dont_store_key) << ": " << pa_strdup(dont_store_value) << "\r\n"; |
| } | } |
| void clear_response_headers() { | |
| http_response_code=200; | |
| output.clear(); | |
| } | |
| static const char *exception_http_status(const char *type) { | static const char *exception_http_status(const char *type) { |
| struct Lookup { | struct Lookup { |
| const char *code; | const char *code; |
| const char *type; | const char *type; |
| } static lookup[] = { | } static lookup[] = { |
| { "", "httpd.write"}, | |
| {"400", "httpd.request"}, | {"400", "httpd.request"}, |
| {"400", "http.response"}, | {"400", "http.response"}, |
| {"404", "file.missing"}, | {"404", "file.missing"}, |
| {"408", "httpd.timeout"}, | {"408", "httpd.timeout"}, |
| {"408", "httpd.read"}, | |
| {"501", "httpd.method"}, | {"501", "httpd.method"}, |
| { NULL, ""} | { NULL, ""} |
| }; | }; |