@ossiana/node-libcurl 1.1.3-alpha-3 → 1.2.2

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.
Files changed (48) hide show
  1. package/LICENSE +21 -21
  2. package/dist/export.d.ts +6 -4
  3. package/dist/export.js +13 -9
  4. package/dist/export.js.map +1 -1
  5. package/dist/fetch.d.ts +27 -27
  6. package/dist/fetch.js +51 -51
  7. package/dist/fetch.js.map +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +17 -17
  10. package/dist/ja3Map.d.ts +12 -0
  11. package/dist/ja3Map.js +16 -0
  12. package/dist/ja3Map.js.map +1 -0
  13. package/dist/libcurl.d.ts +186 -172
  14. package/dist/libcurl.js +364 -350
  15. package/dist/libcurl.js.map +1 -1
  16. package/dist/libcurlWebSocket.d.ts +30 -0
  17. package/dist/libcurlWebSocket.js +83 -0
  18. package/dist/libcurlWebSocket.js.map +1 -0
  19. package/dist/requests.d.ts +101 -82
  20. package/dist/requests.js +372 -248
  21. package/dist/requests.js.map +1 -1
  22. package/dist/utils.d.ts +7 -6
  23. package/dist/utils.js +110 -101
  24. package/dist/utils.js.map +1 -1
  25. package/package.json +48 -41
  26. package/readme.md +79 -79
  27. package/scripts/bindings.js +15 -0
  28. package/scripts/postinstall.js +104 -0
  29. package/binding.gyp +0 -97
  30. package/src/ja3Table.json +0 -102
  31. package/src/libcurl/bao_curl.cpp +0 -338
  32. package/src/libcurl/bao_curl_multi.cpp +0 -123
  33. package/src/libcurl/bao_curl_node_addon.cpp +0 -511
  34. package/src/libcurl/include/bao_curl.h +0 -116
  35. package/src/libcurl/include/curl/Makefile.am +0 -39
  36. package/src/libcurl/include/curl/curl.h +0 -3104
  37. package/src/libcurl/include/curl/curlver.h +0 -77
  38. package/src/libcurl/include/curl/easy.h +0 -123
  39. package/src/libcurl/include/curl/mprintf.h +0 -50
  40. package/src/libcurl/include/curl/multi.h +0 -457
  41. package/src/libcurl/include/curl/options.h +0 -68
  42. package/src/libcurl/include/curl/stdcheaders.h +0 -33
  43. package/src/libcurl/include/curl/system.h +0 -504
  44. package/src/libcurl/include/curl/typecheck-gcc.h +0 -707
  45. package/src/libcurl/include/curl/urlapi.h +0 -145
  46. package/src/libcurl/include/request_tls_utils.h +0 -30
  47. package/src/libcurl/include/utils.h +0 -23
  48. package/src/libcurl/utils.cpp +0 -43
