GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Embed Notice

HTML Code

Corresponding Notice

  1. Embed this notice
    pistolero :thispersondoesnotexist: (p@freespeechextremist.com)'s status on Friday, 10-Nov-2023 01:36:51 JSTpistolero :thispersondoesnotexist:pistolero :thispersondoesnotexist:
    in reply to
    • 
    • Machismo
    • PC-9801 Enjoyer
    • Pleroma-tan
    • ≠ Brett Stevens ≠
    @Zerglingman @Pawlicker @amerika @kirby @mint

    > Write a webserver using (mostly) just sed and awk? 👀

    http://werc.cat-v.org/docs/web-server-setup/rc-httpd

    Or if you want it to just be awk:

    listen1 'tcp!*!9090' awk 'BEGIN{RS=ORS="\r\n"} NR==1{method = $1; path = $2} NF==0{if(method != "GET"){print "HTTP/1.0 501 Not Implemented";print "";exit} print "HTTP/1.0 200 OK"; print "Content-Type: text/plain"; print "Server: HARE/0.1 (HTTP Awk Retard Echo-er)"; print ""; print path;exit}'

    (If you don't have listen1, you can use netcat or inetd or whatever.)

    Run that, and you can point a browser at http://localhost:9090/whatever and it will echo it back to you. It should be pretty easy to tell how to use system() or getline in awk to dispatch to different programs or pieces of code based on what path is requested.

    You are not going to have a good time building that kind of thing in awk, overall. You can have a screwdriver and a hammer and a saw, or you can have some kind of unholy multitool that is no good for any given task but can sorta do all of them.
    In conversationFriday, 10-Nov-2023 01:36:51 JST from freespeechextremist.compermalink

    Attachments

    1. No result found on File_thumbnail lookup.
      rc-httpd

  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.