Skip to content

Instantly share code, notes, and snippets.

@iperdomo
Created November 6, 2013 15:20
Show Gist options
  • Select an option

  • Save iperdomo/7337782 to your computer and use it in GitHub Desktop.

Select an option

Save iperdomo/7337782 to your computer and use it in GitHub Desktop.
Compojure issue
$ lein -version
# Leiningen 2.3.3 on Java 1.6.0_27 OpenJDK 64-Bit Server VM
$ lein new compojure test
$ cd test
$ lein deps
$ echo "User-agent: *
> Disallow: /
> " > resources/public/robots.txt
$ lein ring server
$ curl http://localhost:3000
Hello World
$ curl -I http://localhost:3000
HTTP/1.1 200 OK
Date: Wed, 06 Nov 2013 15:13:57 GMT
Content-Type: text/html;charset=UTF-8
Content-Length: 0
Server: Jetty(7.6.8.v20121106)
$ curl http://localhost:3000/robots.txt
User-agent: *
Disallow: /
$ curl -I http://localhost:3000/robots.txt
HTTP/1.1 200 OK
Date: Wed, 06 Nov 2013 15:16:00 GMT
Last-Modified: Wed, 06 Nov 2013 15:12:03 +0000
Content-Length: 27
Content-Type: text/plain
Server: Jetty(7.6.8.v20121106)
$ curl http://localhost:3000/not-existent.txt
Not Found # <--- correct
$ curl -I http://localhost:3000/not-existent.txt
HTTP/1.1 200 OK # <--- incorrect??? It should be 404
Date: Wed, 06 Nov 2013 15:18:04 GMT
Content-Length: 0
Server: Jetty(7.6.8.v20121106)
@iperdomo
Copy link
Copy Markdown
Author

iperdomo commented Nov 6, 2013

curl -I makes a HEAD request, not a GET request.

$ curl -v http://localhost:3000/not-existent.txt
* Adding handle: conn: 0x13236a0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x13236a0) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 3000 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> GET /not-existent.txt HTTP/1.1
> User-Agent: curl/7.33.0
> Host: localhost:3000
> Accept: */*
> 
< HTTP/1.1 404 Not Found    # <--- Good!
< Date: Wed, 06 Nov 2013 15:38:02 GMT
< Content-Type: text/html;charset=UTF-8
< Content-Length: 9
* Server Jetty(7.6.8.v20121106) is not blacklisted
< Server: Jetty(7.6.8.v20121106)
< 
* Connection #0 to host localhost left intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment