summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--API-C.md2
-rw-r--r--src/c/include/unit/unit-wasm.h3
-rw-r--r--src/c/libunit-wasm.c4
-rw-r--r--src/rust/unit-wasm-sys/rusty.rs2
4 files changed, 6 insertions, 5 deletions
diff --git a/API-C.md b/API-C.md
index c0cfc02..aa44149 100644
--- a/API-C.md
+++ b/API-C.md
@@ -711,7 +711,7 @@ luw_http_hdr_iter(&ctx, hdr_iter_func, NULL);
### luw_http_hdr_get_value
```C
-const char *luw_http_hdr_get_value(luw_ctx_t *ctx, const char *hdr);
+const char *luw_http_hdr_get_value(const luw_ctx_t *ctx, const char *hdr);
```
Given a HTTP header _hdr_ this function will look it up in the request and
diff --git a/src/c/include/unit/unit-wasm.h b/src/c/include/unit/unit-wasm.h
index cfff906..cc14b9d 100644
--- a/src/c/include/unit/unit-wasm.h
+++ b/src/c/include/unit/unit-wasm.h
@@ -183,7 +183,8 @@ extern void luw_http_hdr_iter(luw_ctx_t *ctx,
const char *value,
void *data),
void *user_data);
-extern const char *luw_http_hdr_get_value(luw_ctx_t *ctx, const char *hdr);
+extern const char *luw_http_hdr_get_value(const luw_ctx_t *ctx,
+ const char *hdr);
extern size_t luw_get_response_data_size(const luw_ctx_t *ctx);
extern int luw_mem_writep(luw_ctx_t *ctx, const char *fmt, ...);
extern size_t luw_mem_writep_data(luw_ctx_t *ctx, const u8 *src, size_t size);
diff --git a/src/c/libunit-wasm.c b/src/c/libunit-wasm.c
index 11272ed..c0c02c5 100644
--- a/src/c/libunit-wasm.c
+++ b/src/c/libunit-wasm.c
@@ -234,13 +234,13 @@ void luw_http_hdr_iter(luw_ctx_t *ctx,
}
}
-const char *luw_http_hdr_get_value(luw_ctx_t *ctx, const char *hdr)
+const char *luw_http_hdr_get_value(const luw_ctx_t *ctx, const char *hdr)
{
luw_http_hdr_iter_t *iter;
const char *name;
const char *value;
- luw_foreach_http_hdr((*ctx), iter, name, value) {
+ luw_foreach_http_hdr(((luw_ctx_t)*ctx), iter, name, value) {
if (strcasecmp(name, hdr) == 0)
return value;
}
diff --git a/src/rust/unit-wasm-sys/rusty.rs b/src/rust/unit-wasm-sys/rusty.rs
index fbfecd3..981e24a 100644
--- a/src/rust/unit-wasm-sys/rusty.rs
+++ b/src/rust/unit-wasm-sys/rusty.rs
@@ -124,7 +124,7 @@ pub fn uwr_http_hdr_iter(
unsafe { luw_http_hdr_iter(ctx, luw_http_hdr_iter_func, user_data) }
}
-pub fn uwr_http_hdr_get_value(ctx: *mut luw_ctx_t, hdr: &str) -> &'static str {
+pub fn uwr_http_hdr_get_value(ctx: *const luw_ctx_t, hdr: &str) -> &'static str {
C2S!(luw_http_hdr_get_value(ctx, S2C!(hdr).as_ptr() as *const i8))
}