Re: RFC: Attributes in Markdown text

2020-05-22 Thread Chris Angelico
On Fri, May 22, 2020 at 9:28 AM Martin Nilsson (Coppermist) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > > > >How does that sound? > > > > Sounds good to me. The expectations should be to move it from Tools to > Parser (or something) also once the changes are done. Cool.

Re: RFC: Attributes in Markdown text

2020-05-21 Thread Chris Angelico
On Fri, May 22, 2020 at 4:00 AM Martin Nilsson (Coppermist) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > While I'm indifferent to markdown itself, my problem with the markdown > implementation in Pike is that it was implemented as an application > with no programmatic way

Re: Information leakage in httpserver

2020-10-08 Thread Chris Angelico
On Fri, Oct 9, 2020 at 8:17 AM Tobias S. Josefowitz wrote: > > As you may have noticed I took the liberty of applying the proposed > fix recently. Thank you! ChrisA

CONCURRENT_DEBUG default state - active or not?

2020-10-09 Thread Chris Angelico
lib/modules/Concurrent.pmod starts out by defining CONCURRENT_DEBUG to the value 0. This counts as defined, for the purposes of storing backtraces and such. Is that meant to be active by default? At the moment, there are a number of werror lines that are quite noisy; not sure whether they're part

Information leakage in httpserver

2020-08-28 Thread Chris Angelico
string file = "."+combine_path("/",request->not_query); file = Protocols.HTTP.uri_decode(file); Stdio.Stat s = file_stat( file ); If the not_query contains "..%2F", combine_path sees that as a perfectly normal directory, and then it gets URI decoded, and Pike will happily read files

Re: Any interest in an open source HTTP daemon in Pike? (Spike)

2020-05-24 Thread Chris Angelico
On Mon, May 25, 2020 at 1:50 AM Stephen R. van den Berg wrote: > > I've written (for internal use) an HTTP daemon in Pike, using roughly > the following featureset: > - Mainly meant to run (custom) pike modules processing requests. > - Also serves static content (through a simple config file). >

Pike, WebSockets, and SSL

2020-08-07 Thread Chris Angelico
Closing an SSL websocket bombs out. SSL sockets can only be closed in both directions at once, but websockets send a FRAME_CLOSE and then close in the write direction only. Is it necessary to close in the write direction only, or can the websocket simply close both ends at once? The exception

Re: Pike, WebSockets, and SSL

2020-08-12 Thread Chris Angelico
On Wed, Aug 12, 2020 at 5:59 PM Arne Goedeke wrote: > > On 2020-08-07 13:49, Chris Angelico wrote: > > Closing an SSL websocket bombs out. SSL sockets can only be closed in > > both directions at once, but websockets send a FRAME_CLOSE and then > > close in

Re: Pike, WebSockets, and SSL

2020-08-12 Thread Chris Angelico
On Wed, Aug 12, 2020 at 6:40 PM Arne Goedeke wrote: > Sounds like it, yes. Let's fix this on master first and backport it > 'soon'. This way people get a chance to complain. By "soon" do you mean "commit to the 8.0 branch now and have it in the next release"? Because that's what I would normally

Type checking of exponentiation

2020-08-09 Thread Chris Angelico
In order to implement an expression evaluator, I have a two-pass compilation that first uses a magic resolver to find external name references, and then compiles the actual code to get a function back. This cut-down version of it showcases a strange phenomenon: //Magic resolver. Any symbol at all

Re: Type checking of exponentiation

2020-08-09 Thread Chris Angelico
On Mon, Aug 10, 2020 at 1:02 AM Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > 4^-2 is not an integer. It's 0.0625 (or 1/16, if expressed as a > fraction, which seems to be what 8.1 has chosen here). True. In the original, though,

Recursive typedefs and add_constant

2020-06-28 Thread Chris Angelico
I've run into a weirdness involving a recursive typedef and adding a constant. Example: typedef string|int|array(foo) foo; If compiled on its own, this creates a recursive typedef that can handle arbitrarily-nested arrays of strings and ints. Contrast: typedef multiset(string|int) strint;

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 6:57 AM Tobias S. Josefowitz wrote: > > On Fri, Jun 11, 2021 at 1:31 PM Chris Angelico wrote: > > > > Branch: rosuav/http-multi-connect > > > > New APIs in Protocols.DNS.async_client - host_to_ips in both callback > > and Promise v

Bleeding-edge Pike broadly operable - code review appreciated

