From 0b62beb4b78623ce75bfa24f1a9696cdcd150289 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 18 Jul 2024 20:47:10 +0330 Subject: [PATCH] rid me --- README.md | 6 +++++- main.go | 8 +++++++- test/test.go | 14 +++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3f8648e..c083954 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,8 @@ this video, is PISSING ME OFF, HE DID NOT MAKE ANYTHING HE JUST USED EXISTING SOFTWARE IN A HORRIBLE INSECURE FUCKING WAY THERE'S NOTHING BEING "MADE", ALSO THE "WEB" IS NOT THE THING YOU CREATED, YOU RECREATED WEBSITES -IT FUCKING SUCKS, so im making my own. \ No newline at end of file +IT FUCKING SUCKS, so im making my own. + +check out: +(pasdns)[https://git.gay/exhq/pasdns], dns server running on pas spec +(CURse)[https://git.gay/exhq/pas-curse] cli curl like client diff --git a/main.go b/main.go index fb8dd0c..008ffe6 100644 --- a/main.go +++ b/main.go @@ -34,7 +34,13 @@ func handleConnection(conn net.Conn, handler func(request Constants.Request, res return } parsed := parser.ParseIntent(raw) - request := Constants.Request{Intent: parsed, Body: strings.SplitN(raw, "\n\n", 2)[1]} + body := strings.SplitN(raw, "\n\n", 2) + if len(body) < 2 { + conn.Write(helper.StringToByteWithEnd(helper.IntentGenerator(Constants.Response{OperationSuccessClassification: Constants.INTERNALSERVERERROR, ResponseHeader: map[string]string{}, Body: "shit you sent wasnt pas bruh"}))) + return + } + request := Constants.Request{Intent: parsed, Body: body[1]} + handler(request, func(c Constants.Response) { conn.Write(helper.StringToByteWithEnd(helper.IntentGenerator(c))) }) diff --git a/test/test.go b/test/test.go index d7d161f..edb0573 100644 --- a/test/test.go +++ b/test/test.go @@ -9,7 +9,19 @@ import ( func main() { err := pas.StartServer(42069, func(request Constants.Request, respond func(Constants.Response)) { - respond(Constants.Response{OperationSuccessClassification: Constants.OK, ResponseHeader: map[string]string{}, Body: "say gex"}) + if request.Intent.Path == "/" { + respond(Constants.Response{ + OperationSuccessClassification: Constants.OK, + ResponseHeader: map[string]string{}, + Body: "first fucking shitternet page lets fucki ng go", + }) + } else { + respond(Constants.Response{ + OperationSuccessClassification: Constants.NOTFOUND, + ResponseHeader: map[string]string{}, + Body: "", + }) + } }, nil) if err != nil { log.Fatal(err)