\hypertarget{group__HTTP-headers-read}{}\section{H\+T\+TP headers\+: read}
\label{group__HTTP-headers-read}\index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structlws__tokens}{lws\+\_\+tokens}
\item 
struct \hyperlink{structlws__token__limits}{lws\+\_\+token\+\_\+limits}
\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum {\bfseries lws\+\_\+token\+\_\+indexes} \{ \\*
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+G\+E\+T\+\_\+\+U\+RI} = 0, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+P\+O\+S\+T\+\_\+\+U\+RI} = 1, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+O\+P\+T\+I\+O\+N\+S\+\_\+\+U\+RI} = 2, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+H\+O\+ST} = 3, 
\\*
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON} = 4, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+U\+P\+G\+R\+A\+DE} = 5, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+O\+R\+I\+G\+IN} = 6, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+D\+R\+A\+FT} = 7, 
\\*
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+C\+H\+A\+L\+L\+E\+N\+GE} = 8, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+NS} = 9, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+K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E\+N\+\_\+\+N\+A\+M\+E\+\_\+\+P\+A\+RT}, 
\\*
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+S\+K\+I\+P\+P\+I\+NG}, 
{\bfseries W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+S\+K\+I\+P\+P\+I\+N\+G\+\_\+\+S\+A\+W\+\_\+\+CR}, 
{\bfseries W\+S\+I\+\_\+\+P\+A\+R\+S\+I\+N\+G\+\_\+\+C\+O\+M\+P\+L\+E\+TE}, 
{\bfseries W\+S\+I\+\_\+\+I\+N\+I\+T\+\_\+\+T\+O\+K\+E\+N\+\_\+\+M\+U\+X\+U\+RL}
 \}\hypertarget{group__HTTP-headers-read_ga6e747906f9d76532ec118d6ef418b82e}{}\label{group__HTTP-headers-read_ga6e747906f9d76532ec118d6ef418b82e}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const unsigned char $\ast$ \hyperlink{group__HTTP-headers-read_ga2c0597b2ef1d2cee35736c338bcbd17b}{lws\+\_\+token\+\_\+to\+\_\+string} (enum lws\+\_\+token\+\_\+indexes token)
\item 
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int L\+W\+S\+\_\+\+W\+A\+R\+N\+\_\+\+U\+N\+U\+S\+E\+D\+\_\+\+R\+E\+S\+U\+LT \hyperlink{group__HTTP-headers-read_ga8ade0e1ffb0da7e62b989d8d867bf6c8}{lws\+\_\+hdr\+\_\+total\+\_\+length} (struct lws $\ast$wsi, enum lws\+\_\+token\+\_\+indexes h)
\item 
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int L\+W\+S\+\_\+\+W\+A\+R\+N\+\_\+\+U\+N\+U\+S\+E\+D\+\_\+\+R\+E\+S\+U\+LT \hyperlink{group__HTTP-headers-read_ga594f3d0ece5b09c2ccf9f98ea533bb4e}{lws\+\_\+hdr\+\_\+fragment\+\_\+length} (struct lws $\ast$wsi, enum lws\+\_\+token\+\_\+indexes h, int frag\+\_\+idx)
\item 
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int \hyperlink{group__HTTP-headers-read_ga6ce6aa1c0155ea42b7708bed271d1c77}{lws\+\_\+hdr\+\_\+copy} (struct lws $\ast$wsi, char $\ast$dest, int len, enum lws\+\_\+token\+\_\+indexes h)
\item 
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int \hyperlink{group__HTTP-headers-read_gaa427cad61a9a5e3004afd65c4527b5e9}{lws\+\_\+hdr\+\_\+copy\+\_\+fragment} (struct lws $\ast$wsi, char $\ast$dest, int len, enum lws\+\_\+token\+\_\+indexes h, int frag\+\_\+idx)
\item 
L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char $\ast$ \hyperlink{group__HTTP-headers-read_ga84e9ce5e71a77501a0998ac403a984c2}{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name} (struct lws $\ast$wsi, const char $\ast$name, char $\ast$buf, int len)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{H\+T\+TP header releated functions}

