200 lines
8.9 KiB
HTML
200 lines
8.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.13"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>libwebsockets: HTTP File transfer</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(initResizable);
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">libwebsockets
|
|
</div>
|
|
<div id="projectbrief">Lightweight C library for HTML5 websockets</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.13 -->
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
initMenu('',false,false,'search.php','Search');
|
|
});
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){initNavTree('group__httpft.html','');});
|
|
</script>
|
|
<div id="doc-content">
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">HTTP File transfer<div class="ingroups"><a class="el" href="group__http.html">HTTP</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:gab4da87a4800413f15e7aba649fb1d77c"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpft.html#gab4da87a4800413f15e7aba649fb1d77c">lws_get_mimetype</a> (const char *file, const struct <a class="el" href="structlws__http__mount.html">lws_http_mount</a> *m)</td></tr>
|
|
<tr class="separator:gab4da87a4800413f15e7aba649fb1d77c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gab393a06d3d2722af4c3f8b06842c80d7"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__httpft.html#gab393a06d3d2722af4c3f8b06842c80d7">lws_serve_http_file</a> (struct lws *wsi, const char *file, const char *content_type, const char *other_headers, int other_headers_len)</td></tr>
|
|
<tr class="separator:gab393a06d3d2722af4c3f8b06842c80d7"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga29e1123f6d56cd777b3e5bf9ca40f9e5"><td class="memItemLeft" align="right" valign="top"><a id="ga29e1123f6d56cd777b3e5bf9ca40f9e5"></a>
|
|
LWS_VISIBLE LWS_EXTERN int </td><td class="memItemRight" valign="bottom"><b>lws_serve_http_file_fragment</b> (struct lws *wsi)</td></tr>
|
|
<tr class="separator:ga29e1123f6d56cd777b3e5bf9ca40f9e5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<p>APIs for sending local files in response to HTTP requests </p>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a id="gab4da87a4800413f15e7aba649fb1d77c"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#gab4da87a4800413f15e7aba649fb1d77c">◆ </a></span>lws_get_mimetype()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">LWS_VISIBLE LWS_EXTERN const char* lws_get_mimetype </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>file</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const struct <a class="el" href="structlws__http__mount.html">lws_http_mount</a> * </td>
|
|
<td class="paramname"><em>m</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p><code>#include <<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>></code></p>
|
|
<p><a class="el" href="group__httpft.html#gab4da87a4800413f15e7aba649fb1d77c">lws_get_mimetype()</a> - Determine mimetype to use from filename</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">file</td><td>filename </td></tr>
|
|
<tr><td class="paramname">m</td><td>NULL, or mount context</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>This uses a canned list of known filetypes first, if no match and m is non-NULL, then tries a list of per-mount file suffix to mimtype mappings.</p>
|
|
<p>Returns either NULL or a pointer to the mimetype matching the file. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="gab393a06d3d2722af4c3f8b06842c80d7"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#gab393a06d3d2722af4c3f8b06842c80d7">◆ </a></span>lws_serve_http_file()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">LWS_VISIBLE LWS_EXTERN int lws_serve_http_file </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct lws * </td>
|
|
<td class="paramname"><em>wsi</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>file</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>content_type</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const char * </td>
|
|
<td class="paramname"><em>other_headers</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>other_headers_len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p><code>#include <<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>></code></p>
|
|
<p><a class="el" href="group__httpft.html#gab393a06d3d2722af4c3f8b06842c80d7">lws_serve_http_file()</a> - Send a file back to the client using http </p><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">wsi</td><td>Websocket instance (available from user callback) </td></tr>
|
|
<tr><td class="paramname">file</td><td>The file to issue over http </td></tr>
|
|
<tr><td class="paramname">content_type</td><td>The http content type, eg, text/html </td></tr>
|
|
<tr><td class="paramname">other_headers</td><td>NULL or pointer to header string </td></tr>
|
|
<tr><td class="paramname">other_headers_len</td><td>length of the other headers if non-NULL <pre class="fragment"> This function is intended to be called from the callback in response
|
|
to http requests from the client. It allows the callback to issue
|
|
local files down the http link in a single step.
|
|
|
|
Returning <0 indicates error and the wsi should be closed. Returning
|
|
>0 indicates the file was completely sent and
|
|
lws_http_transaction_completed() called on the wsi (and close if != 0)
|
|
==0 indicates the file transfer is started and needs more service later,
|
|
the wsi should be left alone.</pre> </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">Generated by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|