`
zdx3578
  • 浏览: 96186 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

yaws 学习笔记!

阅读更多

入门较系统文档: http://yaws.hyber.org/yaws.pdf

 

1  列目录!?? yaws-doc-man config file- dir_listings = true | true_nozip | false

    部分完整配置  yaws.conf

<server localhost>
        port = 8080
        listen = 0.0.0.0
        docroot = "d:\Program Files\Yaws-1.87/www"
        appmods = <cgi-bin, yaws_appmod_cgi>   
        dir_listings = true
</server>

 

ebin_dir = "d:\Program Files\Yaws-1.87/examples/ebin"
ebin_dir = "d:\Program Files\Yaws-1.87/www/"

 

 

2  系统自带一个购物页面 :8080/shoppingcart/   

 

3  When a client browser wants a protected file, it must send a “Authenticate: username:password” header in the request. Note that this is plain text .
WWW-Authentication is configured in the yaws.conf file, in as many <auth> directives as you desire:
<server foo>
docroot = /var/yaws/www/
..
..
<auth>
realm = secretpage
dir = /protected
dir = /anotherdir
user = klacke:gazonk
user = jonny:xyz
user = ronny:12r8uyp09jksfdge4
</auth>
</server>

 

4   页面显示中文:   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=GB18030\">

yaws beam文件更新需要重启yaws以清除缓存

 

 

 

 

3 yaws_api.hrl 几个结构  要好好记一记!

-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 a binary in POST requests)
          server_path,    %% The normalized server path                           %% (pre-querystring part of URI)
          querydata,      %% For URIs of the form ...?querydata                           %%  equiv of cgi QUERY_STRING
          appmoddata,     %% (deprecated - use pathinfo instead) the remainder                           %% of the path leading up to the query
          docroot,        %% Physical base location of data for this request
          docroot_mount,  %% virtual directory e.g /myapp/ that the docroot                          %%  refers to.
          fullpath,       %% full deep path to yaws file
          cont,           %% Continuation for chunked multipart uploads
          state,          %% 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, %% (deprecated - use prepath instead) path in front                           %%of: <appmod><appmoddata>
          prepath,        %% Path prior to 'dynamic' segment of URI.                           %%  ie http://some.host/<prepath>/<script-point>/d/e                           %% where <script-point> is an appmod mount point,                           %% or .yaws,.php,.cgi,.fcgi etc script file.
          pathinfo        %% Set to '/d/e' when calling c.yaws for the request                           %% http://some.host/a/b/c.yaws/d/e                          %%  equiv of cgi PATH_INFO
         }).


-record(http_request , {method,
                       path,
                       version}).

-record(http_response, {version,
                        status,
                        phrase}).

-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,
          location,
          content_length,
          content_type,
          content_encoding,
          authorization,
          transfer_encoding,
          other = []   %% misc other headers
         }).




-record(url,
        {scheme,          %% undefined means not set
         host,            %% undefined means not set
         port,            %% undefined means not set
         path = [],
         querypart = []}).


-record(setcookie,{
            key,          
            value,        
            quoted,       
            comment,
            comment_url,
            discard,
            domain,
            max_age,
            expires,
            path,
            port,
            secure,
            version}).


-record(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
         }).

 

 

 

 

分享到:
评论

相关推荐

    使用Erlang和Yaws开发REST式的服务

    在本文中,我们将探讨如何使用Erlang编程语言和Yaws Web服务器开发RESTful服务。Erlang是一种面向并发和分布式系统的语言,以其高可靠性而著称,而Yaws是由Claes Wikström用Erlang编写的高性能Web服务器,能够处理...

    yaws:Yaws Web服务器

    这是Yaws,是用Erlang编写的动态内容的Web服务器。 准备构建 获取并安装一个Erlang系统( )。 要编译Yaws,需要Erlang / OTP 18.0或更高版本。 如果您已经从github克隆了源代码,并且想使用自动工具进行构建,请...

    yaws-json2:Yaws json2 库

    yaws-json2 yaws-json2 是来自网络服务器的编码器/解码器。安装在 rebar.config 中: { yaws_json2 , " .* " , { git , " git://github.com/myua/yaws-json2 " , { tag , " master " }}}用法使用yaws_json2:decode_...

    yaws:偏航(还有另一个网络抓取工具)

    yaws(Yet Another Web Scraper)是一种易于使用但功能强大的Node.js Web抓取工具,它支持多种常用的抓取技术,通过使用带有正则表达式的模式,通过导航DOM(JQuery样式)来定义对象。 它是一个进行中的工作,包括...

    yaws-开源

    Yaws的独特之处在于其混合了静态文件服务的效率与动态内容生成的能力,使得它成为构建高性能Web应用的理想选择。 Yaws的设计理念是简洁和快速,这体现在它的源代码结构清晰,执行效率高。作为一个基于Erlang编程...

    building_web_applications_with_erlang.pdf

    - **集群Yaws**: 为了提高Web应用的可用性和负载均衡,Yaws支持集群部署,使多个Yaws实例能够协同工作。 5. **EHTML**: - **EHTML头和红色**:这部分内容可能指的是在Erlang中使用的模板系统或标记语言,EHTML...

    Building Web Applications with Erlang.2012.英文

    在Yaws上启动Web服务、服务静态文件(Serving Static Files)、编译、加载和运行代码以及集群化Yaws(Clustering Yaws)是构建Erlang Web应用的关键步骤。 4. 在构建Web应用时,需要考虑系统架构(System ...

    Building Web Applications with Erlang

    在Yaws应用的生命周期中,包括启动Yaws、服务静态文件、编译、加载和运行代码、以及实现Yaws集群的高级功能,都是必须掌握的技术点。 在了解了Erlang及其相关的Web技术之后,我们可以看到,Erlang提供的不仅仅是...

    erlang调用java

    如果你的`YAWS`应用需要调用`J2EE`服务,你可以在`YAWS`的回调函数中插入`Jinterface`的调用代码。这样,每次HTTP请求到达时,`Erlang`都可以通过`Java`调用`J2EE`方法。 7. **性能和限制**:虽然`Jinterface`提供...

    game_manager:游戏后端数据统计平台

    webserver:Yaws, 一个Erlang开发的web服务器. 开发语言:Erlang,Html(html,javascript,css) ###如何部署: 1.下载并安装Erlang. 2.安装完成后,把bin/erl.exe添加入环境变量 3.下载并安装yaws。 4.安装完成后,把/...

    accounter:一个简单的簿记应用程序

    该应用程序是用Erlang编写的,并且使用Yaws作为Web服务器。 在webui中,可以执行以下操作 注册新凭证 正确的错误凭证 生成可存档的报告 余额报告 结果报告 杂志 分类帐 结果与预算之间的差异 生成一个大的组合报告...

    embjson:将 JSON 结构嵌入到 Erlang 代码中

    -embjson([{callback, embjson_yaws_json2}, {function, '@json'}]). 可选属性embjson配置解析转换: callback :回调模块的名称(默认为转换模块)。 模块必须实现embjson行为。 function :封装嵌入式 JSON 的...

    ericssonaxel.github.io:evm.com

    【描述】"帖子" 提示我们这个项目可能包含了一系列的文章或博客帖子,这些帖子可能涵盖了Erlang语言的学习笔记、EVM的内部工作原理、如何使用Erlang进行并发编程、Erlang在分布式系统中的应用,以及与SCSS(Sassy ...

    erlang websocket 练习

    在这个练习中,开发者可能会学习到如何在Erlang中处理HTTP升级请求以切换到WebSocket连接,如何序列化和反序列化消息,以及如何在并发环境中管理多个WebSocket连接。此外,Erlang的错误处理和测试策略也是重要组成...

    try:try.lfe.io的容器化服务,REST API和网站(WIP!)

    try.lfe.io介绍该项目目前正在积极开发中。 有关更多信息,请参见 。... 然后照常做: $ rebar get-deps $ rebar compile用法在开发环境中,只需运行dev目标: $ make dev 这将启动YAWS,您将能够在上查看该网站。

    scrub:感觉很肥皂-Erlang SOAP 1.2客户端

    擦洗-最适合SOAP 一个Erlang SOAP 1.2客户端描述这是Yaws的yaws_soap12_lib到单独的Erlang模块的转换。 见 与洗涤剂类似,但适用于SOAP 1.2。 参见

    erlang深度分析中文版(业余研究)

    6. **Apache与Yaws的性能比较**:书中质疑并对比了Apache和基于Erlang的Web服务器Yaws的性能,为读者提供了选择Web服务框架的参考依据。 7. **erl_call和Erlang C-node**:erl_call是Erlang C绑定的一部分,用于在C...

    JavaScript + Delphi + ErLang讲座内容(4)

    erlang + delphi demo with Web UI`可能是通过Web界面展示Erlang和Delphi的集成,这可能使用了Erlang的Web开发框架,如Yaws或Mochiweb,与Delphi后端进行交互。 - `12. erlang demo with hot update`可能展示了...

    [Erlang] 网络应用开发 (Erlang 实现) (英文版)

    [奥莱理] Building Web Applications with Erlang Working with REST and Web Sockets on Yaws (E-Book) ☆ 出版信息:☆ [作者信息] Zachary Kessin [出版机构] 奥莱理 [出版日期] 2012年06月14日 [图书页数] ...

Global site tag (gtag.js) - Google Analytics