2021-06-09 Thread Chris Angelico
I just pushed a few changes to master that get the build working (on 64-bit Debian Linux, no other platforms tested). They're mostly small changes and I hope they won't break anything. This actually gets "make doc" happy again after a good while, so it would be really awesome if I haven't just

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-06-09 Thread Chris Angelico
On Thu, Jun 10, 2021 at 1:41 AM Tobias S. Josefowitz wrote: > > On Wed, Jun 9, 2021 at 3:48 PM Chris Angelico wrote: > > > > There's another, more significant, change that happened in the past > > few months. It's not a simple fix. The default behaviour of > >

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-06-16 Thread Chris Angelico
On Thu, Jun 17, 2021 at 7:49 AM Tobias S. Josefowitz wrote: > > On Wed, Jun 16, 2021 at 11:08 PM Chris Angelico wrote: > > > > Should host_to_ip be put completely back how it was (IPv4 only), or > > should it return IPv4 if available, IPv6 else? > > In my opinion

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-06-09 Thread Chris Angelico
On Thu, Jun 10, 2021 at 11:49 AM Martin Nilsson (Coppermist) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > > > >Okay. Here's a proposal: > > > >1) Have a Protocols.DNS.prefer_ipv6() that chooses whether IPv6 is > >preferred over IPv4 for simple lookups. Calling

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-06-11 Thread Chris Angelico
On Thu, Jun 10, 2021 at 6:49 AM Stephen R. van den Berg wrote: > > Chris Angelico wrote: > >> > few months. It's not a simple fix. The default behaviour of > >> > Protocols.DNS.async_host_to_ip, which is used by Protocols.HTTP, > >> > changed from

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-06-09 Thread Chris Angelico
On Thu, Jun 10, 2021 at 8:21 AM Tobias S. Josefowitz wrote: > > On Wed, Jun 9, 2021 at 10:49 PM Stephen R. van den Berg wrote: > > > > I'd say, the way forward should be changing the connecting functions to > > iterate through the IP addresses and find the first that actually connects. > > > >

Type checking segfault in Pike 8.1

2021-06-27 Thread Chris Angelico
void boom(mapping info) {m_delete(info[0]);} It ought to give a compilation error (not enough args to m_delete) but it segfaults the interpreter on compilation. Correct behaviour is restored if the argument is explicitly cast to mapping: void boom(mapping info) {m_delete((mapping)info[0]);}

Re: Replacing a single function/method in an existing live class?

2021-05-02 Thread Chris Angelico
On Mon, May 3, 2021 at 3:35 AM Stephen R. van den Berg wrote: > > Lance Dillon wrote: > >The closest I could see is to not really have the functions directly, I > >guess, but an mapping of functions, and overload `() so that it pulls the > >function from the mapping, then you could easily

Re: Replacing a single function/method in an existing live class?

2021-05-02 Thread Chris Angelico
On Mon, May 3, 2021 at 2:04 AM Stephen R. van den Berg wrote: > > Say I have this: > > class A { > int k; > void B() { > write("foo %d\n", k); > } > void C() { > k = 3; > write("bar\n"); > } > } > > int main() { > A a = A(); > a->C(); // Displays: bar > a->B();

Re: Replacing a single function/method in an existing live class?

2021-05-02 Thread Chris Angelico
On Mon, May 3, 2021 at 4:25 AM Stephen R. van den Berg wrote: > > Chris Angelico wrote: > >My usual practice is to completely recompile the class, and have a > >single mapping for all "carry-over" state, something like this: > > >And then to replac

Pike 8.1 segfault compiling unknown name

2021-04-02 Thread Chris Angelico
int main() { //compile("void x(int id) {boom = ({id});}"); compile("void x(int id) {boom += ({id});}"); } The first (commented-out) line will raise a standard exception regarding the unknown name "boom". The second will segfault the interpreter. The crash appears to happen deep inside

Re: Compression.Lz4

2021-04-01 Thread Chris Angelico
On Thu, Apr 1, 2021 at 6:18 PM Stephen R. van den Berg wrote: > > Martin Nilsson (Coppermist) @ Pike (-) developers forum wrote: > >>Compression.Bz2 > >>Compression.Gz > >>Compression.Lz4 > > >If we change location I want them to have the same API so you can > >switch between them easily. Old

Re: Did someone already try to ask someone at Lysator?

2021-03-15 Thread Chris Angelico
On Mon, Mar 15, 2021 at 10:22 PM Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > Hi Stephen! > > > Did someone already try to ask someone at Lysator to push the power button? > > The power button wasn't the problem... > > The problem was due to the

Proposal: Built-ins for generators

2021-03-07 Thread Chris Angelico
A generator function will, when called, return a generator state function. (Are there better terms for these?) It'd be extremely helpful to have a couple of built-in functions to give some info about them. 1) generatorp continue int gen() {continue return 1; return 2;} generatorp(gen) ==> 1

Possible over-optimization with 'continue return'

2021-03-05 Thread Chris Angelico
Playing around with generators, and have come across a strange oddity. This code works fine: continue int gen(int x) { if (x == 1) continue return 1; if (x == 1) continue return 2; if (x == 1) continue return 3; return 4; } int main() { function foo = gen(1); while (1) { int i =

Re: Possible over-optimization with 'continue return'

2021-03-05 Thread Chris Angelico
On Sat, Mar 6, 2021 at 7:59 AM Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > > Playing around with generators, and have come across a strange oddity. > > This code works fine: > [...] > > But remove any of the 'if' guards, and the function

Re: Pike 8.1 type errors

2021-04-11 Thread Chris Angelico
On Sat, Apr 10, 2021 at 5:20 PM Stephen R. van den Berg wrote: > > The last time I had a bleeding edge "standard" pike that actually > worked for me was: > > commit 94a868dae24642de2e71e0a6079a27aabae32132 I've been doing the same, although my last-known-good is a bit older than yours. Keep

Re: Bleeding-edge Pike broadly operable - code review appreciated

2021-08-25 Thread Chris Angelico
On Thu, Jun 17, 2021 at 8:29 AM Chris Angelico wrote: > > On Thu, Jun 17, 2021 at 7:49 AM Tobias S. Josefowitz > wrote: > > > > On Wed, Jun 16, 2021 at 11:08 PM Chris Angelico wrote: > > > > > > Should host_to_ip be put completely back how it was (IPv

Segfault from Pike 8.1 - possible type check issue?

2021-09-06 Thread Chris Angelico
float thing_sum(array(string) things) { return `+(@(array(float))things) + 1.0; } Without the "+ 1.0" at the end (or some other arithmetic operation), it doesn't bomb out. GDB is pointing to src/pike_types.cmod:11185 which is just an assignment, but I suspect the issue is the add_ref above

