Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete bun_dev_http_server.zig #7283

Merged
merged 4 commits into from
Nov 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions misctools/fetch.zig
Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@ pub usingnamespace @import("root").bun;
const clap = bun.clap;

const URL = @import("../src/url.zig").URL;
const Headers = @import("root").bun.HTTP.Headers;
const Headers = @import("root").bun.http.Headers;
const Method = @import("../src/http/method.zig").Method;
const ColonListType = @import("../src/cli/colon_list_type.zig").ColonListType;
const HeadersTuple = ColonListType(string, noop_resolver);
const path_handler = @import("../src/resolver/resolve_path.zig");
const HTTPThread = @import("root").bun.HTTP.HTTPThread;
const HTTP = @import("root").bun.HTTP;
const HTTPThread = @import("root").bun.http.HTTPThread;
const HTTP = @import("root").bun.http;
fn noop_resolver(in: string) !string {
return in;
}
2 changes: 1 addition & 1 deletion misctools/http_bench.zig
Original file line number Diff line number Diff line change
@@ -177,7 +177,7 @@ pub const Arguments = struct {
}
};

const HTTP = @import("root").bun.HTTP;
const HTTP = @import("root").bun.http;
const NetworkThread = HTTP.NetworkThread;

var stdout_: std.fs.File = undefined;
6 changes: 3 additions & 3 deletions misctools/machbench.zig
Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@ const clap = @import("../src/deps/zig-clap/clap.zig");
const AsyncIO = @import("root").bun.AsyncIO;

const URL = @import("../src/url.zig").URL;
const Headers = @import("root").bun.HTTP.Headers;
const Headers = @import("root").bun.http.Headers;
const Method = @import("../src/http/method.zig").Method;
const ColonListType = @import("../src/cli/colon_list_type.zig").ColonListType;
const HeadersTuple = ColonListType(string, noop_resolver);
const path_handler = @import("../src/resolver/resolve_path.zig");
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const HTTP = @import("root").bun.HTTP;
const NetworkThread = @import("root").bun.http.NetworkThread;
const HTTP = @import("root").bun.http;
fn noop_resolver(in: string) !string {
return in;
}
10 changes: 10 additions & 0 deletions packages/bun-usockets/src/eventing/epoll_kqueue.c
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ void Bun__internal_dispatch_ready_poll(void* loop, void* poll);
/* Cannot include this one on Windows */
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#endif

void us_loop_run_bun_tick(struct us_loop_t *loop, int64_t timeoutMs, void*);
@@ -602,4 +603,13 @@ void us_internal_async_wakeup(struct us_internal_async *a) {
}
#endif

int us_socket_get_error(int ssl, struct us_socket_t *s) {
int error = 0;
socklen_t len = sizeof(error);
if (getsockopt(us_poll_fd((struct us_poll_t *) s), SOL_SOCKET, SO_ERROR, (char *) &error, &len) == -1) {
return errno;
}
return error;
}

#endif
1 change: 1 addition & 0 deletions packages/bun-usockets/src/libusockets.h
Original file line number Diff line number Diff line change
@@ -397,6 +397,7 @@ int us_socket_raw_write(int ssl, struct us_socket_t *s, const char *data, int le
struct us_socket_t* us_socket_open(int ssl, struct us_socket_t * s, int is_client, char* ip, int ip_length);
int us_raw_root_certs(struct us_cert_string_t**out);
unsigned int us_get_remote_address_info(char *buf, struct us_socket_t *s, const char **dest, int *port, int *is_ipv6);
int us_socket_get_error(int ssl, struct us_socket_t *s);

#ifdef __cplusplus
}
4 changes: 2 additions & 2 deletions src/analytics/analytics_thread.zig
Original file line number Diff line number Diff line change
@@ -12,13 +12,13 @@ const C = bun.C;

const sync = @import("../sync.zig");
const std = @import("std");
const HTTP = @import("root").bun.HTTP;
const HTTP = @import("root").bun.http;
const NetworkThread = HTTP.NetworkThread;
const URL = @import("../url.zig").URL;
const Fs = @import("../fs.zig");
const Analytics = @import("./analytics_schema.zig").analytics;
const Writer = @import("./analytics_schema.zig").Writer;
const Headers = @import("root").bun.HTTP.Headers;
const Headers = @import("root").bun.http.Headers;
const Futex = @import("../futex.zig");
const Semver = @import("../install/semver.zig");

