0.25.0 • Published 4 days ago

@quanxiaoxiao/httttp v0.25.0

Weekly downloads
-
License
-
Repository
-
Last release
4 days ago

This is a library for processing HTTP 1.1 packets. During the parsing process, it provides various hook functions such as onHttpRequest, onHttpRequestStartLine, etc., to facilitate more granular control over packets, output log tracing, and traffic statistics. It also supports the forwarding function of HTTP 1.1 packets. Through reverse proxy, more fine-grained traffic control can be achieved.

Install

npm install @quanxiaoxiao/httttp

Quick Start

import net from 'node:net';
import { handleSocketHttp } from '@quanxiaoxiao/httttp';

const hooks = {
  onHttpRequest: () => {...},
  onHttpRequestEnd: (ctx) => {
    ctx.response = {
      headers: {
        server: 'quan',
        'content-length': 'text/plain',
      },
      body: 'ok',
    };
  },
};

const server = net.createServer(handleSocketHttp(hooks));

server.listen(3000);

Hooks

  • onHttpRequest
  • onHttpRequestStartLine
  • onHttpRequestHeader
  • onHttpRequestConnection
  • onHttpRequestEnd
  • onForwardConnecting
  • onForwardConnect
  • onHttpResponseEnd
  • onHttpError
  • onChunkIncoming
  • onChunkOutgoing
  • onFinish
0.25.0

4 days ago

0.24.0

12 days ago

0.21.0

18 days ago

0.20.0

19 days ago

0.19.0

19 days ago

0.18.0

19 days ago

0.23.0

18 days ago

0.22.0

18 days ago

0.17.0

26 days ago

0.14.0

1 month ago

0.15.0

1 month ago

0.16.0

1 month ago

0.13.0

1 month ago

0.11.0

1 month ago

0.12.0

1 month ago

0.10.0

1 month ago

0.9.1

1 month ago

0.9.0

1 month ago

0.8.0

1 month ago

0.7.0

1 month ago

0.6.0

1 month ago

0.5.0

1 month ago

0.5.1

1 month ago

0.4.0

3 months ago

0.3.0

3 months ago

0.3.2

3 months ago

0.3.1

3 months ago

0.2.1

3 months ago

0.2.2

3 months ago

0.2.0

4 months ago

0.1.6

4 months ago

0.1.5

4 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.2

4 months ago

0.1.1

4 months ago

0.1.0

4 months ago