reqrio 0.1.0-rc1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ ### reqrio is an HTTP request library designed for fast, simple, and convenient HTTP request usage.
2
+
3
+ * Features: Low copy, high concurrency, low overhead
4
+
5
+ * Supports TLS fingerprinting, which can be configured via hexadecimal, Ja3, or Ja4 TLS handshake settings (*
6
+ *subscription only**).
7
+
8
+ * Ensures **request header order** (see [Request Header Order Table](#request-header-order-table)), consistent with
9
+ browsers.
10
+
11
+ * Uses **BoringSSL** to implement TLS, consistent with browsers like Chrome and Edge.
12
+
13
+ **Note:** std and cls cannot exist simultaneously, while sync and async can exist simultaneously.
14
+
15
+ ### Request Header Order Table
16
+
17
+ | No. | HTTP/2.0 | HTTP/1.1 |
18
+ |:----|:----------------------------|:--------------------------|
19
+ | 1 | cache-control | Host |
20
+ | 2 | sec-ch-ua | Connection |
21
+ | 3 | sec-ch-ua-mobile | Content-Length |
22
+ | 4 | sec-ch-ua-full-version | Authorization |
23
+ | 5 | sec-ch-ua-arch | Content-Type |
24
+ | 6 | sec-ch-ua-platform | Cache-Control |
25
+ | 7 | sec-ch-ua-platform-version | sec-ch-ua |
26
+ | 8 | sec-ch-ua-model | sec-ch-ua-mobile |
27
+ | 9 | sec-ch-ua-bitness | sec-ch-ua-platform |
28
+ | 10 | sec-ch-ua-full-version-list | Upgrade-Insecure-Requests |
29
+ | 11 | upgrade-insecure-requests | User-Agent |
30
+ | 12 | user-agent | Accept |
31
+ | 13 | accept | Sec-Fetch-Site |
32
+ | 14 | origin | Sec-Fetch-Mode |
33
+ | 15 | sec-fetch-site | Sec-Fetch-User |
34
+ | 16 | sec-fetch-mode | Sec-Fetch-Dest |
35
+ | 17 | sec-fetch-user | Sec-Fetch-Storage-Access |
36
+ | 18 | sec-fetch-dest | Referer |
37
+ | 19 | sec-fetch-storage-access | Accept-Encoding |
38
+ | 20 | referer | Accept-Language |
39
+ | 21 | accept-encoding | Cookie |
40
+ | 22 | accept-language | Origin |
41
+ | 23 | cookie | |
42
+ | 24 | priority | |
43
+ | | //unknown | |
44
+ | 25 | content-encoding | |
45
+ | 26 | content-type | |
46
+ | 27 | authorization | |
47
+ | 28 | content-type | |
48
+
49
+ ### Usage examples:
50
+
51
+ * Http Example
52
+
53
+ ```js
54
+ const {Session, ALPN} = require("reqrio")
55
+
56
+ let session = new Session(ALPN.HTTP11)
57
+ session.set_header_json({
58
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
59
+ "Accept-Encoding": "gzip, deflate, br, zstd",
60
+ "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
61
+ "Cache-Control": "no-cache",
62
+ "Connection": "keep-alive",
63
+ "Cookie": "__guid=15015764.1071255116101212729.1764940193317.2156; env_webp=1; _S=pvc5q7leemba50e4kn4qis4b95; QiHooGUID=4C8051464B2D97668E3B21198B9CA207.1766289287750; count=1; so-like-red=2; webp=1; so_huid=114r0SZFiQcJKtA38GZgwZg%2Fdit1cjUGuRcsIL2jTn4%2FE%3D; __huid=114r0SZFiQcJKtA38GZgwZg%2Fdit1cjUGuRcsIL2jTn4%2FE%3D; gtHuid=1",
64
+ "Host": "m.so.com",
65
+ "Pragma": "no-cache",
66
+ "Sec-Fetch-Dest": "document",
67
+ "Sec-Fetch-Mode": "navigate",
68
+ "Sec-Fetch-Site": "none",
69
+ "Sec-Fetch-User": "?1",
70
+ "Upgrade-Insecure-Requests": 1,
71
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0",
72
+ "sec-ch-ua": '"Microsoft Edge";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
73
+ "sec-ch-ua-mobile": "?0",
74
+ "sec-ch-ua-platform": '"Windows"'
75
+ })
76
+ session.set_url('https://m.so.com')
77
+ let resp = session.get()
78
+ console.log(resp.status_code())
79
+ session.close()
80
+
81
+ ```
82
+
83
+ * WebSocket Example
84
+
85
+ ```js
86
+ const {Websocket} = require('index')
87
+
88
+ let ws = new Websocket();
89
+ ws.set_url("wss://api.github.com")
90
+ ws.add_header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0")
91
+ ws.set_proxy("http://127.0.0.1:7878")
92
+ ws.open()
93
+ while (true) {
94
+ frame = ws.read()
95
+ console.log(frame)
96
+ }
97
+
98
+ ```
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const {Session, Response, Method, ALPN} = require('session')
2
- const {Websocket} = require("ws")
1
+ const {Session, Response, Method, ALPN} = require('./session')
2
+ const {Websocket} = require("./ws")
3
3
 
4
4
  module.exports = {
5
5
  Session,
@@ -7,4 +7,6 @@ module.exports = {
7
7
  Method,
8
8
  ALPN,
9
9
  Websocket
10
- }
10
+ }
11
+
12
+ //npm publish
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reqrio",
3
- "version": "0.1.0-rc1",
3
+ "version": "0.1.0",
4
4
  "description": "A lightweight, high concurrency HTTP request library",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/session.js CHANGED
@@ -1,5 +1,5 @@
1
- const {library, Method, make_ScReq_callback, read_to_string} = require("bindings");
2
- const {Response} = require("Response")
1
+ const {library, Method, make_ScReq_callback, read_to_string} = require("./bindings");
2
+ const {Response} = require("./Response")
3
3
 
4
4
  const ALPN = Object.freeze({
5
5
  HTTP10: "http/1.0",
package/test.js CHANGED
@@ -1,4 +1,4 @@
1
- const {Session, ALPN, Websocket} = require('index')
1
+ const {Session, ALPN, Websocket} = require('./index')
2
2
 
3
3
  let session = new Session(ALPN.HTTP20, false);
4
4
  session.set_url("https://m.so.com");