reaktivity / k3po-nukleus-ext.java

K3PO Nukleus Extension
Apache License 2.0
0 stars 9 forks source link

Need to be able to write an empty data frame with extensions #14

Closed dpwspoon closed 7 years ago

dpwspoon commented 7 years ago

The following is not written unless there is a write with actual data afterwards

write nukleus:data.ext ${http:header(":scheme", "http")}
                       ${http:header(":method", "GET")}
                       ${http:header(":path", "/path")}
                       ${http:header(":authority", "localhost:8080")}
                       ${http:header("x-http-cache-sync", "always")}
                       ${http:header("x-poll-injected", "no-cache")}
                       ${http:header("cache-control", "no-cache")}
                       ${http:header("if-none-match", etag)}

Meaning, the following always fails/can't be scripted

write nukleus:data.ext ${http:header(":scheme", "http")}
                       ${http:header(":method", "GET")}
                       ${http:header(":path", "/path")}
                       ${http:header(":authority", "localhost:8080")}
                       ${http:header("x-http-cache-sync", "always")}
                       ${http:header("x-poll-injected", "no-cache")}
                       ${http:header("cache-control", "no-cache")}
                       ${http:header("if-none-match", etag)}

write close
jfallows commented 7 years ago

Trying using write flush after the write nukleus:data.ext ... and also make sure you are using the latest release.

dpwspoon commented 7 years ago

This is working in 0.7.2 (note, appears to have regressed in 0.7)

dpwspoon commented 7 years ago

The write flush corresponds to data on the other side that needs to be read. The following fails

read nukleus:data.ext ${http:header(":scheme", "http")}
read closed

in response to

write nukleus:data.ext ${http:header(":scheme", "http")}
write flush
write close

as the read closed has unread empty data.

But this passes

read nukleus:data.ext ${http:header(":scheme", "http")}
read /.*/  # this consumes the read event
read closed