In lws the client http headers are temporarily stored in a pool, only for the duration of the http part of the handshake. It\textquotesingle{}s because in most cases, the header content is ignored for the whole rest of the connection lifetime and would then just be taking up space needlessly.

During L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP when the U\+RI path is delivered is the last time the http headers are still allocated, you can use these apis then to look at and copy out interesting header content (cookies, etc)

Notice that the header total length reported does not include a terminating \textquotesingle{}\textbackslash{}0\textquotesingle{}, however you must allocate for it when using the \+\_\+copy apis. So the length reported for a header containing \char`\"{}123\char`\"{} is 3, but you must provide a buffer of length 4 so that \char`\"{}123\textbackslash{}0\char`\"{} may be copied into it, or the copy will fail with a nonzero return code.

In the special case of U\+RL arguments, like ?x=1\&y=2, the arguments are stored in a token named for the method, eg, W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+G\+E\+T\+\_\+\+U\+RI if it was a G\+ET or W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+P\+O\+S\+T\+\_\+\+U\+RI if P\+O\+ST. You can check the total length to confirm the method.

For U\+RL arguments, each argument is stored urldecoded in a \char`\"{}fragment\char`\"{}, so you can use the fragment-\/aware api \hyperlink{group__HTTP-headers-read_gaa427cad61a9a5e3004afd65c4527b5e9}{lws\+\_\+hdr\+\_\+copy\+\_\+fragment()} to access each argument in turn\+: the fragments contain urldecoded strings like x=1 or y=2.

As a convenience, lws has an api that will find the fragment with a given name= part, \hyperlink{group__HTTP-headers-read_ga84e9ce5e71a77501a0998ac403a984c2}{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name()}. 

