URIs are not escaped correctly
Firehed opened this issue · comments
In the line protocol documentation, it's noted that quoted strings may be escaped. I've observed that if I make a request to a page with a double-quote in the URI, the value that this module sends out over UDP is not escaped properly:
GET /f,oo%22bar
measurement,server_name=example.com method="GET",status=404,bytes_sent=223,body_bytes_sent=9,header_bytes_sent=214,request_length=799,uri="/f,oo"bar",extension="",content_type="text/plain; charset=utf-8",request_time=0.001
GET /foo%22bar
measurement,server_name=example.com method="GET",status=404,bytes_sent=223,body_bytes_sent=9,header_bytes_sent=214,request_length=824,uri="/foo"bar",extension="",content_type="text/plain; charset=utf-8",request_time=0.003
The uri field that goes out should either retain the original urlencoded value or be escaped properly, but right now the data will just get mangled.
Thanks for taking the time to open this @Firehed - let me know if you want to send a PR for this otherwise I will handle that. Thanks again.
I was able to reproduce:
static,server_name=myserver method="GET",status=404,bytes_sent=308,body_bytes_sent=153,header_bytes_sent=155,request_length=88,uri="/f,oo"bar",extension="",content_type="text/html",request_time=0.000
In that case, this is what we want. Turned out that I mistakenly took the uri
field from the ngx_http_request_t
struct instead of the unparsed_uri
field.
Here's what I get:
static,server_name=myserver method="GET",status=404,bytes_sent=308,body_bytes_sent=153,header_bytes_sent=155,request_length=88,uri="/f,oo%22bar",extension="",content_type="text/html",request_time=0.000
I'm sending a patch for this.