Commit 39fd89a3 authored by Kirill Smelkov's avatar Kirill Smelkov

*: Include language/runtime version in output too

So it is less becomes less ambiguous when we update languages and check
them via helloweb.

Before:

    Hello world at `/`  ; Thu Jun  9 11:10:36 2016  (go)

After

    Hello world at `/`  ; Thu Jun  9 11:10:36 2016  (go devel +d66cbec Mon Jul 18 15:52:45 2016 +0000))

/reviewed-by TrustMe
parent bdcaa736
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"log" "log"
"net" "net"
"net/http" "net/http"
"runtime"
"os" "os"
"strings" "strings"
"time" "time"
...@@ -29,8 +30,8 @@ func logit(handler http.Handler) http.Handler { ...@@ -29,8 +30,8 @@ func logit(handler http.Handler) http.Handler {
var name string var name string
func webhello(w http.ResponseWriter, r *http.Request) { func webhello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello %s at `%s` ; %s (go)\n", name, fmt.Fprintf(w, "Hello %s at `%s` ; %s (go %s)\n", name,
r.URL.Path, asctime()) r.URL.Path, asctime(), runtime.Version())
} }
func main() { func main() {
......
...@@ -19,9 +19,9 @@ class WebHello(BaseHTTPRequestHandler): ...@@ -19,9 +19,9 @@ class WebHello(BaseHTTPRequestHandler):
self.end_headers() self.end_headers()
print >>self.wfile, \ print >>self.wfile, \
"Hello %s at `%s` ; %s (python)" % ( "Hello %s at `%s` ; %s (python %s)" % (
' '.join(self.server.webhello_argv) or 'world', ' '.join(self.server.webhello_argv) or 'world',
self.path, time.asctime()) self.path, time.asctime(), sys.version.replace('\n', ' '))
class HTTPServerV6(HTTPServer): class HTTPServerV6(HTTPServer):
......
...@@ -41,7 +41,7 @@ def main ...@@ -41,7 +41,7 @@ def main
httpd.mount_proc '/' do |req, resp| httpd.mount_proc '/' do |req, resp|
name = args.argv_extra.join(' ') name = args.argv_extra.join(' ')
name = 'world' if name.empty? name = 'world' if name.empty?
resp.body = "Hello #{name} at `#{req.path}` ; #{Time.now.asctime} (ruby)\n" resp.body = "Hello #{name} at `#{req.path}` ; #{Time.now.asctime} (#{RUBY_DESCRIPTION})\n"
end end
httpd.start httpd.start
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment