Skip to content

Commit f346bd6

Browse files
committed
Rename fcgi_request.closed to .ended
"closed" refers to whether FCGI_END_REQUEST has been sent, while the "close" operation does something entirely different. It gets extra confusing when fcgi_is_closed() does not actually return fcgi_request.closed...
1 parent 2cb8950 commit f346bd6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

main/fastcgi.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ struct _fcgi_request {
216216
#ifdef TCP_NODELAY
217217
int nodelay;
218218
#endif
219-
int closed;
219+
int ended;
220220
int in_len;
221221
int in_pad;
222222

@@ -1045,7 +1045,7 @@ static int fcgi_read_request(fcgi_request *req)
10451045
unsigned char buf[FCGI_MAX_LENGTH+8];
10461046

10471047
req->keep = 0;
1048-
req->closed = 0;
1048+
req->ended = 0;
10491049
req->in_len = 0;
10501050
req->out_hdr = NULL;
10511051
req->out_pos = req->out_buf;
@@ -1503,15 +1503,15 @@ static inline void close_packet(fcgi_request *req)
15031503
}
15041504
}
15051505

1506-
int fcgi_flush(fcgi_request *req, int close)
1506+
int fcgi_flush(fcgi_request *req, int end)
15071507
{
15081508
int len;
15091509

15101510
close_packet(req);
15111511

15121512
len = (int)(req->out_pos - req->out_buf);
15131513

1514-
if (close) {
1514+
if (end) {
15151515
fcgi_end_request_rec *rec = (fcgi_end_request_rec*)(req->out_pos);
15161516

15171517
fcgi_make_header(&rec->hdr, FCGI_END_REQUEST, req->id, sizeof(fcgi_end_request));
@@ -1650,9 +1650,9 @@ int fcgi_finish_request(fcgi_request *req, int force_close)
16501650
int ret = 1;
16511651

16521652
if (req->fd >= 0) {
1653-
if (!req->closed) {
1653+
if (!req->ended) {
16541654
ret = fcgi_flush(req, 1);
1655-
req->closed = 1;
1655+
req->ended = 1;
16561656
}
16571657
fcgi_close(req, force_close, 1);
16581658
}

main/fastcgi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
118118
int fcgi_read(fcgi_request *req, char *str, int len);
119119

120120
int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len);
121-
int fcgi_flush(fcgi_request *req, int close);
121+
int fcgi_flush(fcgi_request *req, int end);
122122

123123
#ifdef PHP_WIN32
124124
void fcgi_impersonate(void);

0 commit comments

Comments
 (0)