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

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值