[hackers] [quark] remove unused fields and redundant check for HTTP method || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Tue, 27 Jun 2017 23:31:28 +0200 (CEST)

commit 241449454fa3edbc3dc142dd52f75c5ccc2a6d05
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Tue Jun 27 21:36:14 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Tue Jun 27 23:31:08 2017 +0200

    remove unused fields and redundant check for HTTP method

diff --git a/quark.c b/quark.c
index de41214..e9aafba 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -32,45 +32,29 @@ char *argv0;
 
 #undef MIN
 #define MIN(x,y) ((x) < (y) ? (x) : (y))
-#undef MAX
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
 
 #define TIMESTAMP_LEN 30
 
 enum req_field {
- REQ_HOST,
         REQ_RANGE,
         REQ_MOD,
         NUM_REQ_FIELDS,
 };
 
 static char *req_field_str[] = {
- [REQ_HOST] = "Host",
         [REQ_RANGE] = "Range",
         [REQ_MOD] = "If-Modified-Since",
 };
 
 enum req_method {
- M_OPTIONS,
         M_GET,
         M_HEAD,
- M_POST,
- M_PUT,
- M_DELETE,
- M_TRACE,
- M_CONNECT,
         NUM_REQ_METHODS,
 };
 
 static char *req_method_str[] = {
- [M_OPTIONS] = "OPTIONS",
- [M_GET] = "GET",
- [M_HEAD] = "HEAD",
- [M_POST] = "POST",
- [M_PUT] = "PUT",
- [M_DELETE] = "DELETE",
- [M_TRACE] = "TRACE",
- [M_CONNECT] = "CONNECT",
+ [M_GET] = "GET",
+ [M_HEAD] = "HEAD",
 };
 
 struct request {
_AT_@ -519,11 +503,6 @@ sendresponse(int fd, struct request *r)
         static char realtarget[PATH_MAX], tmptarget[PATH_MAX], t[TIMESTAMP_LEN];
         char *p, *q, *mime;
 
- /* check method */
- if (r->method != M_GET && r->method != M_HEAD) {
- return sendstatus(fd, S_METHOD_NOT_ALLOWED);
- }
-
         /* normalize target */
         memcpy(realtarget, r->target, sizeof(realtarget));
         if (normabspath(realtarget)) {
Received on Tue Jun 27 2017 - 23:31:28 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 27 2017 - 23:36:23 CEST