Comments (12)
FYI
https://github.com/czanyou/wotjs-core/blob/main/src/tls.c
https://github.com/czanyou/wotjs-core/blob/main/src/crypto.c
from txiki.js.
Hey there!
Sure thing, I do want us to have mbedtls integrated, and migrate all the hashing stuff to it.
That should not be a requirement for https in curl today though, since we link with the system one on most platforms, which in turn uses WinSSL, whatever calls it's thing or OpenSSL. Not ideal, I know, but one step at a time :-)
from txiki.js.
I'm wondering if we can import serveTls
from Deno's https://deno.land/[email protected]/http/server.ts?
When I run
./deno repl --allow-net --allow-read --allow-write
Deno 1.29.2
exit using ctrl+d, ctrl+c, or close()
> import { serveTls } from "https://deno.land/[email protected]/http/server.ts";
the C source code is downloaded to /home/user/.cache/deno/deps/https/deno.land/
.
from txiki.js.
Deno uses Rust and OpenSSL and I'd like to keep txikiJS simple, so I think mbedtls is a better fit for the project.
from txiki.js.
Oh, nice! Might be able to reuse some of that!
from txiki.js.
I tried building wotjs-core. Error thrown at
wotjs-core/src/misc.c:27:10: fatal error: version.h: No such file or directory
27 | #include "version.h"
| ^~~~~~~~~~~
Can't the HTTP server parts be extracted and used within QuickJS?
from txiki.js.
They can likely be migrated to txiki.js, since that's a fork, but a 2 year old one, and a lot has changed since.
from txiki.js.
I've been testing server implementations, C and other languages. I think busybox's httpd
https://github.com/mirror/busybox/blob/master/networking/httpd.c is simple enough to port to QuickJS.
For my use case I just need to create a server to load an HTML page so I can hand off handling the request and response to a local ServiceWorker
.
Other options include coralmicro HTTP server https://github.com/google-coral/coralmicro/blob/main/libs/base/http_server.cc, and Chromium's HTTP servr https://github.com/chromium/chromium/blob/main/net/server/http_server.cc.
from txiki.js.
Unfortunately none of those options are a good fit for txiki.js.
The BusyBox implementation is GPL, so incompatible with the current license.
The other 2 are written in C++ and I don't want to start adding c++ code here.
I think https://github.com/rsenn/qjs-net is a better option, but I need to integrate the event loop with libuv instead of using the default in libwebsockets, and last I checked it wasn't very well documented.
from txiki.js.
@saghul I couldn't get https://github.com/rsenn/qjs-net to compile the last time I tried. There is also https://github.com/QuickJS-Web-project/quickwebserver, which I also had issues compiling after upstream updates.
from txiki.js.
qjs-net is failing to build on Debian/Ubuntu Linux due to this
Compile module '/home/user/qjs-net/js/rpc.js' ...
Compiling module js/rpc.js
-- Compile QuickJS module 'rpc.c' from 'js/rpc.js'
-- Configuring incomplete, errors occurred!
See also "/home/user/qjs-net/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/qjs-net/build/CMakeFiles/CMakeError.log".
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=strlcpy -rdynamic CMakeFiles/cmTC_49f1a.dir/CheckFunctionExists.c.o -o cmTC_49f1a
/usr/bin/ld: CMakeFiles/cmTC_49f1a.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x14): undefined reference to `strlcpy'
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_49f1a.dir/build.make:99: cmTC_49f1a] Error 1
gmake[1]: Leaving directory '/home/user/qjs-net/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_49f1a/fast] Error 2
I'm not sure what to modify or pass to cmake
to link to strlcpy
(https://stackoverflow.com/questions/72492507/how-to-link-strlcpy-in-makefile-in-c-undefined-reference-to-strlcpy).
from txiki.js.
I'd suggest you open an issue on their repo. IIRC strlcpy comes from BSD.
from txiki.js.
Related Issues (20)
- Windows build - info/discussion HOT 7
- Windows: Date() ignores timezome HOT 2
- Add top level await support to REPL HOT 1
- Consolidate EOF marker
- Implement history support in the REPL
- Implement localStorage and sessionStorage HOT 1
- Build problems on OpenBSD HOT 5
- Add typescript declaration file ? HOT 2
- fetch() from browser net::ERR_INVALID_HTTP_RESPONSE when testing tjs.listen() HOT 5
- utils.js is not found in build HOT 2
- v23.1.0 has unpredictable segfaults when running invalid JS files HOT 3
- Can not build in MAC HOT 4
- Support Uint32Array, other TypedArray's and ArrayBuffer parameter for stdin.read() (StdioInputStream)) HOT 8
- Add timeout for http imports
- Build problems on macOS 11.2.3 HOT 5
- Could this be used on an e.g. Pico Pi? HOT 2
- support indexedDB implement HOT 7
- [Question] Making JS Files a Built-in module HOT 6
- FFI does not support complex structures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from txiki.js.