@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,145 +0,0 @@
1
- #ifndef CURLINC_URLAPI_H
2
- #define CURLINC_URLAPI_H
3
- /***************************************************************************
4
- * _ _ ____ _
5
- * Project ___| | | | _ \| |
6
- * / __| | | | |_) | |
7
- * | (__| |_| | _ <| |___
8
- * \___|\___/|_| \_\_____|
9
- *
10
- * Copyright (C) 2018 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
11
- *
12
- * This software is licensed as described in the file COPYING, which
13
- * you should have received as part of this distribution. The terms
14
- * are also available at https://curl.se/docs/copyright.html.
15
- *
16
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
- * copies of the Software, and permit persons to whom the Software is
18
- * furnished to do so, under the terms of the COPYING file.
19
- *
20
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
- * KIND, either express or implied.
22
- *
23
- ***************************************************************************/
24
-
25
- #include "curl.h"
26
-
27
- #ifdef __cplusplus
28
- extern "C" {
29
- #endif
30
-
31
- /* the error codes for the URL API */
32
- typedef enum {
33
- CURLUE_OK,
34
- CURLUE_BAD_HANDLE, /* 1 */
35
- CURLUE_BAD_PARTPOINTER, /* 2 */
36
- CURLUE_MALFORMED_INPUT, /* 3 */
37
- CURLUE_BAD_PORT_NUMBER, /* 4 */
38
- CURLUE_UNSUPPORTED_SCHEME, /* 5 */
39
- CURLUE_URLDECODE, /* 6 */
40
- CURLUE_OUT_OF_MEMORY, /* 7 */
41
- CURLUE_USER_NOT_ALLOWED, /* 8 */
42
- CURLUE_UNKNOWN_PART, /* 9 */
43
- CURLUE_NO_SCHEME, /* 10 */
44
- CURLUE_NO_USER, /* 11 */
45
- CURLUE_NO_PASSWORD, /* 12 */
46
- CURLUE_NO_OPTIONS, /* 13 */
47
- CURLUE_NO_HOST, /* 14 */
48
- CURLUE_NO_PORT, /* 15 */
49
- CURLUE_NO_QUERY, /* 16 */
50
- CURLUE_NO_FRAGMENT, /* 17 */
51
- CURLUE_NO_ZONEID, /* 18 */
52
- CURLUE_BAD_FILE_URL, /* 19 */
53
- CURLUE_BAD_FRAGMENT, /* 20 */
54
- CURLUE_BAD_HOSTNAME, /* 21 */
55
- CURLUE_BAD_IPV6, /* 22 */
56
- CURLUE_BAD_LOGIN, /* 23 */
57
- CURLUE_BAD_PASSWORD, /* 24 */
58
- CURLUE_BAD_PATH, /* 25 */
59
- CURLUE_BAD_QUERY, /* 26 */
60
- CURLUE_BAD_SCHEME, /* 27 */
61
- CURLUE_BAD_SLASHES, /* 28 */
62
- CURLUE_BAD_USER, /* 29 */
63
- CURLUE_LAST
64
- } CURLUcode;
65
-
66
- typedef enum {
67
- CURLUPART_URL,
68
- CURLUPART_SCHEME,
69
- CURLUPART_USER,
70
- CURLUPART_PASSWORD,
71
- CURLUPART_OPTIONS,
72
- CURLUPART_HOST,
73
- CURLUPART_PORT,
74
- CURLUPART_PATH,
75
- CURLUPART_QUERY,
76
- CURLUPART_FRAGMENT,
77
- CURLUPART_ZONEID /* added in 7.65.0 */
78
- } CURLUPart;
79
-
80
- #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */
81
- #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set,
82
- if the port number matches the
83
- default for the scheme */
84
- #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if
85
- missing */
86
- #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */
87
- #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */
88
- #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */
89
- #define CURLU_URLDECODE (1<<6) /* URL decode on get */
90
- #define CURLU_URLENCODE (1<<7) /* URL encode on set */
91
- #define CURLU_APPENDQUERY (1<<8) /* append a form style part */
92
- #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
93
- #define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
94
- scheme is unknown. */
95
- #define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */
96
-
97
- typedef struct Curl_URL CURLU;
98
-
99
- /*
100
- * curl_url() creates a new CURLU handle and returns a pointer to it.
101
- * Must be freed with curl_url_cleanup().
102
- */
103
- CURL_EXTERN CURLU *curl_url(void);
104
-
105
- /*
106
- * curl_url_cleanup() frees the CURLU handle and related resources used for
107
- * the URL parsing. It will not free strings previously returned with the URL
108
- * API.
109
- */
110
- CURL_EXTERN void curl_url_cleanup(CURLU *handle);
111
-
112
- /*
113
- * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
114
- * handle must also be freed with curl_url_cleanup().
115
- */
116
- CURL_EXTERN CURLU *curl_url_dup(CURLU *in);
117
-
118
- /*
119
- * curl_url_get() extracts a specific part of the URL from a CURLU
120
- * handle. Returns error code. The returned pointer MUST be freed with
121
- * curl_free() afterwards.
122
- */
123
- CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
124
- char **part, unsigned int flags);
125
-
126
- /*
127
- * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
128
- * error code. The passed in string will be copied. Passing a NULL instead of
129
- * a part string, clears that part.
130
- */
131
- CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
132
- const char *part, unsigned int flags);
133
-
134
- /*
135
- * curl_url_strerror() turns a CURLUcode value into the equivalent human
136
- * readable error string. This is useful for printing meaningful error
137
- * messages.
138
- */
139
- CURL_EXTERN const char *curl_url_strerror(CURLUcode);
140
-
141
- #ifdef __cplusplus
142
- } /* end of extern "C" */
143
- #endif
144
-
145
- #endif /* CURLINC_URLAPI_H */
@@ -1,30 +0,0 @@
1
- #define REQUEST_TLS_METHOD_THROW(env,className,methodName,reason) {\
2
- Napi::TypeError::New(env,StringFormat("Failed to execute '%s' on '%s': %s",methodName,className,reason)).ThrowAsJavaScriptException();\
3
- return (env).Undefined();\
4
- }
5
-
6
- #define REQUEST_TLS_METHOD_ARGS_CHECK(env,className,methodName,needLen,getLen) {\
7
- if (getLen != needLen){\
8
- Napi::TypeError::New(env,StringFormat("Failed to execute '%s' on '%s': %d arguments required, but only %d present.",methodName,className,needLen,getLen)).ThrowAsJavaScriptException();\
9
- return (env).Undefined();\
10
- }\
11
- }
12
-
13
- #define REQUEST_TLS_METHOD_ARGS_TOO_MUCH_CHECK(env,className,methodName,maxLen,getLen) {\
14
- if (getLen > maxLen){\
15
- Napi::TypeError::New(env,StringFormat("Failed to execute '%s' on '%s': maximum of %d arguments required, but only %d present.",methodName,className,maxLen,getLen)).ThrowAsJavaScriptException();\
16
- return (env).Undefined();\
17
- }\
18
- }
19
-
20
- #define REQUEST_TLS_METHOD_ARGS_NO_CONFIG(env,className,methodName,reqNums,getLen) {\
21
- Napi::TypeError::New(env,StringFormat("Failed to execute '%s' on '%s': [%s] arguments required, but only %d present.",methodName,className,reqNums,getLen)).ThrowAsJavaScriptException();\
22
- return (env).Undefined();\
23
- }
24
-
25
- #define REQUEST_TLS_METHOD_CHECK(env,condition,message) {\
26
- if (!(condition)){\
27
- Napi::TypeError::New(env,message).ThrowAsJavaScriptException();\
28
- return (env).Undefined();\
29
- }\
30
- }
@@ -1,23 +0,0 @@
1
- #include <string>
2
- #include <vector>
3
- #include <cstdarg>
4
- #include <assert.h>
5
- #include <stdio.h>
6
- #include <sstream>
7
- #include <iostream>
8
- #include <stdlib.h>
9
- #include <time.h>
10
- #include <memory>
11
- #include <mutex>
12
- #include <functional>
13
- #include <thread>
14
-
15
- std::vector<std::string> StringSplit(const std::string& str, const std::string& pattern);
16
- template<typename ... Args>
17
- std::string StringFormat(const std::string& format, Args ... args){
18
- size_t size = 1 + snprintf(nullptr, 0, format.c_str(), args ...); // Extra space for \0
19
- std::unique_ptr<char[]> bytes(new char[size]);
20
- // char bytes[size];
21
- snprintf(bytes.get(), size, format.c_str(), args ...);
22
- return std::string(bytes.get());
23
- }
@@ -1,43 +0,0 @@
1
- #include "utils.h"
2
-
3
- std::vector<std::string> StringSplit(const std::string& str, const std::string& pattern)
4
- {
5
- std::string::size_type pos;
6
- std::vector<std::string> result;
7
- std::string _str(str);
8
- _str += pattern;//��չ�ַ����Է������
9
- size_t size = _str.size();
10
- for (size_t i = 0; i < size; i++)
11
- {
12
- pos = _str.find(pattern, i);
13
- if (pos < size)
14
- {
15
- std::string s = _str.substr(i, pos - i);
16
- result.push_back(s);
17
- i = pos + pattern.size() - 1;
18
- }
19
- }
20
- return result;
21
- }
22
-
23
-
24
-
25
-
26
- // std::string StringFormat(const char* lpcszFormat, ...)
27
- // {
28
- // std::string strResult;
29
- // if (NULL != lpcszFormat)
30
- // {
31
- // va_list marker = {};
32
- // va_start(marker, lpcszFormat); //��ʼ����������
33
- // size_t nLength = vsnprintf(lpcszFormat, marker) + 1; //��ȡ��ʽ���ַ�������
34
- // std::vector<char> vBuffer(nLength, '\0'); //�������ڴ洢��ʽ���ַ������ַ�����
35
- // int nWritten = vsnprintf(&vBuffer[0], nLength, lpcszFormat, marker);
36
- // if (nWritten > 0)
37
- // {
38
- // strResult = &vBuffer[0];
39
- // }
40
- // va_end(marker); //��������
41
- // }
42
- // return strResult;
43
- // }