Skip to content

Commit c82993c

Browse files
committed
fix review comments
renaming of functions
1 parent bda717f commit c82993c

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

fw/cache.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ tfw_handle_validation_req(TfwHttpReq *req, TfwCacheEntry *ce)
863863
|| (req->method == TFW_HTTP_METH_HEAD))
864864
tfw_cache_send_304(req, ce);
865865
else
866-
tfw_http_send_resp(req, 412,
866+
tfw_http_send_err_resp(req, 412,
867867
"request validation: "
868868
"precondition failed");
869869

@@ -1965,14 +1965,14 @@ tfw_cache_purge_method(TfwHttpReq *req)
19651965

19661966
/* Deny PURGE requests by default. */
19671967
if (!(cache_cfg.cache && g_vhost->cache_purge && g_vhost->cache_purge_acl)) {
1968-
tfw_http_send_resp(req, 403, "purge: not configured");
1968+
tfw_http_send_err_resp(req, 403, "purge: not configured");
19691969
return -EINVAL;
19701970
}
19711971

19721972
/* Accept requests from configured hosts only. */
19731973
ss_getpeername(req->conn->sk, &saddr);
19741974
if (!tfw_capuacl_match(&saddr)) {
1975-
tfw_http_send_resp(req, 403, "purge: ACL violation");
1975+
tfw_http_send_err_resp(req, 403, "purge: ACL violation");
19761976
return -EINVAL;
19771977
}
19781978

@@ -1982,14 +1982,14 @@ tfw_cache_purge_method(TfwHttpReq *req)
19821982
ret = tfw_cache_purge_invalidate(req);
19831983
break;
19841984
default:
1985-
tfw_http_send_resp(req, 403, "purge: invalid option");
1985+
tfw_http_send_err_resp(req, 403, "purge: invalid option");
19861986
return -EINVAL;
19871987
}
19881988

19891989
if (ret)
1990-
tfw_http_send_resp(req, 404, "purge: processing error");
1990+
tfw_http_send_err_resp(req, 404, "purge: processing error");
19911991
else if (!test_bit(TFW_HTTP_B_PURGE_GET, req->flags))
1992-
tfw_http_send_resp(req, 200, "purge: success");
1992+
tfw_http_send_err_resp(req, 200, "purge: success");
19931993

