9front - general discussion about 9front
 help / color / mirror / Atom feed
From: "Dave MacFarlane" <driusan@driusan.net>
To: 9front@9front.org
Subject: [9front] url query params in rc-httpd
Date: Mon, 15 Jan 2024 09:47:21 -0500	[thread overview]
Message-ID: <70CC07843C04CCFE7FCEDF1CC31EB6F2@driusan.net> (raw)

There's a bug in rc-httpd when a query param has something that
looks like a url in it, it handles it as a request for the queryparam,
not a request for the url being requested. 

ie. a request for https://example.com/foo?q=http://example.com/bar is treated
as a request for http://example.com/bar by rc-httpd. I'm not sure if this 
is the right fix, but I worked around it by stripping everything after the '?'
from the $REQUEST_URI before doing the check for if it's an http proxy request.

diff 9c2e8e2b13b0d01b7adf88b61af6edfbddd872c1 uncommitted
--- a/rc/bin/rc-httpd/rc-httpd
+++ b/rc/bin/rc-httpd/rc-httpd
@@ -64,7 +64,8 @@
 		~ $line(2) chunked && chunked=yes
 	}
 }
-if(~ $REQUEST_URI *://* //*){
+REQUEST_NP=`{echo $REQUEST_URI | sed 's;\?.*;;'}
+if(~ $REQUEST_NP *://* //*){
 	SERVER_NAME=`{echo $REQUEST_URI | sed '
 		s;^[^:]+:;;
 		s;^//([^/]+).*;\1;'}

                 reply	other threads:[~2024-01-15 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70CC07843C04CCFE7FCEDF1CC31EB6F2@driusan.net \
    --to=driusan@driusan.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).