\hypertarget{htp_8h}{\section{htp.\-h File Reference} \label{htp_8h}\index{htp.\-h@{htp.\-h}} } {\ttfamily \#include $<$sys/time.\-h$>$}\\* {\ttfamily \#include \char`\"{}htp\-\_\-version.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-core.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}bstr.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-base64.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-config.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-connection\-\_\-parser.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-decompressors.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-hooks.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-list.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-multipart.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-table.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-transaction.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-urlencoded.\-h\char`\"{}}\\* {\ttfamily \#include \char`\"{}htp\-\_\-utf8\-\_\-decoder.\-h\char`\"{}}\\* \subsection*{Data Structures} \begin{DoxyCompactItemize} \item struct \hyperlink{structhtp__conn__t}{htp\-\_\-conn\-\_\-t} \item struct \hyperlink{structhtp__file__t}{htp\-\_\-file\-\_\-t} \item struct \hyperlink{structhtp__file__data__t}{htp\-\_\-file\-\_\-data\-\_\-t} \item struct \hyperlink{structhtp__log__t}{htp\-\_\-log\-\_\-t} \item struct \hyperlink{structhtp__header__t}{htp\-\_\-header\-\_\-t} \item struct \hyperlink{structhtp__param__t}{htp\-\_\-param\-\_\-t} \item struct \hyperlink{structhtp__tx__t}{htp\-\_\-tx\-\_\-t} \item struct \hyperlink{structhtp__tx__data__t}{htp\-\_\-tx\-\_\-data\-\_\-t} \item struct \hyperlink{structhtp__uri__t}{htp\-\_\-uri\-\_\-t} \end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item void \hyperlink{htp_8h_af834d04e2f2dcf25ed5f8cf49efb626a}{htp\-\_\-uri\-\_\-free} (\hyperlink{structhtp__uri__t}{htp\-\_\-uri\-\_\-t} $\ast$uri) \item \hyperlink{structhtp__uri__t}{htp\-\_\-uri\-\_\-t} $\ast$ \hyperlink{htp_8h_a73866af0ac06ac107436af9f08e2ca7d}{htp\-\_\-uri\-\_\-alloc} (void) \item void \hyperlink{htp_8h_a3eef4d9c98d7bbfbbcb1ff7c5317f3c6}{htp\-\_\-log} (\hyperlink{structhtp__connp__t}{htp\-\_\-connp\-\_\-t} $\ast$connp, const char $\ast$file, int line, enum \hyperlink{htp__core_8h_ae91a6ad07977423dd1ec14a44156d799}{htp\-\_\-log\-\_\-level\-\_\-t} level, int code, const char $\ast$fmt,...) \item \hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp_8h_a2a01a96c537538cdefec78b9628b5e93}{htp\-\_\-urldecode\-\_\-inplace} (\hyperlink{structhtp__cfg__t}{htp\-\_\-cfg\-\_\-t} $\ast$cfg, enum \hyperlink{htp__config_8h_afa49656ef495bb1c8d129342681f62e7}{htp\-\_\-decoder\-\_\-ctx\-\_\-t} ctx, \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$input, uint64\-\_\-t $\ast$flags) \item \hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp_8h_a6a6849d2b4e2477402760923aae8d527}{htp\-\_\-urldecode\-\_\-inplace\-\_\-ex} (\hyperlink{structhtp__cfg__t}{htp\-\_\-cfg\-\_\-t} $\ast$cfg, enum \hyperlink{htp__config_8h_afa49656ef495bb1c8d129342681f62e7}{htp\-\_\-decoder\-\_\-ctx\-\_\-t} ctx, \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$input, uint64\-\_\-t $\ast$flags, int $\ast$expected\-\_\-status\-\_\-code) \item char $\ast$ \hyperlink{htp_8h_aafd2659394bb762f2a623bc9b2ee59bd}{htp\-\_\-get\-\_\-version} (void) \end{DoxyCompactItemize} \subsection{Detailed Description} \begin{DoxyAuthor}{Author} Ivan Ristic \href{mailto:ivanr@webkreator.com}{\tt ivanr@webkreator.\-com} \end{DoxyAuthor} \subsection{Function Documentation} \hypertarget{htp_8h_aafd2659394bb762f2a623bc9b2ee59bd}{\index{htp.\-h@{htp.\-h}!htp\-\_\-get\-\_\-version@{htp\-\_\-get\-\_\-version}} \index{htp\-\_\-get\-\_\-version@{htp\-\_\-get\-\_\-version}!htp.h@{htp.\-h}} \subsubsection[{htp\-\_\-get\-\_\-version}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ htp\-\_\-get\-\_\-version ( \begin{DoxyParamCaption} \item[{void}]{} \end{DoxyParamCaption} )}}\label{htp_8h_aafd2659394bb762f2a623bc9b2ee59bd} Returns the Lib\-H\-T\-P version string. \begin{DoxyReturn}{Returns} Lib\-H\-T\-P version, for example \char`\"{}\-Lib\-H\-T\-P v0.\-5.\-x\char`\"{}. \end{DoxyReturn} \hypertarget{htp_8h_a3eef4d9c98d7bbfbbcb1ff7c5317f3c6}{\index{htp.\-h@{htp.\-h}!htp\-\_\-log@{htp\-\_\-log}} \index{htp\-\_\-log@{htp\-\_\-log}!htp.h@{htp.\-h}} \subsubsection[{htp\-\_\-log}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-log ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-connp\-\_\-t} $\ast$}]{connp, } \item[{const char $\ast$}]{file, } \item[{int}]{line, } \item[{enum {\bf htp\-\_\-log\-\_\-level\-\_\-t}}]{level, } \item[{int}]{code, } \item[{const char $\ast$}]{fmt, } \item[{}]{...} \end{DoxyParamCaption} )}}\label{htp_8h_a3eef4d9c98d7bbfbbcb1ff7c5317f3c6} Creates a new log entry and stores it with the connection. The file and line parameters are typically auto-\/generated using the H\-T\-P\-\_\-\-L\-O\-G\-\_\-\-M\-A\-R\-K macro. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em connp} & \\ \hline \mbox{\tt in} & {\em file} & \\ \hline \mbox{\tt in} & {\em line} & \\ \hline \mbox{\tt in} & {\em level} & \\ \hline \mbox{\tt in} & {\em code} & \\ \hline \mbox{\tt in} & {\em fmt} & \\ \hline \mbox{\tt in} & {\em ...} & Records one log message.\\ \hline \mbox{\tt in} & {\em connp} & \\ \hline \mbox{\tt in} & {\em file} & \\ \hline \mbox{\tt in} & {\em line} & \\ \hline \mbox{\tt in} & {\em level} & \\ \hline \mbox{\tt in} & {\em code} & \\ \hline \mbox{\tt in} & {\em fmt} & \\ \hline \end{DoxyParams} \hypertarget{htp_8h_a73866af0ac06ac107436af9f08e2ca7d}{\index{htp.\-h@{htp.\-h}!htp\-\_\-uri\-\_\-alloc@{htp\-\_\-uri\-\_\-alloc}} \index{htp\-\_\-uri\-\_\-alloc@{htp\-\_\-uri\-\_\-alloc}!htp.h@{htp.\-h}} \subsubsection[{htp\-\_\-uri\-\_\-alloc}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-uri\-\_\-t}$\ast$ htp\-\_\-uri\-\_\-alloc ( \begin{DoxyParamCaption} \item[{void}]{} \end{DoxyParamCaption} )}}\label{htp_8h_a73866af0ac06ac107436af9f08e2ca7d} Allocates and initializes a new \hyperlink{structhtp__uri__t}{htp\-\_\-uri\-\_\-t} structure. \begin{DoxyReturn}{Returns} New structure, or N\-U\-L\-L on memory allocation failure. \end{DoxyReturn} \hypertarget{htp_8h_af834d04e2f2dcf25ed5f8cf49efb626a}{\index{htp.\-h@{htp.\-h}!htp\-\_\-uri\-\_\-free@{htp\-\_\-uri\-\_\-free}} \index{htp\-\_\-uri\-\_\-free@{htp\-\_\-uri\-\_\-free}!htp.h@{htp.\-h}} \subsubsection[{htp\-\_\-uri\-\_\-free}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-uri\-\_\-free ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-uri\-\_\-t} $\ast$}]{uri} \end{DoxyParamCaption} )}}\label{htp_8h_af834d04e2f2dcf25ed5f8cf49efb626a} Frees all data contained in the uri, and then the uri itself. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em uri} & \\ \hline \end{DoxyParams} \hypertarget{htp_8h_a2a01a96c537538cdefec78b9628b5e93}{\index{htp.\-h@{htp.\-h}!htp\-\_\-urldecode\-\_\-inplace@{htp\-\_\-urldecode\-\_\-inplace}} \index{htp\-\_\-urldecode\-\_\-inplace@{htp\-\_\-urldecode\-\_\-inplace}!htp.h@{htp.\-h}} \subsubsection[{htp\-\_\-urldecode\-\_\-inplace}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-urldecode\-\_\-inplace ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-cfg\-\_\-t} $\ast$}]{cfg, } \item[{enum {\bf htp\-\_\-decoder\-\_\-ctx\-\_\-t}}]{ctx, } \item[{{\bf bstr} $\ast$}]{input, } \item[{uint64\-\_\-t $\ast$}]{flags} \end{DoxyParamCaption} )}}\label{htp_8h_a2a01a96c537538cdefec78b9628b5e93} Performs in-\/place decoding of the input string, according to the configuration specified by cfg and ctx. On output, various flags (H\-T\-P\-\_\-\-U\-R\-L\-E\-N\-\_\-$\ast$) might be set. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em cfg} & \\ \hline \mbox{\tt in} & {\em ctx} & \\ \hline \mbox{\tt in} & {\em input} & \\ \hline \mbox{\tt out} & {\em flags} & \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on failure. \end{DoxyReturn} \hypertarget{htp_8h_a6a6849d2b4e2477402760923aae8d527}{\index{htp.\-h@{htp.\-h}!htp\-\_\-urldecode\-\_\-inplace\-\_\-ex@{htp\-\_\-urldecode\-\_\-inplace\-\_\-ex}} \index{htp\-\_\-urldecode\-\_\-inplace\-\_\-ex@{htp\-\_\-urldecode\-\_\-inplace\-\_\-ex}!htp.h@{htp.\-h}} \subsubsection[{htp\-\_\-urldecode\-\_\-inplace\-\_\-ex}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-urldecode\-\_\-inplace\-\_\-ex ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-cfg\-\_\-t} $\ast$}]{cfg, } \item[{enum {\bf htp\-\_\-decoder\-\_\-ctx\-\_\-t}}]{ctx, } \item[{{\bf bstr} $\ast$}]{input, } \item[{uint64\-\_\-t $\ast$}]{flags, } \item[{int $\ast$}]{expected\-\_\-status\-\_\-code} \end{DoxyParamCaption} )}}\label{htp_8h_a6a6849d2b4e2477402760923aae8d527} Performs in-\/place decoding of the input string, according to the configuration specified by cfg and ctx. On output, various flags (H\-T\-P\-\_\-\-U\-R\-L\-E\-N\-\_\-$\ast$) might be set. If something in the input would cause a particular server to respond with an error, the appropriate status code will be set. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em cfg} & \\ \hline \mbox{\tt in} & {\em ctx} & \\ \hline \mbox{\tt in} & {\em input} & \\ \hline \mbox{\tt out} & {\em flags} & \\ \hline \mbox{\tt out} & {\em expected\-\_\-status\-\_\-code} & 0 by default, or status code as necessary\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on failure. \end{DoxyReturn}