\subsection{Function Documentation}
\index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}!lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name@{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name}}
\index{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name@{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name}!H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsubsection[{\texorpdfstring{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name(struct lws $\ast$wsi, const char $\ast$name, char $\ast$buf, int len)}{lws\_get\_urlarg\_by\_name(struct lws *wsi, const char *name, char *buf, int len)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const char$\ast$ lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{const char $\ast$}]{name, }
\item[{char $\ast$}]{buf, }
\item[{int}]{len}
\end{DoxyParamCaption}
)}\hypertarget{group__HTTP-headers-read_ga84e9ce5e71a77501a0998ac403a984c2}{}\label{group__HTTP-headers-read_ga84e9ce5e71a77501a0998ac403a984c2}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

\hyperlink{group__HTTP-headers-read_ga84e9ce5e71a77501a0998ac403a984c2}{lws\+\_\+get\+\_\+urlarg\+\_\+by\+\_\+name()} -\/ return pointer to arg value if present 
\begin{DoxyParams}{Parameters}
{\em wsi} & the connection to check \\
\hline
{\em name} & the arg name, like \char`\"{}token=\char`\"{} \\
\hline
{\em buf} & the buffer to receive the urlarg (including the name= part) \\
\hline
{\em len} & the length of the buffer to receive the urlarg \begin{DoxyVerb}Returns NULL if not found or a pointer inside buf to just after the
name= part.\end{DoxyVerb}
 \\
\hline
\end{DoxyParams}
\index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}!lws\+\_\+hdr\+\_\+copy@{lws\+\_\+hdr\+\_\+copy}}
\index{lws\+\_\+hdr\+\_\+copy@{lws\+\_\+hdr\+\_\+copy}!H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsubsection[{\texorpdfstring{lws\+\_\+hdr\+\_\+copy(struct lws $\ast$wsi, char $\ast$dest, int len, enum lws\+\_\+token\+\_\+indexes h)}{lws\_hdr\_copy(struct lws *wsi, char *dest, int len, enum lws\_token\_indexes h)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int lws\+\_\+hdr\+\_\+copy (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{char $\ast$}]{dest, }
\item[{int}]{len, }
\item[{enum lws\+\_\+token\+\_\+indexes}]{h}
\end{DoxyParamCaption}
)}\hypertarget{group__HTTP-headers-read_ga6ce6aa1c0155ea42b7708bed271d1c77}{}\label{group__HTTP-headers-read_ga6ce6aa1c0155ea42b7708bed271d1c77}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

\hyperlink{group__HTTP-headers-read_ga6ce6aa1c0155ea42b7708bed271d1c77}{lws\+\_\+hdr\+\_\+copy()} -\/ copy a single fragment of the given header to a buffer The buffer length len must include space for an additional terminating \textquotesingle{}\textbackslash{}0\textquotesingle{}, or it will fail returning -\/1.


\begin{DoxyParams}{Parameters}
{\em wsi} & websocket connection \\
\hline
{\em dest} & destination buffer \\
\hline
{\em len} & length of destination buffer \\
\hline
{\em h} & which header index we are interested in\\
\hline
\end{DoxyParams}
copies the whole, aggregated header, even if it was delivered in several actual headers piece by piece \index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}!lws\+\_\+hdr\+\_\+copy\+\_\+fragment@{lws\+\_\+hdr\+\_\+copy\+\_\+fragment}}
\index{lws\+\_\+hdr\+\_\+copy\+\_\+fragment@{lws\+\_\+hdr\+\_\+copy\+\_\+fragment}!H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsubsection[{\texorpdfstring{lws\+\_\+hdr\+\_\+copy\+\_\+fragment(struct lws $\ast$wsi, char $\ast$dest, int len, enum lws\+\_\+token\+\_\+indexes h, int frag\+\_\+idx)}{lws\_hdr\_copy\_fragment(struct lws *wsi, char *dest, int len, enum lws\_token\_indexes h, int frag\_idx)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int lws\+\_\+hdr\+\_\+copy\+\_\+fragment (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{char $\ast$}]{dest, }
\item[{int}]{len, }
\item[{enum lws\+\_\+token\+\_\+indexes}]{h, }
\item[{int}]{frag\+\_\+idx}
\end{DoxyParamCaption}
)}\hypertarget{group__HTTP-headers-read_gaa427cad61a9a5e3004afd65c4527b5e9}{}\label{group__HTTP-headers-read_gaa427cad61a9a5e3004afd65c4527b5e9}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

\hyperlink{group__HTTP-headers-read_gaa427cad61a9a5e3004afd65c4527b5e9}{lws\+\_\+hdr\+\_\+copy\+\_\+fragment()} -\/ copy a single fragment of the given header to a buffer The buffer length len must include space for an additional terminating \textquotesingle{}\textbackslash{}0\textquotesingle{}, or it will fail returning -\/1. If the requested fragment index is not present, it fails returning -\/1.


\begin{DoxyParams}{Parameters}
{\em wsi} & websocket connection \\
\hline
{\em dest} & destination buffer \\
\hline
{\em len} & length of destination buffer \\
\hline
{\em h} & which header index we are interested in \\
\hline
{\em frag\+\_\+idx} & which fragment of h we want to copy\\
\hline
\end{DoxyParams}
Normally this is only useful to parse U\+RI arguments like ?x=1\&y=2, token index W\+S\+I\+\_\+\+T\+O\+K\+E\+N\+\_\+\+H\+T\+T\+P\+\_\+\+U\+R\+I\+\_\+\+A\+R\+GS fragment 0 will contain \char`\"{}x=1\char`\"{} and fragment 1 \char`\"{}y=2\char`\"{} \index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}!lws\+\_\+hdr\+\_\+fragment\+\_\+length@{lws\+\_\+hdr\+\_\+fragment\+\_\+length}}
\index{lws\+\_\+hdr\+\_\+fragment\+\_\+length@{lws\+\_\+hdr\+\_\+fragment\+\_\+length}!H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsubsection[{\texorpdfstring{lws\+\_\+hdr\+\_\+fragment\+\_\+length(struct lws $\ast$wsi, enum lws\+\_\+token\+\_\+indexes h, int frag\+\_\+idx)}{lws\_hdr\_fragment\_length(struct lws *wsi, enum lws\_token\_indexes h, int frag\_idx)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int L\+W\+S\+\_\+\+W\+A\+R\+N\+\_\+\+U\+N\+U\+S\+E\+D\+\_\+\+R\+E\+S\+U\+LT lws\+\_\+hdr\+\_\+fragment\+\_\+length (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{enum lws\+\_\+token\+\_\+indexes}]{h, }
\item[{int}]{frag\+\_\+idx}
\end{DoxyParamCaption}
)}\hypertarget{group__HTTP-headers-read_ga594f3d0ece5b09c2ccf9f98ea533bb4e}{}\label{group__HTTP-headers-read_ga594f3d0ece5b09c2ccf9f98ea533bb4e}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

lws\+\_\+hdr\+\_\+fragment\+\_\+length\+: report length of a single fragment of a header The returned length does not include the space for a terminating \textquotesingle{}\textbackslash{}0\textquotesingle{}


\begin{DoxyParams}{Parameters}
{\em wsi} & websocket connection \\
\hline
{\em h} & which header index we are interested in \\
\hline
{\em frag\+\_\+idx} & which fragment of h we want to get the length of \\
\hline
\end{DoxyParams}
\index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}!lws\+\_\+hdr\+\_\+total\+\_\+length@{lws\+\_\+hdr\+\_\+total\+\_\+length}}
\index{lws\+\_\+hdr\+\_\+total\+\_\+length@{lws\+\_\+hdr\+\_\+total\+\_\+length}!H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsubsection[{\texorpdfstring{lws\+\_\+hdr\+\_\+total\+\_\+length(struct lws $\ast$wsi, enum lws\+\_\+token\+\_\+indexes h)}{lws\_hdr\_total\_length(struct lws *wsi, enum lws\_token\_indexes h)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int L\+W\+S\+\_\+\+W\+A\+R\+N\+\_\+\+U\+N\+U\+S\+E\+D\+\_\+\+R\+E\+S\+U\+LT lws\+\_\+hdr\+\_\+total\+\_\+length (
\begin{DoxyParamCaption}
\item[{struct lws $\ast$}]{wsi, }
\item[{enum lws\+\_\+token\+\_\+indexes}]{h}
\end{DoxyParamCaption}
)}\hypertarget{group__HTTP-headers-read_ga8ade0e1ffb0da7e62b989d8d867bf6c8}{}\label{group__HTTP-headers-read_ga8ade0e1ffb0da7e62b989d8d867bf6c8}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

lws\+\_\+hdr\+\_\+total\+\_\+length\+: report length of all fragments of a header totalled up The returned length does not include the space for a terminating \textquotesingle{}\textbackslash{}0\textquotesingle{}


\begin{DoxyParams}{Parameters}
{\em wsi} & websocket connection \\
\hline
{\em h} & which header index we are interested in \\
\hline
\end{DoxyParams}
\index{H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}!lws\+\_\+token\+\_\+to\+\_\+string@{lws\+\_\+token\+\_\+to\+\_\+string}}
\index{lws\+\_\+token\+\_\+to\+\_\+string@{lws\+\_\+token\+\_\+to\+\_\+string}!H\+T\+T\+P headers\+: read@{H\+T\+T\+P headers\+: read}}
\subsubsection[{\texorpdfstring{lws\+\_\+token\+\_\+to\+\_\+string(enum lws\+\_\+token\+\_\+indexes token)}{lws\_token\_to\_string(enum lws\_token\_indexes token)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN const unsigned char$\ast$ lws\+\_\+token\+\_\+to\+\_\+string (
\begin{DoxyParamCaption}
\item[{enum lws\+\_\+token\+\_\+indexes}]{token}
\end{DoxyParamCaption}
)}\hypertarget{group__HTTP-headers-read_ga2c0597b2ef1d2cee35736c338bcbd17b}{}\label{group__HTTP-headers-read_ga2c0597b2ef1d2cee35736c338bcbd17b}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

\hyperlink{group__HTTP-headers-read_ga2c0597b2ef1d2cee35736c338bcbd17b}{lws\+\_\+token\+\_\+to\+\_\+string()} -\/ returns a textual representation of a hdr token index


\begin{DoxyParams}{Parameters}
{\em } & \\
\hline
\end{DoxyParams}
