[hackers] [quark] Rename REQ_MOD to REQ_IF_MODIFIED_SINCE || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Wed, 5 Aug 2020 15:47:10 +0200 (CEST)

commit 90d5179ea0d7a437a08085dfa1c10953dbd45a68
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Wed Aug 5 15:46:03 2020 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Wed Aug 5 15:46:03 2020 +0200

    Rename REQ_MOD to REQ_IF_MODIFIED_SINCE
    
    The named constants for header fields of the response struct all
    pretty much matched the actual header name, which I think improves
    readability for everyone familiar with the HTTP-spec.
    
    The request header fields named constants followed the rule, except
    the "If-Modified-Since"-header, which is addressed in this commit.
    
    Signed-off-by: Laslo Hunhold <dev_AT_frign.de>

diff --git a/http.c b/http.c
index d3976a6..d2a67d0 100644
--- a/http.c
+++ b/http.c
_AT_@ -22,9 +22,9 @@
 #include "util.h"
 
 const char *req_field_str[] = {
- [REQ_HOST] = "Host",
- [REQ_RANGE] = "Range",
- [REQ_MOD] = "If-Modified-Since",
+ [REQ_HOST] = "Host",
+ [REQ_RANGE] = "Range",
+ [REQ_IF_MODIFIED_SINCE] = "If-Modified-Since",
 };
 
 const char *req_method_str[] = {
_AT_@ -671,9 +671,10 @@ http_send_response(int fd, struct request *req)
         }
 
         /* modified since */
- if (req->field[REQ_MOD][0]) {
+ if (req->field[REQ_IF_MODIFIED_SINCE][0]) {
                 /* parse field */
- if (!strptime(req->field[REQ_MOD], "%a, %d %b %Y %T GMT", &tm)) {
+ if (!strptime(req->field[REQ_IF_MODIFIED_SINCE],
+ "%a, %d %b %Y %T GMT", &tm)) {
                         return http_send_status(fd, S_BAD_REQUEST);
                 }
 
diff --git a/http.h b/http.h
index 81f84a6..ac3e73d 100644
--- a/http.h
+++ b/http.h
_AT_@ -10,7 +10,7 @@
 enum req_field {
         REQ_HOST,
         REQ_RANGE,
- REQ_MOD,
+ REQ_IF_MODIFIED_SINCE,
         NUM_REQ_FIELDS,
 };
 
Received on Wed Aug 05 2020 - 15:47:10 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 05 2020 - 15:48:33 CEST