<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit-wasm.git/src/rust/unit-wasm-sys, branch v0.2.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.2.0</title>
<updated>2023-08-30T13:56:03+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-30T13:56:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=d81bc9290edc8d1eb59ced024499359ccd4da77a'/>
<id>d81bc9290edc8d1eb59ced024499359ccd4da77a</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>Rust/rusty: Make use of uwr_get_http_total_content_sent()</title>
<updated>2023-08-29T22:41:11+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-29T22:31:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=04197e036a01d3826e0529f1396924a868bb4dd2'/>
<id>04197e036a01d3826e0529f1396924a868bb4dd2</id>
<content type='text'>
When the uwr_get_http_content_str() function, which returns the request
body content as a string, was added it used uwr_get_http_content_len()
to determine the length of the returned string (the request body content
is not null-terminated).

This could potentially in some circumstances return too much data if the
request was split over multiple calls into the Wasm module and
uwr_get_http_content_str() was called before all the data had actually
been received.

Instead use the newly introduced uwr_get_http_total_content_sent()
function to determine the amount of data to return in the string as it
currently stands.

Fixes: bf968c9 ("Rust/rusty: Add uwr_get_http_content_str()")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the uwr_get_http_content_str() function, which returns the request
body content as a string, was added it used uwr_get_http_content_len()
to determine the length of the returned string (the request body content
is not null-terminated).

This could potentially in some circumstances return too much data if the
request was split over multiple calls into the Wasm module and
uwr_get_http_content_str() was called before all the data had actually
been received.

Instead use the newly introduced uwr_get_http_total_content_sent()
function to determine the amount of data to return in the string as it
currently stands.

Fixes: bf968c9 ("Rust/rusty: Add uwr_get_http_content_str()")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rust/rusty: Add a wrapper for luw_get_http_total_content_sent()</title>
<updated>2023-08-29T22:30:21+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-29T22:30:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=5dc0cf051059ac83899b55f4a55df363faea4419'/>
<id>5dc0cf051059ac83899b55f4a55df363faea4419</id>
<content type='text'>
This returns the total amount of content that the Wasm module has
received so far.

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 returns the total amount of content that the Wasm module has
received so far.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rust/rusty: Re-order some functions more logically</title>
<updated>2023-08-29T22:23:05+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-29T22:23:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=f748851daf87ce40cd2fed8c205afc4482c689a1'/>
<id>f748851daf87ce40cd2fed8c205afc4482c689a1</id>
<content type='text'>
This may not matter in rust (if you use a function before the compiler
has seen a definition for it), but anyway in preparation for adding a
uwr_get_http_total_content_sent() function, put the content length
related functions before the functions that return the content.

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 may not matter in rust (if you use a function before the compiler
has seen a definition for it), but anyway in preparation for adding a
uwr_get_http_total_content_sent() function, put the content length
related functions before the functions that return the content.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rust/rusty: Add a couple of convenience functions</title>
<updated>2023-08-29T16:36:43+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-29T14:53:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=15b73feec504db5f5381fbfedd7dc15cd8f8c7c9'/>
<id>15b73feec504db5f5381fbfedd7dc15cd8f8c7c9</id>
<content type='text'>
This adds the following convenience functions for adding HTTP response
headers, Content-Type &amp; Content-length

  uwr_http_add_header_content_type(ctx: *mut luw_ctx_t, ctype: &amp;str);
  uwr_http_add_header_content_len(ctx: *mut luw_ctx_t);

These are perhaps the two most common headers so it makes sense to
reduce the effort to adding them.

E.g before

  uwr_http_add_header(&amp;ctx, "Content-Type", "text/plain");
  uwr_http_add_header(
      ctx,
      "Content-Length",
      &amp;format!("{}", uwr_get_response_data_size(ctx)),
  );

after

  uwr_http_add_header_content_type(ctx, "text/plain");
  uwr_http_add_header_content_len(ctx);

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 adds the following convenience functions for adding HTTP response
headers, Content-Type &amp; Content-length

  uwr_http_add_header_content_type(ctx: *mut luw_ctx_t, ctype: &amp;str);
  uwr_http_add_header_content_len(ctx: *mut luw_ctx_t);

These are perhaps the two most common headers so it makes sense to
reduce the effort to adding them.

E.g before

  uwr_http_add_header(&amp;ctx, "Content-Type", "text/plain");
  uwr_http_add_header(
      ctx,
      "Content-Length",
      &amp;format!("{}", uwr_get_response_data_size(ctx)),
  );

after

  uwr_http_add_header_content_type(ctx, "text/plain");
  uwr_http_add_header_content_len(ctx);

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rust/rusty: Add uwr_get_http_content_str()</title>
<updated>2023-08-29T15:39:07+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-29T00:33:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=bf968c99ce109c63fded62ec573c4bc247dc9c0a'/>
<id>bf968c99ce109c63fded62ec573c4bc247dc9c0a</id>
<content type='text'>
This function is like uwr_get_http_content() except that it returns a
Rust str.

This is more convenient if you want to operate on the body content
within Rust.

It's worth noting that uwr_get_http_content() returns a non null
terminated buffer which makes it tricky to work with in Rust.

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 function is like uwr_get_http_content() except that it returns a
Rust str.

This is more convenient if you want to operate on the body content
within Rust.

It's worth noting that uwr_get_http_content() returns a non null
terminated buffer which makes it tricky to work with in Rust.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rust/rusty: Run rusty.rs through rustfmt</title>
<updated>2023-08-29T15:33:37+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-28T22:28:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=272bef7ffb6e014920c8de2f31fe7f9b6ab04879'/>
<id>272bef7ffb6e014920c8de2f31fe7f9b6ab04879</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>Rust/unit-wasm-sys: Version 0.1.4</title>
<updated>2023-08-28T21:21:11+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-28T21:21:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=c4021f9c9c33cbac9248a5239c2fcf8129152ee4'/>
<id>c4021f9c9c33cbac9248a5239c2fcf8129152ee4</id>
<content type='text'>
luw_http_add_header() no longer takes an idx argument.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
luw_http_add_header() no longer takes an idx argument.

Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Rust/unit-wasm-sys: Re-generate the bindings on changes to unit-wasm.h</title>
<updated>2023-08-28T19:44:23+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-28T19:37:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=cf49f71c293581cca2cff78b77f3a4dc791ca926'/>
<id>cf49f71c293581cca2cff78b77f3a4dc791ca926</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>Rust/rusty: Make a bunch of functions take ctx as const</title>
<updated>2023-08-28T19:44:23+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2023-08-28T11:41:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit-wasm.git/commit/?id=0b1ff5207609bb2939fe70e996aa7651eac86c46'/>
<id>0b1ff5207609bb2939fe70e996aa7651eac86c46</id>
<content type='text'>
The various uwr_get_ functions should take the context pointer as a
const.

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 various uwr_get_ functions should take the context pointer as a
const.

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