What are the consequences of adding a subtype?

2021-10-19 Thread Chris Angelico
Currently functions have two subtypes: normal ones (0) and builtin functions (USHRT_MAX). What would be the implications of adding two more? I propose adding FUNCTION_GENERATOR and FUNCTION_GENSTATE to differentiate continue functions, and the state functions that they return; and also a

Confusing results in continue function - overaggressive optimization?

2021-10-19 Thread Chris Angelico
continue int fibonacci() { int a = 0, b = 1; while (1) { yield(a += b); yield(b += a); } } int main() { function fib = fibonacci(); while (1) { write("--> %d\n", fib()); sleep(0.125); } } In theory, this should yield a stream of Fibonacci

Re: What are the consequences of adding a subtype?

2021-10-20 Thread Chris Angelico
On Wed, Oct 20, 2021 at 8:44 PM Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > Not quite correct; normal ones are 0..USHRT_MAX-1 and builtin > functions are USHRT_MAX. The subtype is used to select the > function entry in the function table for the

Re: bufferdAmount or bufferedAmount?

2021-11-18 Thread Chris Angelico
On Fri, Nov 19, 2021 at 10:33 AM ceder (-) Per Cederqvist @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > This code in lib/modules/Protocols.pmod/WebSocket.pmod seems to be > missing an "e": > > //! @decl int bufferedAmount > //! Number of bytes in the send buffer. > >

Re: Syntax / Function callbacks

2023-09-11 Thread Chris Angelico
On Tue, 12 Sept 2023 at 01:25, wrote: > > It should do: > https://pike.lysator.liu.se/generated/manual/modref/ex/predef_3A_3A/_Stdio/_port/set_accept_callback.html > > It exists within the documentation…? also Stdio.Port mainsock = > Stdio.Port(, accept_callback) and if

Re: Syntax / Function callbacks

2023-09-11 Thread Chris Angelico
On Tue, 12 Sept 2023 at 01:14, wrote: > > int main() { … mainsock->set_accept_callback(accept_callback); ... } > > Attempt to call the NULL-value > Unknown program: 0(/main()->accept_callback) > main.pike:53: /main()->main() > Looks like it's not a syntax problem, but that there's no

Re: Pike 9.0 quirk with implicit lambda

2023-11-06 Thread Chris Angelico
On Tue, 31 Oct 2023 at 20:39, <"\"Henrik Grubbström (Lysator) @ Pike (-) developers forum\" <10...@lyskom.lysator.liu.se>"@lysator.liu.se> wrote: > > Hi Chris. > > > In Pike 8 (tested on 8.1.15), the implicit lambda correctly receives > > its __ARGS__, and will happily provide those as closure