1 change: 0 additions & 1 deletion src/bun.js/api/JSBundler.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const std = @import("std");
const Api = @import("../../api/schema.zig").Api;
const http = @import("../../bun_dev_http_server.zig");
const JavaScript = @import("../javascript.zig");
const QueryStringMap = @import("../../url.zig").QueryStringMap;
const CombinedScanner = @import("../../url.zig").CombinedScanner;
1 change: 0 additions & 1 deletion src/bun.js/api/JSTranspiler.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const std = @import("std");
const Api = @import("../../api/schema.zig").Api;
const http = @import("../../bun_dev_http_server.zig");
const JavaScript = @import("../javascript.zig");
const QueryStringMap = @import("../../url.zig").QueryStringMap;
const CombinedScanner = @import("../../url.zig").CombinedScanner;
3 changes: 1 addition & 2 deletions src/bun.js/api/bun.zig
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ const Bun = @This();
const default_allocator = @import("root").bun.default_allocator;
const bun = @import("root").bun;
const Environment = bun.Environment;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const Global = bun.Global;
const strings = bun.strings;
const string = bun.string;
@@ -183,7 +183,6 @@ const ServerEntryPoint = bun.bundler.ServerEntryPoint;
const js_printer = bun.js_printer;
const js_parser = bun.js_parser;
const js_ast = bun.JSAst;
const http = @import("../../bun_dev_http_server.zig");
const NodeFallbackModules = @import("../../node_fallbacks.zig");
const ImportKind = ast.ImportKind;
const Analytics = @import("../../analytics/analytics_thread.zig");
2 changes: 1 addition & 1 deletion src/bun.js/api/bun/dns_resolver.zig
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ const Bun = @This();
const default_allocator = @import("root").bun.default_allocator;
const bun = @import("root").bun;
const Environment = bun.Environment;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const Global = bun.Global;
const strings = bun.strings;
const string = bun.string;
2 changes: 1 addition & 1 deletion src/bun.js/api/bun/socket.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const default_allocator = @import("root").bun.default_allocator;
const bun = @import("root").bun;
const Environment = bun.Environment;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const Global = bun.Global;
const strings = bun.strings;
const string = bun.string;
2 changes: 1 addition & 1 deletion src/bun.js/api/bun/subprocess.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const default_allocator = @import("root").bun.default_allocator;
const bun = @import("root").bun;
const Environment = bun.Environment;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const Global = bun.Global;
const strings = bun.strings;
const string = bun.string;
3 changes: 1 addition & 2 deletions src/bun.js/api/ffi.zig
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ const root = @import("root");
const default_allocator = bun.default_allocator;
const bun = @import("root").bun;
const Environment = bun.Environment;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const Global = bun.Global;
const strings = bun.strings;
const string = bun.string;
@@ -25,7 +25,6 @@ const ServerEntryPoint = bun.bundler.ServerEntryPoint;
const js_printer = bun.js_printer;
const js_parser = bun.js_parser;
const js_ast = bun.JSAst;
const http = @import("../../bun_dev_http_server.zig");
const NodeFallbackModules = @import("../../node_fallbacks.zig");
const ImportKind = ast.ImportKind;
const Analytics = @import("../../analytics/analytics_thread.zig");
1 change: 0 additions & 1 deletion src/bun.js/api/filesystem_router.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const std = @import("std");
const Api = @import("../../api/schema.zig").Api;
const http = @import("../../bun_dev_http_server.zig");
const JavaScript = @import("../javascript.zig");
const QueryStringMap = @import("../../url.zig").QueryStringMap;
const CombinedScanner = @import("../../url.zig").CombinedScanner;
5 changes: 2 additions & 3 deletions src/bun.js/api/server.zig
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ const Bun = @This();
const default_allocator = @import("root").bun.default_allocator;
const bun = @import("root").bun;
const Environment = bun.Environment;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const Global = bun.Global;
const strings = bun.strings;
const string = bun.string;
@@ -25,7 +25,6 @@ const ServerEntryPoint = bun.bundler.ServerEntryPoint;
const js_printer = bun.js_printer;
const js_parser = bun.js_parser;
const js_ast = bun.JSAst;
const http = @import("../../bun_dev_http_server.zig");
const NodeFallbackModules = @import("../../node_fallbacks.zig");
const ImportKind = ast.ImportKind;
const Analytics = @import("../../analytics/analytics_thread.zig");
@@ -41,7 +40,7 @@ const Request = WebCore.Request;
const Response = WebCore.Response;
const Headers = WebCore.Headers;
const Fetch = WebCore.Fetch;
const HTTP = @import("root").bun.HTTP;
const HTTP = @import("root").bun.http;
const FetchEvent = WebCore.FetchEvent;
const js = @import("root").bun.JSC.C;
const JSC = @import("root").bun.JSC;
1 change: 0 additions & 1 deletion src/bun.js/config.zig
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ const Api = @import("../api/schema.zig").Api;
const options = @import("../options.zig");
const Bundler = bun.bundler.ServeBundler;
const js_printer = bun.js_printer;
const http = @import("../bun_dev_http_server.zig");

