Releases: zigzap/zap
Release v0.1.7-pre
ZAP Release v0.1.7-pre
Updates
Zig Compatibility Update
This is a first! It's a contributor-only release!
I haven't had a chance to keep up to date with recent changes in the zig standard library fast enough, because @ed.yu took care of them, almost instantly!
Thanks a lot for your PRs!!!!!!! 👍 👍 👍
The zig standard library has changed a bit recently. Zap and its examples were affected by:
- "fromToGate" changing all aToB into bFromA function names
- JSON parser changes
- some weird comptime
null
vs.@as(fieldType, null)
stuff
Thanks to our man @edyu aka @ed.yu, all of this has been taken care of!
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.7-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.7-pre.tar.gz",
.hash = "1220002d24d73672fe8b1e39717c0671598acc8ec27b8af2e1caf623a4fd0ce0d1bd",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.7-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.7-pre.tar.gz",
.hash = "1220002d24d73672fe8b1e39717c0671598acc8ec27b8af2e1caf623a4fd0ce0d1bd",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.6-pre
ZAP Release v0.1.6-pre
Updates
BUGFIX: setCookie() with path and/or domain
A bug in facil.io accidentally overwrote parts of the cookie header with
spaces. If a path but no domain was specified, path
would be
overwritten to ath
, leading to the impression that the path would be
ignored by zap. If both domain and path were specified, domain
would
become main
, but the path part would come later and escape the
overwriting.
My latest patch to facil.io corrects this behavior. Hence, the update.
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.6-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.6-pre.tar.gz",
.hash = "1220a3eab193523b30721dae56a763468b7348b3d1f0b3364d68f6d548c753a72c5a",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.6-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.6-pre.tar.gz",
.hash = "1220a3eab193523b30721dae56a763468b7348b3d1f0b3364d68f6d548c753a72c5a",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.5-pre
ZAP Release v0.1.5-pre
Updates
Weird setCookie() release build bug
This is a bugfix release. I noticed that setCookie()
would always
return an error in release builds.
In trying to debug what is going on, I captured the return value of the
internal http_set_cookie
call in a variable, so I could check AND log
it - instead of just checking if(http_set_cookie() == -1)
. Strangely
enough, the bug disappeared. Without further examination, this seems
like a bug in the current zig compiler.
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.5-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.5-pre.tar.gz",
.hash = "1220229f4418ff5a969428e2f60e138c8316d3ded0f3c0900e1f62bcb20a2f21c3df",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.5-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.5-pre.tar.gz",
.hash = "1220229f4418ff5a969428e2f60e138c8316d3ded0f3c0900e1f62bcb20a2f21c3df",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.4-pre
ZAP Release v0.1.4-pre
Updates
Zig Standard Library snek_case
rename catch-up
The zig standard library is under snek_case
attack! Every now and then
a commit lands that introduces some new renames, with the odd move into
another part of the standard library. Current example: std.debug.TTY
has been renamed to std.io.tty
, which affects
zap.SimpleRequest.sendError()
.
Another change that only affects tooling (pkghash, announceybot) is
lower-casing of enums like std.fs.IterableDir.Entry.Kind
and its
children. They have been renamed to kind
, .file
, .dir
, etc.
So, long story short: if you don't use sendError()
with latest zig
master, no need to update. Yet 😊...
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.4-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.4-pre.tar.gz",
.hash = "12204613bae513282f2b7e468045401cbae09bb19e42baeca193b9c98ff6f2ceb6ef",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.4-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.4-pre.tar.gz",
.hash = "12204613bae513282f2b7e468045401cbae09bb19e42baeca193b9c98ff6f2ceb6ef",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.3-pre
ZAP Release v0.1.3-pre
Updates
UserPassSessionAuth: emphermal session tokens
The UserPassSessionAuth now adds the current timestamp in nanoseconds to the hasher. -> Every successful login will create its own session cookie. A leaked cookie is pretty worthless now (unless an attacker can grab and use it in the same browser session).
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.3-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.3-pre.tar.gz",
.hash = "1220767291ec85dab33cb0f60d51aac140b36beac2a4454fcbc7254e54cc1b387245",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.3-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.3-pre.tar.gz",
.hash = "1220767291ec85dab33cb0f60d51aac140b36beac2a4454fcbc7254e54cc1b387245",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.2-pre
ZAP Release v0.1.2-pre
Updates
Stopping ZAP & Memory Fixes
-
UserPassSessionAuth
didn't clean up properly. On top of that, the way it was implemented, made it complicated to free tokens that were created at /login time but in the map of allowed tokens already. This is now fixed. The example even shows how to scope your main function and call thegpa.detectLeaks()
directly. Which is the way to go if you callzap.stop()
-
zap.stop()
introduced. Execution of the main thread continues past thezap.start()
call.
In other news, the build.zig
script now exposes a single zig build test
target that can be used to run all tests in one go. ZAP is a good zig build citizen now 😊.
In ZIG news: the TLS errors are back. I'm in contact with Andrew about that.
Once ziglang/zig#15194 is implemented, I'll see proper backtraces in the CI when building ZAP. The backtraces should help getting the TLS issues fixed.
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.2-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.2-pre.tar.gz",
.hash = "1220fd222f2f0ddcd3dbc50fae56a8be337002c1fd54e73a5ca67c379ab8955a5a02",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.2-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.2-pre.tar.gz",
.hash = "1220fd222f2f0ddcd3dbc50fae56a8be337002c1fd54e73a5ca67c379ab8955a5a02",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.1-pre
ZAP Release v0.1.1-pre
Updates
release workflow: add manual trigger, use announceybot.exe
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.1-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.1-pre.tar.gz",
.hash = "12206f567408318b76579ab02648412f0fe5d5aceb959503983b7e09149678cd56a7",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.1-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.1-pre.tar.gz",
.hash = "12206f567408318b76579ab02648412f0fe5d5aceb959503983b7e09149678cd56a7",
}
}
}
Then, in your build.zig
's build
function, add the following before exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
Release v0.1.0-pre
ZAP Release v0.1.0-pre
Updates
This marks the 0.1.0-pre release of ZAP!
- From now on, I'll use simple vX.Y.Z-pre for pre-releases of ZAP.
- The GitHub releases are auto-generated by a GitHub action
- The first version of the Discord announceybot informs the
#announcement channel about new releases - The README gets auto-updated with the correct
build.zig.zon
instructions.
New Feature: Error Trace Responses!
You can now call r.sendError(err, status_code)
when you catch an error
and a stack trace is returned to the client / browser. This is a
first-cut implementation of the feature. It does not yet honor accept
headers, for example, and just returns plain text.
The README points to a small example.
Random stuff:
At some stage I'll just rewrite announceybot in Zig, and have it cover
all tasks that are now spread in various python scripts. It's just less
hassle when you know the static executable is built, only a few kB in
size so it can actually checked into the git repository if it needs to,
and no GitHub / python package configuration can make it "un-work" 😊.
It's self-contained.
In accordance to above thoughts, I added a ReleaseSmall static version
of the pkghash
tool into the repo, so the GH actions can use it w/o
needing to build it first. It's 55kB in size so I think that's OK.
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap v0.1.0-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.0-pre.tar.gz",
.hash = "122017942fe459da06812370f7fe2bbd304995bb6450c89ae5bdbbe690c3b8908bbd",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.0-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.0-pre.tar.gz",
.hash = "122017942fe459da06812370f7fe2bbd304995bb6450c89ae5bdbbe690c3b8908bbd",
}
}
}
Then, in your build.zig
's build
function, add the following before
exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
release-0.0.24
ZAP Release release-0.0.24
Updates
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap release-0.0.24
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/release-0.0.24.tar.gz",
.hash = "1220f520fcdd4b3adbca918deeb42f512f7ef4a827680eea8af9abc64b90ed7a5e78",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap release-0.0.24
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/release-0.0.24.tar.gz",
.hash = "1220f520fcdd4b3adbca918deeb42f512f7ef4a827680eea8af9abc64b90ed7a5e78",
}
}
}
Then, in your build.zig
's build
function, add the following before
exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
release-0.0.23
ZAP Release release-0.0.23
Updates
- zap.Middleware.EndpointHander : use endpoints in your middleware chain
- zap.SimpleRequest.get/setContext() : used internally, but you can, too set a per-request context now
See the README for more details and examples.
Using it
To use in your own projects, put this dependency into your build.zig.zon
:
// zap release-0.0.23
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/release-0.0.23.tar.gz",
.hash = "1220175a7495f41889208349fedd6a35e96d8e413e5cd23b9b875e40d176bad459e1",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap release-0.0.23
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/release-0.0.23.tar.gz",
.hash = "1220175a7495f41889208349fedd6a35e96d8e413e5cd23b9b875e40d176bad459e1",
}
}
}
Then, in your build.zig
's build
function, add the following before
exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));