Type annotating continue functions for asynchronous work

2023-11-06 Thread Chris Angelico
I've been making extensive use of continue functions (generators) using a pattern whereby they will *yield* an awaitable (a Concurrent.Future or a couple of other options), but will *return* a final result (could be any type, eg int, string, mapping, array, etc). This is working fairly nicely,

Pike 9.0 quirk with implicit lambda

2023-10-29 Thread Chris Angelico
void call(function cb) {cb(42);} int main() { werror("Pike version %O:\n", __VERSION__); call() { werror("Args: %O\n", __ARGS__); mixed value = 1234; werror("%O\n", lambda() {werror("%O\n", value);}); }; return 0; } In Pike 8 (tested on 8.1.15), the

Re: Protocols.HTTP.Query with open_socket address

2022-06-09 Thread Chris Angelico
On Thu, 9 Jun 2022 at 16:02, David Tàpia wrote: > > It would be appreciated if you could consider add this feature in > Protocols.HTTP.Query > > > //! You may specify an address to bind to if your machine has many IP numbers. > string address = 0; > ... > con = Stdio.File(); >

Re: rntcl

2023-07-31 Thread Chris Angelico
On Tue, 1 Aug 2023 at 02:32, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > The thing about rntcl is that it is a cross compiler. The output of > the compiler _is_ "foo.exe", but that binary can not be run on the > build system. So

Pure Pike annotations?

2024-02-15 Thread Chris Angelico
(Side note: This mailing list seems very dead lately. Is the LysKOM gateway down?) I'm trying to make good use of annotations, but all the existing ones are in cmod files, and I'm trying to work out how best to write them in Pike. My goal is to have an annotation that can be parameterized,

Re: Pure Pike annotations?

2024-02-15 Thread Chris Angelico
On Thu, 15 Feb 2024 at 23:39, Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > I'm trying to make good use of annotations, but all the existing ones > > are in cmod files, and I'm trying to work out how best to write them > > in Pike. My goal is to

Re: Pure Pike annotations?

2024-02-15 Thread Chris Angelico
On Fri, 16 Feb 2024 at 03:09, wrote: > > Hi Chris- > > You might also find some helpful information here: > > http://wiki.gotpike.org/PikeDevel/Annotations > > There are one or two missing features in annotations, one of which is (I > think) the lack of ability to add an annotation to a top level

Re: Client certificate support in Sql.pgsql?

2024-01-12 Thread Chris Angelico
On Sat, 9 Dec 2023 at 04:06, wrote: > I'm pretty sure that SSL.File should be able to handshake in callback > mode. Shuffler however, is a complication that can break the facade that > SSL.File is just another Stdio.File object... I've definitely used > shuffler with SSL.File objects in

Re: Client certificate support in Sql.pgsql?

2023-12-05 Thread Chris Angelico
On Wed, 6 Dec 2023 at 04:28, wrote: > > Hi Chris, > > the SSL module supports passing client certificates, and the Sql.pgsql > module uses SSL.File, however it doesn't directly provide any hooks for > configuring the client certs. I think it would be easy to add, basically > you just need a way

Re: Client certificate support in Sql.pgsql?

2023-12-05 Thread Chris Angelico
On Wed, 6 Dec 2023 at 05:10, Chris Angelico wrote: > Sound good? I'll try to put together an implementation, although I'm > not sure there's a viable way to add tests for it. > In working on the implementation, I'm running into some trouble with SSL connections in general. As of

Client certificate support in Sql.pgsql?

2023-12-03 Thread Chris Angelico
Is it possible to use client SSL certificates for authentication with the Sql.pgsql or (the deprecated) Sql.postgres driver? I've been setting up a multihomed Pike program and would ideally like to be able to have all nodes connect to the same database, using their SSL certificates as proof of

Re: Client certificate support in Sql.pgsql?

2023-12-07 Thread Chris Angelico
On Wed, 6 Dec 2023 at 08:32, Chris Angelico wrote: > > On Wed, 6 Dec 2023 at 05:10, Chris Angelico wrote: > > Sound good? I'll try to put together an implementation, although I'm > > not sure there's a viable way to add tests for it. > > > > In working on t

Re: Client certificate support in Sql.pgsql?

2023-12-08 Thread Chris Angelico
On Fri, 8 Dec 2023 at 19:39, Stephen R. van den Berg wrote: > > Chris Angelico wrote: > >In working on the implementation, I'm running into some trouble with > >SSL connections in general. As of Pike 8.1, the pgsql module uses > >Shuffler (this wasn't the case in Pik