@@ -1,116 +0,0 @@
1
- #pragma once
2
- #ifndef _CURL_H
3
- #define _CURL_H
4
- #define NAMESPACE_BAO_START namespace bao {
5
- #define NAMESPACE_BAO_END }
6
-
7
- #include "curl/curl.h"
8
- #include "utils.h"
9
-
10
- NAMESPACE_BAO_START
11
-
12
- // typedef Napi::ThreadSafeFunction* BaoCurlOnPublishCallback;
13
- typedef std::shared_ptr<std::function<void (bool, std::string)>> BaoCurlOnPublishCallback;
14
-
15
- struct Stream_st
16
- {
17
- std::string header;
18
- std::string responseText;
19
- };
20
-
21
- class BaoCurl
22
- {
23
- public:
24
- BaoCurl();
25
- ~BaoCurl();
26
- void open(std::string&, std::string&);
27
- void setRequestHeader(std::string&, std::string&);
28
- void setRequestHeader(std::string&);
29
- void setRequestHeaders(std::string&);
30
- /*
31
- * setProxy必须在open后 send前设置
32
- * 在send后失效 需重新设置
33
- */
34
- void setProxy(std::string&);
35
- void setProxy(std::string&, std::string&,
36
- std::string&);
37
- /*
38
- * setTimeout必须在open后 send前设置
39
- * 在send后失效 需重新设置
40
- * 单位:秒 例子:setTimeout(10,10);
41
- */
42
- void setTimeout(
43
- int connectTime,
44
- int sendTime);
45
- /*
46
- * 设置单条Cookie
47
- */
48
- void setCookie(std::string& key, std::string& value, std::string& domain, std::string& path);
49
- /*
50
- * 移除单条Cookie
51
- */
52
- void deleteCookie(std::string& key, std::string& domain, std::string& path);
53
- void sendByte(const char*, const int);
54
- /*
55
- * 重置Curl 此前的操作全部失效
56
- */
57
- void reset();
58
-
59
- std::string getCookies();
60
- std::string getCookie(std::string& key, std::string& domain, std::string& path);
61
- std::string getResponseHeaders() { return this->m_stream.header; };
62
- std::string getResponseBody() { return this->m_stream.responseText; };
63
- long getResponseStatus();
64
- void setRedirect(bool isAllow); // 重定向
65
- void printInnerLogger(); // 打印内部日志
66
- void setInterface(std::string& network); // 指定网卡访问
67
- void setJA3Fingerprint(int tls_version, std::string& cipher, std::string& tls13_cipher, std::string& extensions, std::string& support_groups, int ec_point_formats);
68
-
69
- void setOnPublishCallback(BaoCurlOnPublishCallback callback);
70
-
71
- enum HttpVersion
72
- {
73
- http1_1,
74
- http2,
75
- };
76
- void setHttpVersion(HttpVersion);
77
- unsigned int getLastCurlCode();
78
- const char* getLastCurlCodeError();
79
- curl_off_t getResponseContentLength();
80
- friend class BaoCurlMulti;
81
-
82
- private:
83
- CURL* m_pCURL = NULL;
84
- struct curl_slist* m_pHeaders = NULL;
85
- std::string m_method = "GET";
86
- struct Stream_st m_stream;
87
- // struct curl_slist* m_cookies = NULL;
88
- bool m_bProxy = false;
89
- bool m_bIsHttps = false;
90
- bool m_verbose = false;
91
- CURLcode m_lastCode;
92
- BaoCurlOnPublishCallback m_publishCallback = nullptr;
93
- void init();
94
-
95
- std::unique_ptr<const char[]> m_postdata;
96
- };
97
-
98
- class BaoCurlMulti {
99
- public:
100
- BaoCurlMulti();
101
- ~BaoCurlMulti();
102
- void pushQueue(BaoCurl& curl);
103
- void startThread();
104
- private:
105
- CURLM* m_pCURLM = nullptr;
106
- CURLMcode m_lastCode;
107
- std::mutex m_lock;
108
-
109
- bool m_bRunning = true;
110
- std::thread m_thread;
111
-
112
- };
113
-
114
- NAMESPACE_BAO_END
115
-
116
- #endif // !_CURL_H
@@ -1,39 +0,0 @@
1
- #***************************************************************************
2
- # _ _ ____ _
3
- # Project ___| | | | _ \| |
4
- # / __| | | | |_) | |
5
- # | (__| |_| | _ <| |___
6
- # \___|\___/|_| \_\_____|
7
- #
8
- # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
9
- #
10
- # This software is licensed as described in the file COPYING, which
11
- # you should have received as part of this distribution. The terms
12
- # are also available at https://curl.se/docs/copyright.html.
13
- #
14
- # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
- # copies of the Software, and permit persons to whom the Software is
16
- # furnished to do so, under the terms of the COPYING file.
17
- #
18
- # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
- # KIND, either express or implied.
20
- #
21
- ###########################################################################
22
- pkginclude_HEADERS = \
23
- curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
24
- typecheck-gcc.h system.h urlapi.h options.h
25
-
26
- pkgincludedir= $(includedir)/curl
27
-
28
- CHECKSRC = $(CS_$(V))
29
- CS_0 = @echo " RUN " $@;
30
- CS_1 =
31
- CS_ = $(CS_0)
32
-
33
- checksrc:
34
- $(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
35
-
36
- if CURLDEBUG
37
- # for debug builds, we scan the sources on all regular make invokes
38
- all-local: checksrc
39
- endif