C and C++ web framework. http://rapida.vilor.one/docs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

69 lines
1.2 KiB

/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Copyright 2022 Ivan Polyakov */
/*!
* \file request.h
* \brief Request.
*/
#ifndef RAPIDA_REQUEST_H_ENTRY
#define RAPIDA_REQUEST_H_ENTRY
#include "query.h"
#include "url.h"
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \brief Request method types.
*/
enum rpd_req_methods {
UNKNOWN = 0,
GET,
HEAD,
POST,
PUT,
DELETE,
CONNECT,
OPTIONS,
TRACE,
PATCH
};
/*!
* \brief Request struct.
*/
typedef struct {
enum rpd_req_methods method; /**< Request method. */
char *auth; /**< Authorization field. */
char *cookie; /**< Cookie field. */
char *body; /**< Body field. */
rpd_url path; /**< Requested URL. */
rpd_keyval query; /**< Query. */
rpd_keyval params; /**< Dynamic parameters. */
} rpd_req;
/*!
* \brief Parser string request method to enumeration value.
*
* \param method Request method string.
*
* \return Request method.
*/
enum rpd_req_methods rpd_req_smethod(const char *method);
/*!
* \brief Cleans request data.
*
* Request instance will not be freed, only it's data.
*
* \param req Request instance.
*/
void rpd_req_cleanup(rpd_req *req);
#ifdef __cplusplus
}
#endif
#endif /* RAPIDA_REQUEST_H_ENTRY */