From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <9front-bounces@9front.inri.net> X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from 9front.inri.net (9front.inri.net [168.235.81.73]) by inbox.vuxu.org (Postfix) with ESMTP id 0B1B22D76D for ; Mon, 9 Sep 2024 07:58:39 +0200 (CEST) Received: from mail.firstpost.pub ([46.23.93.143]) by 9front; Mon Sep 9 01:57:31 -0400 2024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=firstpost.pub; s=2024; t=1725861448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=zZJESH7qXvm7kr/u1yEC47+fV/kpEJagd6PoevjUrVE=; b=TepzQlEqYq8VhBbwS3h5uYgahE83IswPua/08fxRDgMsxPhjY2GN07H7sy8+Lk+4YkjP0c 6hTqKQIReVHIGdNxb57PMygpu7vrmCP+osFLc8/zkmBQFDn2gkPyKMn7HUCVKsO1yiM1Zs Sxni8v/RzOSiV8CpbKQGhR0obctA+NM= Received: from smtpclient.apple (unn-149-88-19-242.datapacket.com [149.88.19.242]) by firstpost.openbsd.amsterdam (OpenSMTPD) with ESMTPSA id 2745cbfa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <9front@9front.org>; Mon, 9 Sep 2024 07:57:27 +0200 (CEST) From: "sahu@firstpost.pub" Content-Type: multipart/alternative; boundary="Apple-Mail=_B31AAE8F-1D9F-497D-A9B9-00C72AA4EF53" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Message-Id: <8DE37884-0209-400A-B603-00557873998C@firstpost.pub> Date: Mon, 9 Sep 2024 07:57:16 +0200 To: 9front@9front.org X-Mailer: Apple Mail (2.3776.700.51) List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: reduce/map engine-aware markup Subject: [9front] serving html sites with announce, listen and accept (dial(2)) Reply-To: 9front@9front.org Precedence: bulk --Apple-Mail=_B31AAE8F-1D9F-497D-A9B9-00C72AA4EF53 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 hello everyone,=20 I=E2=80=99ve made some small changes to the bekremvax-example in dial(2) = in order to get a simple html response: #include #include int bekremvax(void) { int dfd, acfd, lcfd; char adir[40], ldir[40]; int n; char *buf =3D =E2=80=9EHTTP/1.1 200 OK\nContent-Type: text/html; = charset=3DUTF-8\nContent-Length: 8\n\nhello, = world!"; acfd =3D announce("tcp!*!7", adir); if(acfd < 0) return -1; for(;;){ /* listen for a call */ lcfd =3D listen(adir, ldir); if(lcfd < 0) return -1; /* fork a process to echo */ switch(fork()){ case -1: perror("forking"); close(lcfd); break; case 0: /* accept the call and open the data file */ dfd =3D accept(lcfd, ldir); if(dfd < 0) return -1; print(=E2=80=9Eincoming request=E2=80=9C); write(dfd, buf, sizeof(buf)); exits(nil); default: close(lcfd); break; } } } void main() { bekremvax(); exits(nil); } in my browser I=E2=80=99m getting an empty page and with netcat the = following output: nc -v 10.211.55.3 7 Connection to 10.211.55.3 port 7 [tcp/discard] succeeded! HTTP/1.1% =20 there is also no print statement (=E2=80=9Eincoming request=E2=80=9C) = when I=E2=80=99m trying to reach the service via browser. am I doing = something wrong? 9front is running in a vm at the moment, but as far as = I can tell there weren=E2=80=99t any issues regarding the network. thank you very much in advance! best regards,=20 Sascha= --Apple-Mail=_B31AAE8F-1D9F-497D-A9B9-00C72AA4EF53 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 hello = everyone, 

I=E2=80=99ve made some small changes = to the bekremvax-example in dial(2) in order to get a simple html = response:

#include = <u.h>
#include = <libc.h>

int
bekremvax(void)
{
int dfd, acfd, = lcfd;
= char adir[40], ldir[40];
int n;
= char = *buf =3D =E2=80=9EHTTP/1.1 200 OK\nContent-Type: text/html; = charset=3DUTF-8\nContent-Length: 8\n\n<!DOCTYPE = html><html><body>hello, = world!</body></html>";
	acfd =3D =
announce("tcp!*!7", adir);
        if(acfd < 0)
        	=
return -1;
        for(;;){
        	=
/* listen for a call */
                lcfd =3D listen(adir, ldir);

                if(lcfd < 0)
                	=
return -1;
                /* fork a process to echo */
                switch(fork()){
                case -1:
                	=
perror("forking");
                        close(lcfd);
                        break;
                case 0:
                	=
/* accept the call and open the data file */
                        dfd =3D accept(lcfd, ldir);
                        if(dfd < 0)
                        	return -1;
			=
print(=E2=80=9Eincoming request=E2=80=9C);
                        write(dfd, buf, sizeof(buf));
                        exits(nil);
                default:
                	=
close(lcfd);
                        break;
                }
	=
}
}
void
main()
{
	=
bekremvax();
	=
exits(nil);
}

in my browser =
I=E2=80=99m getting an empty page and with netcat the following =
output:

nc -v 10.211.55.3 = 7

Connection to 10.211.55.3 port 7 [tcp/discard] = succeeded!

HTTP/1.1%      


there is also no print statement (=E2=80=9Eincoming = request=E2=80=9C) when I=E2=80=99m trying to reach the service via = browser. am I doing something wrong? 9front is running in a vm at the = moment, but as far as I can tell there weren=E2=80=99t any issues = regarding the network.


thank you very much in advance!


best regards, =

Sascha

= --Apple-Mail=_B31AAE8F-1D9F-497D-A9B9-00C72AA4EF53--