public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: GNU/Weeb Mailing List <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	Arthur Lapz <[email protected]>,
	Fernanda Ma'rouf <[email protected]>,
	Sprite <[email protected]>, Yonle <[email protected]>
Subject: [PATCH gwhttpd 00/14] gwhttpd updates
Date: Fri,  8 Jul 2022 19:10:11 +0700	[thread overview]
Message-ID: <[email protected]> (raw)

Hi,

gwhttpd updates. There are 14 patches in this series. The most
interesting part is the new feature, "Range" HTTP header support. I
also added SLC support, so now we have a built-in port forwarding
feature.

## Summary:
1) Do an early return when `parse_http_header()` fails. Don't continue
   executing the next line if we fail to parse the HTTP header, that's
   the wrong path, we should stop the client early.

2) Don't print any error when mlock fails. This mlock is just
   optional, don't bother showing error.

3) Replace `send_error_and_close()` with `send_http_error()`. Let the
   caller close the connection, we need to have more decisions in the
   caller rather than closing it directly.

4) Add log in the interrupt handler. Print a log message that we are
   interrupted, this makes the app user friendly because the user can
   explicitly see from the output that the app is interrupted.

5) Refactor HTTP header parser. The HTTP header parser was prone and
   didn't handle many edge cases. This is a full refactor of HTTP
   header parser. While in there, add more HTTP method supports.

6) Avoid endless busy spinning on `send()`. When we fail to send() due
   to EAGAIN, we retry the send(). However, if we are spinning on this
   retry for so long, this will eat CPU cycle and slow down the entire
   application. We should stop retrying at some point. Add a loop
   counter and return -ENETDOWN if we are failing too many times in
   the send() retry loop cycle.

7) Add "make clean" command.

8) Skip interrupt error from `epoll_wait()`. When the epoll_wait() got
   -EINTR, we should still continue the program, because it may just
   be a small interrupt from strace or whatever situation that doesn't
   need to stop the program.

9) Add directory listing support.

10) Add command line options support with libc getopt.

11) Add SLC support.

12) Shut the SLC log up. The SLC log will be very noisy for gwhttpd,
    let's just get rid of them!

13) Fix 403 HTTP error when accessing an empty file. Hendra reports
    that he is seeing an HTTP 403 error when accssing an empty file.
    It turned out that we fail on the mmap() syscall. mmap() returns
    -EINVAL if the given size is zero. This happens when the file size
    is zero. Make a special case when the file size is zero, bump the
    mmap() size to 1. This way the mmap() will happily allocate a VMA
    without error.

14) Add connecting log for SLC. Make SLC state clear when we are
    connecting to the SLC server.

Signed-off-by: Ammar Faizi <[email protected]>
---

Ammar Faizi (14):
  gwhttpd: Do an early return when `parse_http_header()` fails
  gwhttpd: Don't print any error when mlock fails
  gwhttpd: Replace `send_error_and_close()` with `send_http_error()`
  gwhttpd: Add log in the interrupt handler
  gwhttpd: Refactor HTTP header parser
  gwhttpd: Avoid endless busy spinning on `send()`
  Makefile: Add "make clean" command
  gwhttpd: Skip interrupt error from `epoll_wait()`
  gwhttpd: Add directory listing and download file support
  gwhttpd: Add command line options
  gwhttpd: Add SLC support
  gwhttpd: slc: Shut the SLC log up
  gwhttpd: Fix 403 HTTP error when accessing an empty file
  gwhttpd: Add connecting log for SLC

 Makefile    |    7 +-
 gwhttpd.cpp | 2368 +++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 2005 insertions(+), 370 deletions(-)


base-commit: 944b77d9aaac4a88729da6ec2f76447a9c3562ab
-- 
Ammar Faizi


             reply	other threads:[~2022-07-08 12:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 12:10 Ammar Faizi [this message]
2022-07-08 12:10 ` [PATCH gwhttpd 01/14] gwhttpd: Do an early return when `parse_http_header()` fails Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 02/14] gwhttpd: Don't print any error when mlock fails Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 03/14] gwhttpd: Replace `send_error_and_close()` with `send_http_error()` Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 04/14] gwhttpd: Add log in the interrupt handler Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 05/14] gwhttpd: Refactor HTTP header parser Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 06/14] gwhttpd: Avoid endless busy spinning on `send()` Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 07/14] Makefile: Add "make clean" command Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 08/14] gwhttpd: Skip interrupt error from `epoll_wait()` Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 09/14] gwhttpd: Add directory listing and download file support Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 10/14] gwhttpd: Add command line options Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 11/14] gwhttpd: Add SLC support Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 12/14] gwhttpd: slc: Shut the SLC log up Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 13/14] gwhttpd: Fix 403 HTTP error when accessing an empty file Ammar Faizi
2022-07-08 12:10 ` [PATCH gwhttpd 14/14] gwhttpd: Add connecting log for SLC Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox