📄 websurlparse.htm
字号:
<html>
<head>
<title>websUrlParse -- GoAhead WebServer API</title>
<link rel="stylesheet" href="../../style/doc.htm" type="text/css">
</head>
<body>
<TABLE border=0 width=100% cellspacing=0 cellpadding=0>
<TR>
<TD class=title-left><b>websUrlParse</b></TD>
<TD class=title-center><b> GoAhead WebServer API</b></TD>
<TD class=title-right><B> GoAhead EMF</B></TD>
</TR>
</TABLE>
<HR>
<h2>Synopsis</h2>
<p>Parse a URL into its component parts</p>
<h2>Prototype</h2>
<pre>
#include "webs.h"
int <b>websUrlParse</b>(char_t *url, char_t **buf, char_t **host,
char_t **path, char_t **port, char_t **query, char_t **proto,
char_t **tag, char_t **ext);
</pre>
<h2>Parameters</h2>
<p><table width=90%>
<TR>
<TD width=40>url
<TD>Source URL to parse
<TR>
<TD width=40>buf
<TD>Pointer to buffer used to hold the parsed components
<TR>
<TD width=40>host
<TD>Host name
<TR>
<TD width=40>path
<TD>URL path portion after the host name and optional port
<TR>
<TD width=40>query
<TD>Optional query string portion after "?"
<TR>
<TD width=40>proto
<TD>Protocol. Usually "http"
<TR>
<TD width=40>tag
<TD>Optional tag portion after "#"
<TR>
<TD width=40>ext
<TD>Document file name
extension</TD> </TR></table></p>
<h2>Description</h2>
<P> The websUrlParse procedure cracks the URL into its constituent components.
To store the parts, websUrlParse allocates a dynamic buffer. This must eventually
be freed via <A href="../basic/public/bfree.htm">bfree</A> by the caller.</P>
<P>
</P>
<P>websUrlParse stores pointers to the URL components in
<EM>host, path, port, query, proto, tag </EM>and <EM>ext. </EM>If any of these
parameters contains NULL, that component
is ignored.</P>
<P>
</P>
<P>
Note: tag parsing is not
fully supported.</P>
<h2>Return Value</h2>
<p> Returns 0 if successful. Returns -1 if memory cannot be
allocated to hold the results.</p>
<h2>Example</h2>
<pre>
char_t *host, *port, *buf;
websUrlParse(url, &buf, &host, NULL, &port, NULL, NULL, NULL, NULL);
</pre>
<h2>See Also</h2>
<p> <A href="../basic/public/balloc.htm">balloc</A>, <A href="../basic/public/bfree.htm">bfree</A>,
<A href="websUrlType.htm">websUrlType</A> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -