Class: Yahns::WbufStr
- Inherits:
-
Object
- Object
- Yahns::WbufStr
- Includes:
- WbufCommon
- Defined in:
- lib/yahns/wbuf_str.rb
Overview
we only use this for buffering the tiniest responses (which are already strings in memory and a handful of bytes).
"HTTP", "/1.1 "
"HTTP/1.1 100 Continue\r\n\r\n"
"100 Continue\r\n\r\nHTTP/1.1 "
This is very, very rarely triggered. 1) check_client_connection is enabled 2) the client sent an “Expect: 100-continue” header
Most output buffering goes through the normal Yahns::Wbuf class which uses a temporary file as a buffer (suitable for sendfile())
Instance Method Summary collapse
-
#initialize(str, next_state) ⇒ WbufStr
constructor
A new instance of WbufStr.
- #wbuf_flush(client) ⇒ Object
Methods included from WbufCommon
Constructor Details
#initialize(str, next_state) ⇒ WbufStr
Returns a new instance of WbufStr.
23 24 25 26 |
# File 'lib/yahns/wbuf_str.rb', line 23 def initialize(str, next_state) @str = str @next = next_state # :ccc_done, :r100_done end |
Instance Method Details
#wbuf_flush(client) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/yahns/wbuf_str.rb', line 28 def wbuf_flush(client) case rv = client.kgio_trywrite(@str) when String @str = rv when :wait_writable, :wait_readable return rv when nil return @next end while true end |