|
Greenbone Security Assistant
9.0.1
|
Go to the documentation of this file.
34 #include <microhttpd.h>
39 #define DATE_2822_LEN 100
44 #define EXPIRES_LENGTH 100
49 #define UTF8_ERROR_PAGE(location) \
51 "<head><title>Invalid request</title></head>" \
52 "<body>The request contained invalid UTF-8 in " location ".</body>" \
58 #define SID_COOKIE_NAME "GSAD_SID"
60 #define REMOVE_SID "0"
65 #define NOT_FOUND_TITLE "Invalid request"
70 #define NOT_FOUND_MESSAGE "The requested page or file does not exist."
75 #define ERROR_PAGE "<html><body>HTTP Method not supported</body></html>"
80 #define BAD_REQUEST_PAGE "<html><body>Bad request.</body></html>"
85 #define SERVER_ERROR \
86 "<html><body>An internal server error has occurred.</body></html>"
93 #define MAX_HOST_LEN 1000
95 #define LOGIN_URL "/login"
96 #define LOGOUT_URL "/logout"
101 #define POST_BUFFER_SIZE 500000
107 #ifndef MHD_HTTP_NOT_ACCEPTABLE
108 #define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
114 #define MAX_FILE_NAME_SIZE 128
173 int http_status_code,
179 const char *content_disposition,
size_t content_length);
209 serve_post (
void *coninfo_cls,
enum MHD_ValueKind kind,
const char *key,
211 const char *transfer_encoding,
const char *data, uint64_t off,
230 const char *client_address);
234 const char *chunk_data,
int chunk_size,
int chunk_offset);
char * cookie
Value of SID cookie param.
params_t * params
Request parameters.
struct gsad_connection_info gsad_connection_info_t
Connection information.
Headers for Response Data struct.
Response information for commands.
char * gsad_message(credentials_t *, const char *, const char *, int, const char *, cmd_response_data_t *)
Handles fatal errors.
int serve_post(void *coninfo_cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size)
Serves part of a POST request.
content_type
Content types.
int send_redirect_to_uri(http_connection_t *connection, const char *uri, const gchar *sid)
Sends a HTTP redirection to an uri.
content_type_t guess_content_type(const gchar *path)
Guess a content type from a file extension.
http_response_t * file_content_response(http_connection_t *connection, const char *url, const char *path, cmd_response_data_t *response_data)
Create a response to serve a file from a path.
Structure of credential related information.
GSAD credentials handling.
int connectiontype
1=POST, 2=GET.
void gsad_add_content_type_header(http_response_t *response, content_type_t *ct)
Adds content-type header fields to a response.
int exec_gmp_post(http_connection_t *connection, gsad_connection_info_t *con_info, const char *client_address)
void add_guest_chart_content_security_headers(http_response_t *response)
Add guest chart content security headers to a MHD response.
enum content_type content_type_t
int send_response(http_connection_t *connection, const char *content, int status_code, const gchar *sid, content_type_t content_type, const char *content_disposition, size_t content_length)
Sends a HTTP response.
int exec_gmp_get(http_connection_t *connection, gsad_connection_info_t *con_info, credentials_t *credentials)
int handler_create_response(http_connection_t *connection, gchar *data, cmd_response_data_t *response_data, const gchar *sid)
Create and send a response.
int params_append_mhd(params_t *params, const char *name, const char *filename, const char *chunk_data, int chunk_size, int chunk_offset)
Headers for content type.
struct MHD_Connection http_connection_t
char * language
Language code e.g. en.
struct MHD_PostProcessor * postprocessor
POST processor.
gchar * redirect
Redirect URL.
enum authentication_reason authentication_reason_t
int remove_sid(http_response_t *response)
Attach expired SID cookie to response.
gchar * reconstruct_url(http_connection_t *connection, const char *url)
Reconstruct the URL for a connection.
int attach_remove_sid(http_response_t *response, const gchar *sid)
struct MHD_Response http_response_t
void add_forbid_caching_headers(http_response_t *response)
Add header to forbid caching to a HTTP response.
int handler_send_response(http_connection_t *connection, http_response_t *response, cmd_response_data_t *response_data, const gchar *sid)
Send response for handle_request.
authentication_reason
Content types.
int attach_sid(http_response_t *response, const char *sid)
Attach SID cookie to a response, resetting "expire" arg.
int get_client_address(http_connection_t *conn, char *client_address)
Get the client's address.
void add_security_headers(http_response_t *response)
Add security headers to a MHD response.
int handler_send_reauthentication(http_connection_t *connection, int http_status_code, authentication_reason_t reason)
Allow for reauthentication of a user.
void add_cors_headers(http_response_t *response)