pub const DefaultBunDefines = struct {
pub const Keys = struct {
2 changes: 1 addition & 1 deletion src/bun.js/event_loop.zig
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ const JSValue = JSC.JSValue;
const js = JSC.C;
pub const WorkPool = @import("../work_pool.zig").WorkPool;
pub const WorkPoolTask = @import("../work_pool.zig").Task;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const uws = @import("root").bun.uws;
const Async = bun.Async;

5 changes: 2 additions & 3 deletions src/bun.js/javascript.zig
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ const StoredFileDescriptorType = bun.StoredFileDescriptorType;
const ErrorableString = bun.JSC.ErrorableString;
const Arena = @import("../mimalloc_arena.zig").Arena;
const C = bun.C;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const IO = @import("root").bun.AsyncIO;
const Allocator = std.mem.Allocator;
const IdentityContext = @import("../identity_context.zig").IdentityContext;
@@ -32,7 +32,6 @@ const ServerEntryPoint = bun.bundler.ServerEntryPoint;
const js_printer = bun.js_printer;
const js_parser = bun.js_parser;
const js_ast = bun.JSAst;
const http = @import("../bun_dev_http_server.zig");
const NodeFallbackModules = @import("../node_fallbacks.zig");
const ImportKind = ast.ImportKind;
const Analytics = @import("../analytics/analytics_thread.zig");
@@ -628,7 +627,7 @@ pub const VirtualMachine = struct {
return VMHolder.vm.?;
}

pub fn mimeType(this: *VirtualMachine, str: []const u8) ?bun.HTTP.MimeType {
pub fn mimeType(this: *VirtualMachine, str: []const u8) ?bun.http.MimeType {
return this.rareData().mimeTypeFromString(this.allocator, str);
}

5 changes: 2 additions & 3 deletions src/bun.js/module_loader.zig
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ const default_allocator = bun.default_allocator;
const StoredFileDescriptorType = bun.StoredFileDescriptorType;
const Arena = @import("../mimalloc_arena.zig").Arena;
const C = bun.C;
const NetworkThread = @import("root").bun.HTTP.NetworkThread;
const NetworkThread = @import("root").bun.http.NetworkThread;
const IO = @import("root").bun.AsyncIO;
const Allocator = std.mem.Allocator;
const IdentityContext = @import("../identity_context.zig").IdentityContext;
@@ -31,7 +31,6 @@ const ServerEntryPoint = bun.bundler.ServerEntryPoint;
const js_printer = bun.js_printer;
const js_parser = bun.js_parser;
const js_ast = bun.JSAst;
const http = @import("../bun_dev_http_server.zig");
const NodeFallbackModules = @import("../node_fallbacks.zig");
const ImportKind = ast.ImportKind;
const Analytics = @import("../analytics/analytics_thread.zig");
@@ -1378,7 +1377,7 @@ pub const ModuleLoader = struct {
.js, .jsx, .ts, .tsx, .json, .toml, .text => {
jsc_vm.transpiled_count += 1;
jsc_vm.bundler.resetStore();
const hash = http.Watcher.getHash(path.text);
const hash = JSC.Watcher.getHash(path.text);
const is_main = jsc_vm.main.len == path.text.len and
jsc_vm.main_hash == hash and
strings.eqlLong(jsc_vm.main, path.text, false);
6 changes: 3 additions & 3 deletions src/bun.js/rare_data.zig
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ global_dns_data: ?*JSC.DNS.GlobalData = null,

spawn_ipc_usockets_context: ?*uws.SocketContext = null,

mime_types: ?bun.HTTP.MimeType.Map = null,
mime_types: ?bun.http.MimeType.Map = null,

node_fs_stat_watcher_scheduler: ?*StatWatcherScheduler = null,

@@ -74,9 +74,9 @@ pub fn hotMap(this: *RareData, allocator: std.mem.Allocator) *HotMap {
return &this.hot_map.?;
}

pub fn mimeTypeFromString(this: *RareData, allocator: std.mem.Allocator, str: []const u8) ?bun.HTTP.MimeType {
pub fn mimeTypeFromString(this: *RareData, allocator: std.mem.Allocator, str: []const u8) ?bun.http.MimeType {
if (this.mime_types == null) {
this.mime_types = bun.HTTP.MimeType.createHashTable(
this.mime_types = bun.http.MimeType.createHashTable(
allocator,
) catch @panic("Out of memory");
}
4 changes: 2 additions & 2 deletions src/bun.js/test/jest.zig
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@ const bun = @import("root").bun;
const js_parser = bun.js_parser;
const js_ast = bun.JSAst;
const Api = @import("../../api/schema.zig").Api;
const MimeType = @import("../../bun_dev_http_server.zig").MimeType;
const MimeType = bun.http.MimeType;
const ZigURL = @import("../../url.zig").URL;
const HTTPClient = @import("root").bun.HTTP;
const HTTPClient = @import("root").bun.http;
const NetworkThread = HTTPClient.NetworkThread;
const Environment = bun.Environment;

Loading
Loading