Erlang / Yaws中chunk和non-chunk流的区别是什么

时间:2016-06-08 21:15:31

标签: erlang yaws

yaws_api:stream_process_deliver(Socket, IoList) yaws_api:stream_process_deliver_chunk(Socket, IoList)之间有什么区别? <p id="notice"><%= notice %></p> <h1>Listing Products</h1> <div class="container-fluid"> <div class="row"> <% @products.each do |product| %> <div class="col-sm-2 col-md-4"> <% cache(cache_key_for_products) do %> <%= render partial: "product", locals: {product: product} %> <% end %> </div><!-- col div --> <% end %> </div><!-- row div --> </div><!--container div --> <!-- remove table <table> <thead> <tr> <th>Name</th> <th>Description</th> <th>Image url</th> <th>Colour</th> <th>Price</th> <th colspan="3"></th> </tr> </thead> <tbody> <% @products.each do |product| %> <tr> <td><%= product.name %></td> <td><%= product.description %></td> <td><%= product.image_url %></td> <td><%= product.colour %></td> <td><%= product.price %></td> <td><%= link_to 'Show', product %></td> <td><%= link_to 'Edit', edit_product_path(product) %></td> <td><%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %></td> </tr> <% end %> </tbody> </table> --> <br> <%= link_to 'New Product', new_product_path %>`

1 个答案:

答案 0 :(得分:2)

yaws_api:stream_process_deliver(Socket, IoList)yaws_api:stream_process_deliver_chunk(Socket, IoList)之间的差异与HTTP 1.1 Transfer Coding有关。第一个函数将提供的数据按原样传输到HTTP客户端,而第二个函数使用分块传输将数据发送到客户端。

有关详细信息,请参阅Yaws PDF documentation的第7.5节。