Re: Client certificate support in Sql.pgsql?

2023-12-08 Thread Chris Angelico
On Fri, 8 Dec 2023 at 20:17, Stephen R. van den Berg wrote: > > Chris Angelico wrote: > >3. It's surprisingly hard to find tools that can help you debug client > >certificates. > > It's a mess. It has been a mess for a long time. > The few times I tried to use somethin

Re: Client certificate support in Sql.pgsql?

2023-12-08 Thread Chris Angelico
On Sat, 9 Dec 2023 at 04:06, wrote: > I'm not familiar with how the pgsql module is set up, so there > may be some magic going on that needs to be worked around. If you're > trying to attempt some sort of conditional TLS ala STARTTLS, you might > find that handshaking doesn't work until the

Re: Client certificate support in Sql.pgsql?

2023-12-08 Thread Chris Angelico
On Sat, 9 Dec 2023 at 03:57, wrote: > > > > > Hmm. Maybe I should polish the two scripts I was using, and then put > > them into the SSL module somewhere as examples. There are quite a few > > subtleties (like that you won't see client certs unless you set > > "ctx->auth_level =

Debian Pike packaging and GTK2

2024-02-04 Thread Chris Angelico
The latest releases of Debian don't include a pike8.0-gtk package any more. Apparently it's because it depends on old libraries: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=885673 But all of those are optional dependencies. I just tested a fresh Debian 12 installation and was able to build

Re: File descriptor usage in Protocols.HTTP.Server.SSLPort

2024-04-07 Thread Chris Angelico
On Fri, 5 Apr 2024 at 23:59, Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > Is there a better way to handle this than simply forcing garbage > > collection every request? > > The best way is to break the cycle before dropping the object on the >

File descriptor usage in Protocols.HTTP.Server.SSLPort

2024-04-05 Thread Chris Angelico
I've run into a strangeness with my TLS-based web server. It seems that, for every incoming request, three file descriptors are used (they all seem to be sockets), and they aren't immediately cleaned up. With keep-alive disabled, they CAN be disposed of, but it takes an explicit gc() call. With

Understand the behaviour of Stdio.Buffer()->match()

2024-04-24 Thread Chris Angelico
I'm a bit confused by this behaviour, and am unsure whether it needs to be better documented, or perhaps is a bug. int main() { object buf = Stdio.Buffer("#44"); write("Matches: %O %O\n", buf->sscanf("#%2[4]"), (string)buf); buf = Stdio.Buffer("#4"); write("Doesn't: %O %O\n",

Running an HTTP(S) server using an externally-provided file descriptor

2024-05-01 Thread Chris Angelico
See branch rosuav/pre-listening-ports for a first attempt at this. With Stdio.Port(), it's possible to receive an open socket as a file descriptor and start accepting connections on it. (Notably, this allows systemd to provide a socket as FD 3, allowing unprivileged programs to listen on

Re: Running an HTTP(S) server using an externally-provided file descriptor

2024-05-02 Thread Chris Angelico
On Thu, 2 May 2024 at 17:58, Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > Hi Chris. > > > See branch rosuav/pre-listening-ports for a first attempt at this. > > > > With Stdio.Port(), it's possible to receive an open socket as a file > >

Re: Running an HTTP(S) server using an externally-provided file descriptor

2024-05-02 Thread Chris Angelico
On Thu, 2 May 2024 at 19:15, Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > Hi again Chris. > > > On Thu, 2 May 2024 at 17:58, Henrik Grubbström (Lysator) @ Pike (-) > > developers forum <10...@lyskom.lysator.liu.se> wrote: > > > > > > Does

Re: Understand the behaviour of Stdio.Buffer()->match()

2024-05-08 Thread Chris Angelico
On Wed, 8 May 2024 at 17:04, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > The behaviour of match() when there is not exactly one thing matching > seems a bit weird in general: > > Pike v9.0 release 2 running Hilfe v3.5 (Incremental

Re: Understand the behaviour of Stdio.Buffer()->match()

2024-05-08 Thread Chris Angelico
On Wed, 8 May 2024 at 16:28, Henrik Grubbström (Lysator) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > Thanks for the report. > > Fixed in Pike master. match() now returns "" in this case. Ah! Thank you! ChrisA

Re: Understand the behaviour of Stdio.Buffer()->match()

2024-05-08 Thread Chris Angelico
On Wed, 8 May 2024 at 17:57, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum <10...@lyskom.lysator.liu.se> wrote: > > Yes, although I'm still not sure this follows the principle of least > astonishment: > > If no matches results in "", and the result is the sum of the

<    1   2   3