9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] url query params in rc-httpd
@ 2024-01-15 14:47 Dave MacFarlane
  0 siblings, 0 replies; only message in thread
From: Dave MacFarlane @ 2024-01-15 14:47 UTC (permalink / raw)
  To: 9front

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;'}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-15 14:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-15 14:47 [9front] url query params in rc-httpd Dave MacFarlane

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).