ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:22.38KB ,
资源ID:18922093      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/18922093.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(man page for yaws apiWord文件下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

man page for yaws apiWord文件下载.docx

1、/body/html The out(Arg) function is supplied one argument, an #arg structure. We have the following relevant record definitions: -record(arg, clisock, % the socket leading to the peer client client_ip_port, % ClientIp, ClientPort tuple headers, % headers req, % request clidata, % The client data (as

2、 a binary in POST requests) server_path, % The normalized server path querydata, % Was the URL on the form of .?query (GET reqs) appmoddata, % the remainder of the path up to the query docroot, % wheres the data fullpath, % full path to yaws file cont, % Continuation for chunked multipart uploads st

3、ate, % State for use by users of the out/1 callback pid, % pid of the yaws worker process opaque, % useful to pass static data appmod_prepath, % path in front of:appmodappmoddata pathinfo % Set to d/e when calling c.yaws for the request % http:/some.host/a/b/c.yaws/d/e ). The headers argument is als

4、o a record: -record(headers, connection, accept, host, if_modified_since, if_match, if_none_match, if_range, if_unmodified_since, range, referer, user_agent, accept_ranges, cookie = , keep_alive, content_length, authorization, other = % misc other headers it likes. We have the following functions to

5、 aid that generation.API ssi(DocRoot, ListOfFiles) Server side include. Just include the files as is in the docu- ment. The files will not be parsed and searched for Server side include of pre indented code. The data in Files will be included but contained in a tag. The data will be htmlized. pre_ss

6、i_string(String) Include htmlized content from String. f(Fmt, Args) The equivalent of io_lib:format/2. This function is automati- cally -included in all erlang code which is a part of a yaws page. htmlize(Binary | List | Char) Htmlize an IO list object. setcookie(Name, Value, Path, Expire, Domain ,

7、Secure) Sets a cookie to the browser. find_cookie_val(Cookie, Header) This function can be used to search for a cookie that was previ- ously set by setcookie/2-6. For example if we set a cookie assetcookie(sid,SomeRandomSid) , then on subsequent requests from the browser we can call: find_cookie(,(A

8、rg#arg.headers)#headers.cookie) The function returns if no cookie was found, otherwise the actual cookie is returned as a string. redirect(Url This function generates a redirect to the browser. It will clear any previously set headers. So to generate a redirect and set a cookie, we need to set the c

9、ookie after the redirect as in: . do some stuff Ret = redirect, , setcookie(, Random) . redirect_self(Arg) If we want to issue a redirect to ourselves, this function is useful. It returns a record #redir_self defined in yaws_api.hrl. The record contains fields to construct a URL to ourselves. -recor

10、d(redir_self, host, % string() - our own host scheme, % http | https scheme_str, % https:/ | http: port, % integer() - our own port port_str % :int - the optional port part % to append to the url get_line(String) This function is convenient when getting rn terminated lines from a stream of data. It

11、returns: line, Line, Tail or lastline, Line, Tail The function handles multilines as defined in e.g. SMTP or HTTP mime_type(FileName) Returns the mime type as defined by the extension of FileName stream_chunk_deliver(YawsPid, Data) When a yaws function needs to deliver chunks of data which it gets f

12、rom a process. The other process can call this function to deliver these chunks. It requires the out/1 function to return the value streamcontent, MimeType, FirstChunk to work. YawsPid is the process identifier of the yaws process delivering the original The Pid must typically be passed (somehow) to

13、 the producer of the stream. stream_chunk_deliver_blocking(YawsPid, Data) A synchronous version of the above function. This synchronous version must always be used when the producer of the stream is faster than the consumer. This is usually the case since the client is the WWW browser. stream_chunk_

14、end(YawsPid) When the process discussed above is done delivering data, it must call this function to let the yaws content delivering process finish up the HTTP transaction. stream_process_deliver(Socket, IoList) Yaws allows application processes to deliver data directly to the client. The applicatio

15、n tells yaws about such a process by returning streamcontent_from_pid, MimeType, Pid from its out/1 function. In this case, Pid uses the stream_process_deliver/2 function to deliver data to the client. The application gets Socket from Arg#arg.clisock, and IoList is the data to be sent to the client.

16、 stream_process_deliver_chunk(Socket, IoList) Same as above but delivers IoList using HTTP chunked transfer format. IoList must have a size greater than zero. The application process delivering the data will have had to have make sure that the HTTP headers of the response indicate chunked transfer m

17、ode, either by ensuring no Content-Length header is set or by specifically setting the Transfer-Encoding header to chunked. stream_process_deliver_final_chunk(Socket, IoList) If the application process delivering data to the client uses chunked transfer mode, it must call this to deliver the final c

18、hunk of the transfer. This tells yaws to create a special final chunk in the format required by the HTTP specification (RFC 2616). IoList may be empty, but if its size is greater than zero, that data will be sent as a separate chunk before the final chunk. stream_process_end(Socket, YawsPid) Applica

19、tion processes delivering data directly to clients must call this function to inform yaws that theyve finished using Socket. The YawsPid argument will have been passed to the process earlier when yaws sent it a message telling it to proceed with data delivery. Yaws expects Socket to be open. stream_

20、process_end(closed, YawsPid) Same as the previous function but the application calls this if it closes the client socket as part of its data delivery process. This allows yaws to continue without assuming the socket is still open and encountering errors due to that assumption. The YawsPid argument w

21、ill have been passed to the application process earlier when yaws sent it a message telling it to proceed with data delivery. parse_query(Arg) This function will parse the query part of the URL. It will return a Key, Value list of the items supplied in the query part of the URL. queryvar(Arg, VarNam

22、e) This function is automatically included from yaws_api in all .yaws pages. It is used to search for a variable in the querypart of the url. Returns ok, Val or undefined. If a variable is defined multiple times, the function may also return Val1, . parse_post(Arg) This function will parse the POST

23、data as supplied from the browser. It will return a Key, Value list of the items set by the browser. postvar(Arg, VarName) POSTed data from the client. Returns ok, Val or undefined. getvar(Arg, VarName) This function looks at the HTTP request method from the client and invokes postvar/2 if it is a P

24、OST from the client and queryvar/2 if it is a GET request from the client. parse_multipart_post(Arg) If the browser has set the Content-Type header to the value multipart/form-data, which is the case when the browser wants to upload a file to the server the following happens: If the function returns

25、 result, Res no more data will come from the browser. If the function returns cont, Cont, Res the browser will supply more data. (The file was to big to come in one read) This indicates that there is more data to come and the out/1 function should return get_more, Cont, User_state where User_state m

26、ight usefully be a File Descriptor. The Res value is a list of either: header, Header | part_body, Binary | body, Binary Example usage could be: out(A) - case yaws_api:parse_multipart_post(A) of cont, Cont, Res - St = handle_res(A, Res), get_more, Cont, St; result, Res - handle_res(A, Res), html, f(

27、Done ,) end. handle_res(A, head, Name|T) - io:format(head:pn,Name), handle_res(A, T); handle_res(A, part_body, Data|T) -part_body:,Data), handle_res(A, body, Data|T) -body: handle_res(A, ) -End_resn). new_cookie_session(Opaque) Create a new cookie based session, the yaws system will set the cookie. The new random generated cookie is returned from this function. The Opaque argument will typically contain user data such as user name and pa

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1