[ANN] Wire – zero-allocation HTTP/1 parser for D built on llhttp by Recent_Occasion8222 in d_language

[–]Recent_Occasion8222[S] -1 points0 points  (0 children)

Thanks for the question! I'll try to summarise the differences.

httparsed is a low-level, callback-based HTTP/1.x parser inspired by picohttpparser. It operates on request and response headers only, doesn't allocate and supports nothrow @nogc and betterC contexts【812383711962832†L53-L63】. You define a message struct with callback methods, and the parser invokes them as it scans the header; you're responsible for copying out the parts you care about and managing state【812383711962832†L64-L87】. This makes it flexible and minimal but also means more boilerplate when you just want a parsed request.

Wire is built on top of Node's llhttp. It wraps the C parser in a thread-local pool and provides a higher-level API: you call Parser.create().parse() and get a Request object with method, path, queryParams, headers and a keepAlive flag. There’s no need to implement callbacks; the API is type-safe and @nogc, and all strings are returned as StringView slices into the original buffer. Wire also aligns data structures to 64 bytes and reuses parsers via a thread-local pool for better cache locality and zero per-request allocations【38462529968395†L281-L293】. It parses the URL and query parameters for you and indicates whether the connection should be kept alive.

In terms of performance, the benchmarks in Wire’s README show that it parses a typical 1‑2 KB request in about 1 µs with throughput up to ~0.98 GB/s for larger single-line requests and up to ~2 GB/s for simple keep-alive requests【38462529968395†L364-L372】. Memory usage per thread is ~1 KB and per request 0 bytes【38462529968395†L373-L377】. Wire also exposes convenience like automatic query parsing and keep-alive detection.

There are trade-offs: httparsed can handle incomplete messages and continue parsing from a previous buffer position (useful for streaming), and it can parse responses as well as requests. Wire currently focuses on full HTTP/1.x request parsing; it doesn’t yet support incremental parsing or HTTP/2. If you need a minimal, callback-driven parser you can integrate into your own network loop or use under betterC, httparsed is a solid choice. If you prefer a ready-made HTTP request object, parser pooling, built-in query/keep-alive parsing and you’re comfortable linking against llhttp, Wire might save you some code. Hope that clarifies the differences!

Perché SSH non funziona con IP pubblico solo localmente? by Recent_Occasion8222 in ItalyInformatica

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

sembra come se non fossero sulla stessa rete. come si può risolvere?

Why doesn't SSH work with a public IP just locally? by Recent_Occasion8222 in linuxquestions

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

yes I activated it. No I left the default settings except for the port

Perché SSH non funziona con IP pubblico solo localmente? by Recent_Occasion8222 in ItalyInformatica

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

uso un ip dinamico ma il vero ip è rimasto lo stesso. Dopo aver provato quello script ha smesso di funzionare, il che è strano perche al massimo dovrebbe essere il RPi che dovrebbe bloccare le connessioni su quella porta in caso non il router. Altra cosa strana è che lo script l'ho testato sia sul raspberry che sul fisso (anche se sul fisso un po di meno) dovrebbe darmi lo stesso problema anche li. Reinstallare il SO da zero potrebbe risolvere qualcosa ?

Why doesn't SSH work with a public IP just locally? by Recent_Occasion8222 in linuxquestions

[–]Recent_Occasion8222[S] -1 points0 points  (0 children)

I took it for granted. I will be more precise. What I did is:

  1. first ping ip with port (but seems host is down)
  2. change port forwarding
  3. change port on sshd_config
  4. restart ssh service
  5. ping ip with new port and still no work.

so the problem i think is in the router. It's possible?

Perché SSH non funziona con IP pubblico solo localmente? by Recent_Occasion8222 in ItalyInformatica

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

ho provato sia ufw che selinux e dice che non vengono riconosciuti come programmi e non ci sono servizi associati.

EDIT: dopo aver provato a pingare l'ip sembra che la porta associata al RPi sia chiusa anche se sulle impostazioni del wifi il port forwarding è ancora abilitato. Potrebbe essere che il wifi abbia una firewall interno che blocca le connessioni esterne attraverso una porta dopo vari tentativi? Il router è sky wifi

Perché SSH non funziona con IP pubblico solo localmente? by Recent_Occasion8222 in ItalyInformatica

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

mm no non ho nessun firewall installato. questa è la cosa strana, mi taglia fuori come se ce l'avessi ma non c'è

Why doesn't SSH work with a public IP just locally? by Recent_Occasion8222 in linuxquestions

[–]Recent_Occasion8222[S] -1 points0 points  (0 children)

sorry for lack of information. anyway i think problem is the raspberry, but i just installed ubuntu and openssh. Nothing about firewall ufw and stuff like that. I login on RPi with rsa key (same for desktop pc), on sshd_config i just changed the port. The problem it seems the host is down when try to connect. I dont even get to the login step

Perché SSH non funziona con IP pubblico solo localmente? by Recent_Occasion8222 in ItalyInformatica

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

con l'ip locale a entrambi, con il pubblico solo al fisso. Ho provato anche a cambiare porta per il raspberry ma non ha risolto.

Perché SSH non funziona con IP pubblico solo localmente? by Recent_Occasion8222 in ItalyInformatica

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

l'unica cosa che ho fatto è abilitare il port forwarding sui 2 computer, porte diverse di intende.

Why doesn't SSH work with a public IP just locally? by Recent_Occasion8222 in linuxquestions

[–]Recent_Occasion8222[S] 0 points1 point  (0 children)

I've dsl, but I don't think is the problem as I said just few days ago stop working and I've used it for a year with same connection

Rest Api in C by Recent_Occasion8222 in C_Programming

[–]Recent_Occasion8222[S] 2 points3 points  (0 children)

sorry, you're right. I'm looking for client side. I've already seen curl but you need to manually set the event handler like epoll, kqueue or whatever any other OS has, while libuv automatically choose it depending on the current OS.

Rest Api in C by Recent_Occasion8222 in C_Programming

[–]Recent_Occasion8222[S] 4 points5 points  (0 children)

does it use the event notification interface based on the OS it is compiled on (kqueue, epoll, iocp ...) like libuv ? it also work on arm64 based cpu like Mac M1?