19941994
return ret;
19951995
}
@@ -2382,7 +2382,7 @@ cache_req_process_node(TfwHttpReq *req, tfw_http_cache_cb_t action)
23822382
}
23832383
out:
23842384
if (!resp && (req->cache_ctl.flags & TFW_HTTP_CC_OIFCACHED))
2385-
tfw_http_send_resp(req, 504, "resource not cached");
2385+
tfw_http_send_err_resp(req, 504, "resource not cached");
23862386
else
23872387
/*
23882388
* TODO: RFC 7234 4.3.2: Extend preconditional request headers

fw/http.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ tfw_h2_resp_fwd(TfwHttpResp *resp)
937937
}
938938

939939
static void
940-
tfw_h2_send_resp(TfwHttpReq *req, int status, unsigned int stream_id)
940+
tfw_h2_send_err_resp(TfwHttpReq *req, int status, unsigned int stream_id)
941941
{
942942
TfwStr *msg;
943943
resp_code_t code;
@@ -1055,7 +1055,7 @@ tfw_h2_send_resp(TfwHttpReq *req, int status, unsigned int stream_id)
10551055
* the fourth chunk must be CRLF.
10561056
*/
10571057
static void
1058-
tfw_h1_send_resp(TfwHttpReq *req, int status)
1058+
tfw_h1_send_err_resp(TfwHttpReq *req, int status)
10591059
{
10601060
TfwMsgIter it;
10611061
resp_code_t code;
@@ -1131,7 +1131,7 @@ tfw_h1_send_resp(TfwHttpReq *req, int status)
11311131
* a value.
11321132
*/
11331133
static void
1134-
tfw_h2_send_resp2(TfwHttpReq *req, TfwStr *msg, int status,
1134+
tfw_h2_send_resp(TfwHttpReq *req, TfwStr *msg, int status,
11351135
unsigned int stream_id)
11361136
{
11371137
TfwHttpResp *resp;
@@ -1215,7 +1215,7 @@ tfw_h2_send_resp2(TfwHttpReq *req, TfwStr *msg, int status,
12151215
* a value.
12161216
*/
12171217
static void
1218-
tfw_h1_send_resp2(TfwHttpReq *req, TfwStr *msg, int status)
1218+
tfw_h1_send_resp(TfwHttpReq *req, TfwStr *msg, int status)
12191219
{
12201220
TfwMsgIter it;
12211221
TfwHttpResp *resp;
@@ -1489,24 +1489,24 @@ tfw_http_nip_req_resched_err(TfwSrvConn *srv_conn, TfwHttpReq *req,
14891489

14901490
/* Common interface for sending error responses. */
14911491
void
1492-
tfw_http_send_resp(TfwHttpReq *req, int status, const char *reason)
1492+
tfw_http_send_err_resp(TfwHttpReq *req, int status, const char *reason)
14931493
{
14941494
if (!(tfw_blk_flags & TFW_BLK_ERR_NOLOG)) {
14951495
T_WARN_ADDR_STATUS(reason, &req->conn->peer->addr,
14961496
TFW_NO_PORT, status);
14971497
}
14981498

14991499
if (TFW_MSG_H2(req))
1500-
tfw_h2_send_resp(req, status, 0);
1500+
tfw_h2_send_err_resp(req, status, 0);
15011501
else
1502-
tfw_h1_send_resp(req, status);
1502+
tfw_h1_send_err_resp(req, status);
15031503
}
15041504

15051505
static void
1506-
tfw_http_send_resp2(TfwHttpReq *req, TfwStr *msg, int status)
1506+
tfw_http_send_resp(TfwHttpReq *req, TfwStr *msg, int status)
15071507
{
15081508
if (TFW_MSG_H2(req)) {
1509-
tfw_h2_send_resp2(req, msg, status, 0);
1509+
tfw_h2_send_resp(req, msg, status, 0);
15101510
} else {
15111511
TfwCliConn *cli_conn = (TfwCliConn *)req->conn;
15121512

@@ -1517,7 +1517,7 @@ tfw_http_send_resp2(TfwHttpReq *req, TfwStr *msg, int status)
15171517
list_add_tail(&req->msg.seq_list, &cli_conn->seq_queue);
15181518
spin_unlock(&cli_conn->seq_qlock);
15191519

1520-
tfw_h1_send_resp2(req, msg, status);
1520+
tfw_h1_send_resp(req, msg, status);
15211521
}
15221522
}
15231523

@@ -1614,7 +1614,7 @@ do { \
16141614
S_CRLF S_CRLF) + (url_p - url),
16151615
.nchunks = 10
16161616
};
1617-
tfw_http_send_resp2(req, &msg, status);
1617+
tfw_http_send_resp(req, &msg, status);
16181618
}
16191619
}
16201620

@@ -1717,7 +1717,7 @@ tfw_http_req_zap_error(struct list_head *eq)
17171717
|| (!TFW_MSG_H2(req)
17181718
&& !test_bit(TFW_HTTP_B_REQ_DROP, req->flags)))
17191719
{
1720-
tfw_http_send_resp(req, req->httperr.status,
1720+
tfw_http_send_err_resp(req, req->httperr.status,
17211721
req->httperr.reason);
17221722
}
17231723
else
@@ -2237,7 +2237,7 @@ tfw_http_req_resched(TfwHttpReq *req, TfwServer *srv, struct list_head *eq)
22372237
}
22382238
} else if (!(sch_conn = tfw_http_get_srv_conn((TfwMsg *)req))) {
22392239
T_DBG("Unable to find a backend server\n");
2240-
tfw_http_send_resp(req, 502, "request dropped: unable to"
2240+
tfw_http_send_err_resp(req, 502, "request dropped: unable to"
22412241
" find an available back end server");
22422242
TFW_INC_STAT_BH(clnt.msgs_otherr);
22432243
return 0;
@@ -4893,7 +4893,7 @@ tfw_h1_resp_adjust_fwd(TfwHttpResp *resp)
48934893
*/
48944894
if (tfw_http_adjust_resp(resp)) {
48954895
tfw_http_conn_msg_free((TfwHttpMsg *)resp);
4896-
tfw_http_send_resp(req, 500,
4896+
tfw_http_send_err_resp(req, 500,
48974897
"response dropped: processing error");
48984898
TFW_INC_STAT_BH(serv.msgs_otherr);
48994899
return;
@@ -4966,15 +4966,15 @@ tfw_h2_error_resp(TfwHttpReq *req, int status, bool reply, bool attack,
49664966
* is already in locally closed state (switched in
49674967
* @tfw_h2_stream_id_close() during failed proxy/internal response
49684968
* creation) or will be switched into locally closed state in
4969-
* @tfw_h2_send_resp() (or in @tfw_h2_stream_id_close() if no error
4969+
* @tfw_h2_send_err_resp() (or in @tfw_h2_stream_id_close() if no error
49704970
* response is needed) below; remotely (i.e. on client side) stream
49714971
* will be closed - due to END_STREAM flag set in the last frame of
49724972
* error response; in case of attack we must close entire connection,
49734973
* and GOAWAY frame should be sent (RFC 7540 section 6.8) after
49744974
* error response.
49754975
*/
49764976
if (reply) {
4977-
tfw_h2_send_resp(req, status, 0);
4977+
tfw_h2_send_err_resp(req, status, 0);
49784978
if (attack)
49794979
tfw_h2_conn_terminate_close(ctx, HTTP2_ECODE_PROTO,
49804980
!on_req_recv_event);
@@ -5039,7 +5039,7 @@ tfw_h1_error_resp(TfwHttpReq *req, int status, bool reply, bool attack,
50395039
*/
50405040
if (on_req_recv_event || attack)
50415041
tfw_http_req_set_conn_close(req);
5042-
tfw_h1_send_resp(req, status);
5042+
tfw_h1_send_err_resp(req, status);
50435043
}
50445044
/*
50455045
* Serve all pending requests if not under attack, close immediately
@@ -5263,7 +5263,7 @@ tfw_h2_resp_adjust_fwd(TfwHttpResp *resp)
52635263
T_WARN_ADDR_STATUS("response dropped: processing error",
52645264
&req->conn->peer->addr,
52655265
TFW_NO_PORT, 500);
5266-
tfw_h2_send_resp(req, 500, stream_id);
5266+
tfw_h2_send_err_resp(req, 500, stream_id);
52675267
tfw_hpack_enc_release(&ctx->hpack, resp->flags);
52685268
TFW_INC_STAT_BH(serv.msgs_otherr);
52695269

@@ -5343,11 +5343,11 @@ tfw_http_req_cache_cb(TfwHttpMsg *msg)
53435343
goto conn_put;
53445344

53455345
send_502:
5346-
tfw_http_send_resp(req, 502, "request dropped: processing error");
5346+
tfw_http_send_err_resp(req, 502, "request dropped: processing error");
53475347
TFW_INC_STAT_BH(clnt.msgs_otherr);
53485348
return;
53495349
send_500:
5350-
tfw_http_send_resp(req, 500, "request dropped: processing error");
5350+
tfw_http_send_err_resp(req, 500, "request dropped: processing error");
53515351
TFW_INC_STAT_BH(clnt.msgs_otherr);
53525352
conn_put:
53535353
/*
@@ -5942,7 +5942,7 @@ tfw_http_req_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb)
59425942
* The request should either be stored or released.
59435943
* Otherwise we lose the reference to it and get a leak.
59445944
*/
5945-
tfw_http_send_resp(req, 500, "request dropped:"
5945+
tfw_http_send_err_resp(req, 500, "request dropped:"
59465946
" processing error");
59475947
TFW_INC_STAT_BH(clnt.msgs_otherr);
59485948
}
@@ -6178,7 +6178,7 @@ tfw_http_resp_cache(TfwHttpMsg *hmresp)
61786178
if (tfw_cache_process(hmresp, tfw_http_resp_cache_cb))
61796179
{
61806180
tfw_http_conn_msg_free(hmresp);
6181-
tfw_http_send_resp(req, 500, "response dropped:"
6181+
tfw_http_send_err_resp(req, 500, "response dropped:"
61826182
" processing error");
61836183
TFW_INC_STAT_BH(serv.msgs_otherr);
61846184
/* Proceed with processing of the next response. */

fw/http.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ int tfw_h1_prep_redirect(TfwHttpResp *resp, unsigned short status,
710710
int tfw_http_prep_304(TfwHttpReq *req, struct sk_buff **skb_head,
711711
TfwMsgIter *it);
712712
void tfw_http_conn_msg_free(TfwHttpMsg *hm);
713-
void tfw_http_send_resp(TfwHttpReq *req, int status, const char *reason);
713+
void tfw_http_send_err_resp(TfwHttpReq *req, int status, const char *reason);
714714

715715
/* Helper functions */
716716
char *tfw_http_msg_body_dup(const char *filename, size_t *len);

0 commit comments

Comments
 (0)