mirror of
https://github.com/zigzap/zap.git
synced 2025-10-21 07:34:08 +00:00
1.fix 0.12.0-dev.2334+aef1da163 build
This commit is contained in:
parent
028574f3ed
commit
6804d0f685
8 changed files with 60 additions and 56 deletions
|
@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
|
|
||||||
const use_openssl = b.option(bool, "openssl", "Use system-installed openssl for TLS support in zap") orelse blk: {
|
const use_openssl = b.option(bool, "openssl", "Use system-installed openssl for TLS support in zap") orelse blk: {
|
||||||
// Alternatively, use an os env var to determine whether to build openssl support
|
// Alternatively, use an os env var to determine whether to build openssl support
|
||||||
if (std.posix.getenv("ZAP_USE_OPENSSL")) |val| {
|
if (std.os.getenv("ZAP_USE_OPENSSL")) |val| {
|
||||||
if (std.mem.eql(u8, val, "true")) break :blk true;
|
if (std.mem.eql(u8, val, "true")) break :blk true;
|
||||||
}
|
}
|
||||||
break :blk false;
|
break :blk false;
|
||||||
|
@ -257,7 +257,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
var announceybot_step = b.step("announceybot", "Build announceybot");
|
const announceybot_step = b.step("announceybot", "Build announceybot");
|
||||||
const announceybot_build_step = b.addInstallArtifact(announceybot_exe, .{});
|
const announceybot_build_step = b.addInstallArtifact(announceybot_exe, .{});
|
||||||
announceybot_step.dependOn(&announceybot_build_step.step);
|
announceybot_step.dependOn(&announceybot_build_step.step);
|
||||||
all_step.dependOn(&announceybot_build_step.step);
|
all_step.dependOn(&announceybot_build_step.step);
|
||||||
|
|
|
@ -11,12 +11,14 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
|
||||||
var http_client: std.http.Client = .{ .allocator = a };
|
var http_client: std.http.Client = .{ .allocator = a };
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
var req = try http_client.open(.GET, uri, h, .{});
|
var result = try http_client.fetch(a,.{
|
||||||
defer req.deinit();
|
.method = .GET,
|
||||||
|
.location = .{
|
||||||
try req.headers.append("cookie", "ZIG_ZAP=awesome");
|
.uri = uri,
|
||||||
try req.send(.{});
|
},
|
||||||
try req.wait();
|
.headers = h,
|
||||||
|
});
|
||||||
|
defer result.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn makeRequestThread(a: std.mem.Allocator, url: []const u8) !std.Thread {
|
fn makeRequestThread(a: std.mem.Allocator, url: []const u8) !std.Thread {
|
||||||
|
|
|
@ -11,11 +11,14 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
|
||||||
var http_client: std.http.Client = .{ .allocator = a };
|
var http_client: std.http.Client = .{ .allocator = a };
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
var req = try http_client.open(.GET, uri, h, .{});
|
var result = try http_client.fetch(a,.{
|
||||||
defer req.deinit();
|
.method = .GET,
|
||||||
|
.location = .{
|
||||||
try req.send(.{});
|
.uri = uri,
|
||||||
try req.wait();
|
},
|
||||||
|
.headers = h,
|
||||||
|
});
|
||||||
|
defer result.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn makeRequestThread(a: std.mem.Allocator, url: []const u8) !std.Thread {
|
fn makeRequestThread(a: std.mem.Allocator, url: []const u8) !std.Thread {
|
||||||
|
|
|
@ -146,22 +146,20 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8, auth: ?ClientAuthReqHeader
|
||||||
var http_client: std.http.Client = .{ .allocator = a };
|
var http_client: std.http.Client = .{ .allocator = a };
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
var req = try http_client.open(.GET, uri, h, .{});
|
var result = try http_client.fetch(a,.{
|
||||||
defer req.deinit();
|
.location = .{
|
||||||
|
.uri = uri,
|
||||||
try req.send(.{});
|
},
|
||||||
try req.wait();
|
.headers = h,
|
||||||
// req.deinit() panics!
|
});
|
||||||
// defer req.deinit();
|
defer result.deinit();
|
||||||
|
|
||||||
// without this block, the tests sometimes get stuck which
|
// without this block, the tests sometimes get stuck which
|
||||||
// might have to do with connection pooling and connections being in
|
// might have to do with connection pooling and connections being in
|
||||||
// a different state when all data has been read?!?
|
// a different state when all data has been read?!?
|
||||||
{
|
{
|
||||||
var buffer: [1024]u8 = undefined;
|
if(result.body)|body|{
|
||||||
// we know we won't receive a lot
|
std.debug.print("RESPONSE:\n{s}\n", .{body[0..]});
|
||||||
const len = try req.reader().readAll(&buffer);
|
}
|
||||||
std.debug.print("RESPONSE:\n{s}\n", .{buffer[0..len]});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zap.stop();
|
zap.stop();
|
||||||
|
|
|
@ -10,11 +10,14 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
|
||||||
var http_client: std.http.Client = .{ .allocator = a };
|
var http_client: std.http.Client = .{ .allocator = a };
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
var req = try http_client.open(.GET, uri, h, .{});
|
var result = try http_client.fetch(a,.{
|
||||||
defer req.deinit();
|
.method = .GET,
|
||||||
|
.location = .{
|
||||||
try req.send(.{});
|
.uri = uri,
|
||||||
try req.wait();
|
},
|
||||||
|
.headers = h,
|
||||||
|
});
|
||||||
|
defer result.deinit();
|
||||||
zap.stop();
|
zap.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,19 @@ fn makeRequest(a: std.mem.Allocator, url: []const u8) !void {
|
||||||
var http_client: std.http.Client = .{ .allocator = a };
|
var http_client: std.http.Client = .{ .allocator = a };
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
var req = try http_client.open(.GET, uri, h, .{});
|
var result = try http_client.fetch(a,.{
|
||||||
defer req.deinit();
|
.method = .GET,
|
||||||
|
.location = .{
|
||||||
try req.send(.{});
|
.uri = uri,
|
||||||
try req.wait();
|
},
|
||||||
read_len = try req.readAll(&buffer);
|
.headers = h,
|
||||||
|
});
|
||||||
|
defer result.deinit();
|
||||||
|
|
||||||
|
if(result.body)|body|{
|
||||||
|
read_len = body.len;
|
||||||
|
std.mem.copyForwards(u8,&buffer,body);
|
||||||
|
}
|
||||||
zap.stop();
|
zap.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,23 +160,16 @@ fn sendToDiscordPart(allocator: std.mem.Allocator, url: []const u8, message_json
|
||||||
var http_client: std.http.Client = .{ .allocator = allocator };
|
var http_client: std.http.Client = .{ .allocator = allocator };
|
||||||
defer http_client.deinit();
|
defer http_client.deinit();
|
||||||
|
|
||||||
// request
|
var result = try http_client.fetch(allocator,.{
|
||||||
var req = try http_client.open(.POST, uri, h, .{});
|
.method = .POST,
|
||||||
defer req.deinit();
|
.location = .{
|
||||||
|
.uri = uri,
|
||||||
req.transfer_encoding = .chunked;
|
},
|
||||||
|
.payload = .{
|
||||||
// connect, send request
|
.string = message_json,
|
||||||
try req.send(.{});
|
},
|
||||||
|
});
|
||||||
// send POST payload
|
defer result.deinit();
|
||||||
try req.writer().writeAll(message_json);
|
|
||||||
try req.finish();
|
|
||||||
|
|
||||||
// wait for response
|
|
||||||
try req.wait();
|
|
||||||
var buffer: [1024]u8 = undefined;
|
|
||||||
_ = try req.readAll(&buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sendToDiscord(allocator: std.mem.Allocator, url: []const u8, message: []const u8) !void {
|
fn sendToDiscord(allocator: std.mem.Allocator, url: []const u8, message: []const u8) !void {
|
||||||
|
|
|
@ -266,8 +266,7 @@ pub fn cmdPkg(gpa: Allocator, arena: Allocator, args: []const []const u8) !void
|
||||||
|
|
||||||
// computePackageHash will close the directory after completion
|
// computePackageHash will close the directory after completion
|
||||||
// std.debug.print("abspath: {s}\n", .{cwd_absolute_path});
|
// std.debug.print("abspath: {s}\n", .{cwd_absolute_path});
|
||||||
var cwd_copy = try fs.openDirAbsolute(cwd_absolute_path, .{});
|
const dir = try fs.openDirAbsolute(cwd_absolute_path, .{});
|
||||||
errdefer cwd_copy.close();
|
|
||||||
|
|
||||||
var thread_pool: ThreadPool = undefined;
|
var thread_pool: ThreadPool = undefined;
|
||||||
try thread_pool.init(.{ .allocator = gpa });
|
try thread_pool.init(.{ .allocator = gpa });
|
||||||
|
@ -281,7 +280,7 @@ pub fn cmdPkg(gpa: Allocator, arena: Allocator, args: []const []const u8) !void
|
||||||
};
|
};
|
||||||
break :blk try computePackageHashExcludingDirectories(
|
break :blk try computePackageHashExcludingDirectories(
|
||||||
&thread_pool,
|
&thread_pool,
|
||||||
cwd_copy,
|
dir,
|
||||||
excluded_directories,
|
excluded_directories,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue