James Raitsev
James Raitsev

Reputation: 96411

Generating HttpResponse

When creating the HTTP Response manually, how can one get Server and ETag

     * HTTP/1.1 200 OK
     * Date: Mon, 23 Apr 2012 23:44:52 GMT
     * Server: Apache/2.2.3 (Red Hat)                  <-----
     * Last-Modified: Fri, 16 Sep 2005 18:08:50 GMT
     * ETag: "421142-2f-400e77c517080"                 <-----
     * Accept-Ranges: bytes
     * Content-Length: 47
     * Content-Type: text/plain
     * Connection: close

Upvotes: 3

Views: 200

Answers (2)

BillThor
BillThor

Reputation: 7576

Neither is required. You can make up your own sever tag using the same format above. Omit the eTag or just generate your own. You could use the current timestamp or a constant. The following formats should work.

Server: Program/version (O/S)
ETag:  "Timestamp"

Upvotes: 2

Alexei Levenkov
Alexei Levenkov

Reputation: 100547

"Server" is whatever your HTTP server wants to name/identify itself. I.e. "Zumgto Surver 4.5".

"ETag" identifies "version" of particular item, so as long as your server can reasonable say "this ETag corresponds to current version" you can send pretty much anything. I.e. "v3345", or hash of the item... Totally optional if you don't support "If-None-Match" header in requests.

Upvotes: 3

Related Questions