<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit-wasm.git, branch v0.3.0</title>
<subtitle>Development libraries (C &amp; Rust) for writing WebAssembly modules for NGINX Unit</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/'/>
<entry>
<title>unit-wasm 0.3.0</title>
<updated>2023-10-19T18:35:12+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-10-19T18:35:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=01c43784ec53aa1ff22aca7e7ae6f18b4591b514'/>
<id>01c43784ec53aa1ff22aca7e7ae6f18b4591b514</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Do some simplification around unsafe {} blocks</title>
<updated>2023-10-17T18:01:06+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-10-17T17:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=9b17f64d301334b999a8138037d32ff72e951018'/>
<id>9b17f64d301334b999a8138037d32ff72e951018</id>
<content type='text'>
We can put the unsafe keyword as part of the function definition,
getting rid of the unsafe {} blocks in the functions themselves.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can put the unsafe keyword as part of the function definition,
getting rid of the unsafe {} blocks in the functions themselves.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/rust: Further simplify hello-world</title>
<updated>2023-10-17T17:39:57+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-10-17T17:39:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=73d0914bc1d1f3a4b1b3e28815d892ef2143be0f'/>
<id>73d0914bc1d1f3a4b1b3e28815d892ef2143be0f</id>
<content type='text'>
In this example we don't need the request buf.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In this example we don't need the request buf.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/c: Remove a duplicate word from large-upload.c</title>
<updated>2023-10-11T15:40:32+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-10-11T15:40:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=63e2d345eb1b6c785dfd3e1559b71aea056edd92'/>
<id>63e2d345eb1b6c785dfd3e1559b71aea056edd92</id>
<content type='text'>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>API-C.md: Fix a broken fragment link</title>
<updated>2023-09-29T21:45:42+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-09-29T21:43:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=c50e2c23c4d3b9c436d1b7de748b4c3809356f41'/>
<id>c50e2c23c4d3b9c436d1b7de748b4c3809356f41</id>
<content type='text'>
Fixes: 1beab00ac ("Allow to set the HTTP response status")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes: 1beab00ac ("Allow to set the HTTP response status")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: Add C and Rust examples of handling large uploads</title>
<updated>2023-09-25T16:39:51+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-09-25T12:19:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=e4a868078ab43772e36cd8ffc59fd995353fb402'/>
<id>e4a868078ab43772e36cd8ffc59fd995353fb402</id>
<content type='text'>
The programs demonstrate handling requests with payloads larger than
4GiB which means they need to be written out to disk and so also
demonstrates the use of the file-system access mechanism.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The programs demonstrate handling requests with payloads larger than
4GiB which means they need to be written out to disk and so also
demonstrates the use of the file-system access mechanism.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>API-Rust.md: Update for libunit-wasm updates</title>
<updated>2023-09-25T16:39:51+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-09-22T20:41:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=c3ea7bbe122c87abd7114a770144e114e2ce927e'/>
<id>c3ea7bbe122c87abd7114a770144e114e2ce927e</id>
<content type='text'>
uwr_get_http_content_len() &amp; uwr_get_http_total_content_sent() now
return a u64.

Two new functions were added

uwr_req_buf_copy()

Like uwr_req_buf_append() but just copies the data over what's already
there.

uwr_mem_splice_file()

This write(2)'s the request data directly from the shared memory to a
given file.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
uwr_get_http_content_len() &amp; uwr_get_http_total_content_sent() now
return a u64.

Two new functions were added

uwr_req_buf_copy()

Like uwr_req_buf_append() but just copies the data over what's already
there.

uwr_mem_splice_file()

This write(2)'s the request data directly from the shared memory to a
given file.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>API-C.md: Update for libunit-wasm updates</title>
<updated>2023-09-25T16:39:51+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-09-22T20:31:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=b163831e43d04f30de06784eeb8be8be77176880'/>
<id>b163831e43d04f30de06784eeb8be8be77176880</id>
<content type='text'>
The types of some of the member of the luw_req structure increased to
64bits to allow for uploads larger than 4GiB.

Two new functions were added

luw_req_buf_copy()

Like luw_req_buf_append() but just copies the data over what's already
there.

luw_mem_splice_file()

This write(2)'s the request data directly from the shared memory to a
given file.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The types of some of the member of the luw_req structure increased to
64bits to allow for uploads larger than 4GiB.

Two new functions were added

luw_req_buf_copy()

Like luw_req_buf_append() but just copies the data over what's already
there.

luw_mem_splice_file()

This write(2)'s the request data directly from the shared memory to a
given file.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust/rusty: Add wrappers for new functions</title>
<updated>2023-09-25T16:39:51+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-09-22T20:17:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=f8927bd16a5fa996d23eebfed8762c1b0dc0244c'/>
<id>f8927bd16a5fa996d23eebfed8762c1b0dc0244c</id>
<content type='text'>
libunit-wasm added two new functions, luw_req_buf_copy() &amp;
luw_mem_splice_file(). See the previous two commits...

This second function takes a file-descriptor as one of its arguments, in
rusty we make this a Rust File object, then pass the underlying fd into
libunit-wasm.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libunit-wasm added two new functions, luw_req_buf_copy() &amp;
luw_mem_splice_file(). See the previous two commits...

This second function takes a file-descriptor as one of its arguments, in
rusty we make this a Rust File object, then pass the underlying fd into
libunit-wasm.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libunit-wasm: Add a luw_mem_splice_file() function</title>
<updated>2023-09-25T16:39:43+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-09-21T16:14:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=43c8e44d33572b818cdd0a5945e494c5510ab24f'/>
<id>43c8e44d33572b818cdd0a5945e494c5510ab24f</id>
<content type='text'>
This is inspired by the likes of splice(2) and sendfile(2) in that it
takes data from one place and puts it in another.

This function write(2)'s the request data straight from the shared
memory to a given file (referenced by its file descriptor).

This is an alternative to using luw_req_buf_copy() and avoids an extra
copying of the request data.

E.g

  /* In the request_handler */
  if (total_bytes_wrote == 0) {
          luw_init_ctx(&amp;ctx, addr, 0);
          luw_set_req_buf(&amp;ctx, &amp;request_buf, LUW_SRB_NONE);

          fd = open("/var/tmp/large-file.dat", O_CREAT|O_TRUNC|O_WRONLY,
                    0666);
  }

  total_bytes_wrote += luw_mem_splice_file(addr, fd);
  if (total_bytes_wrote == luw_get_http_content_len(&amp;ctx)) {
          close(fd);
          total_bytes_wrote = 0;
          luw_http_response_end();
  }

NOTE:

We include a typedef definition for ssize_t in unit-wasm.h, to avoid
having a dependency on the wasi-sysroot when generating the rust
bindings.

ssize_t is defined in sys/types.h which is provided by libc and not the
compiler.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is inspired by the likes of splice(2) and sendfile(2) in that it
takes data from one place and puts it in another.

This function write(2)'s the request data straight from the shared
memory to a given file (referenced by its file descriptor).

This is an alternative to using luw_req_buf_copy() and avoids an extra
copying of the request data.

E.g

  /* In the request_handler */
  if (total_bytes_wrote == 0) {
          luw_init_ctx(&amp;ctx, addr, 0);
          luw_set_req_buf(&amp;ctx, &amp;request_buf, LUW_SRB_NONE);

          fd = open("/var/tmp/large-file.dat", O_CREAT|O_TRUNC|O_WRONLY,
                    0666);
  }

  total_bytes_wrote += luw_mem_splice_file(addr, fd);
  if (total_bytes_wrote == luw_get_http_content_len(&amp;ctx)) {
          close(fd);
          total_bytes_wrote = 0;
          luw_http_response_end();
  }

NOTE:

We include a typedef definition for ssize_t in unit-wasm.h, to avoid
having a dependency on the wasi-sysroot when generating the rust
bindings.

ssize_t is defined in sys/types.h which is provided by libc and not the
compiler.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
