jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.87k stars 1.91k forks source link

NCSARequestLog will log extra space when username or user-agent is null #778

Closed dynastywind closed 8 years ago

dynastywind commented 8 years ago

It's found that there will be extra spaces logged when username or user-agent field is null.

For example, if username is null and its format is %u, then the corresponding field in the log record will be ' - '. Note that '-' is both prepended and appended with a space.

And if user-agent is null and its format is "%{user-agent}i", the result will be

"-" 

Note that there's an extra space appended after ".

I've no idea if it's a bug or you just do it intentionally. This will cause problems when parsing the log records.

gregw commented 8 years ago

Is this the same issue that was just fixed by #770? If so then that's a huge coincidence! What are you guys using that is so sensitive to the extra space. So can you confirm if #770 is a fix for your issue?

gregw commented 8 years ago

Ah I see that #770 was a result of your issue raised on logparser: https://github.com/nielsbasjes/logparser/issues/30 . So I'm closing this as fixed, thanks to @nielsbasjes

dynastywind commented 8 years ago

Ah, didn't see that. Thank you.