The name of the header to be set. This argument should not contain spaces, colons, linefeeds, or newlines
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
39The value for the header. This argument should not contain linefeeds or newlines
Description
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
40 chỉ định một tiêu đề yêu cầu HTTP sẽ được bao gồm trong yêu cầu được đưa ra bởi một cuộc gọi tiếp theo tới socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
41. Phương thức này chỉ có thể được gọi khi socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
42 là 1âi. e. , sau cuộc gọi tới socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
43 nhưng trước cuộc gọi tới socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
41Nếu tiêu đề có
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
45 được chỉ định đã được chỉ định, thì giá trị mới cho tiêu đề đó là giá trị được chỉ định trước đó, cộng với dấu phẩy, dấu cách và socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
39 được chỉ định trong cuộc gọi nàyNếu cuộc gọi tới
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
43 chỉ định thông tin đăng nhập ủy quyền, XMLHttpRequest sẽ tự động gửi một tiêu đề yêu cầu socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
451 thích hợp. Tuy nhiên, bạn có thể thêm vào tiêu đề này bằng socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
40. Tương tự, nếu trình duyệt web đã lưu trữ các cookie được liên kết với URL được chuyển đến socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
43, các tiêu đề thích hợp socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
454 hoặc socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
455 sẽ tự động được đưa vào yêu cầu. Bạn có thể thêm cookie bổ sung vào các tiêu đề này bằng cách gọi socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
40. XMLHttpRequest cũng có thể cung cấp giá trị mặc định cho tiêu đề socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
457. Nếu nó thực hiện điều này, bất kỳ giá trị nào bạn chỉ định cho tiêu đề đó sẽ được thêm vào giá trị mặc định Các giao diện HTTP trong Node. js được thiết kế để hỗ trợ nhiều tính năng của giao thức vốn rất khó sử dụng. Đặc biệt, các tin nhắn lớn, có thể được mã hóa theo đoạn. Giao diện cẩn thận để không bao giờ đệm toàn bộ yêu cầu hoặc phản hồi, vì vậy người dùng có thể truyền dữ liệu
HTTP message headers are represented by an object like this
{ 'content-length': '123',
'content-type': 'text/plain',
'connection': 'keep-alive',
'host': 'example.com',
'accept': '*/*' }
Keys are lowercased. Các giá trị không được sửa đổi
Để hỗ trợ đầy đủ các ứng dụng HTTP có thể, Node. js HTTP API ở mức rất thấp. Nó chỉ xử lý luồng và phân tích cú pháp tin nhắn. Nó phân tích một tin nhắn thành các tiêu đề và nội dung nhưng nó không phân tích các tiêu đề hoặc nội dung thực tế
Xem
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
0 để biết chi tiết về cách xử lý các tiêu đề trùng lặpCác tiêu đề thô khi chúng được nhận được giữ lại trong thuộc tính
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
1, là một mảng của socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
2. Ví dụ: đối tượng tiêu đề thư trước đó có thể có danh sách socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
1 như sau[ 'ConTent-Length', '123456',
'content-LENGTH', '123',
'content-type', 'text/plain',
'CONNECTION', 'keep-alive',
'Host', 'example.com',
'accepT', '*/*' ]
Lớp. socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
4#
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
Một
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
5 chịu trách nhiệm quản lý việc duy trì và tái sử dụng kết nối cho các máy khách HTTP. Nó duy trì một hàng đợi các yêu cầu đang chờ xử lý cho một máy chủ và cổng nhất định, sử dụng lại một kết nối ổ cắm cho mỗi cổng cho đến khi hàng đợi trống, tại thời điểm đó ổ cắm bị hủy hoặc đưa vào một nhóm nơi nó được giữ lại để sử dụng lại cho các yêu cầu . Nó bị hủy hay gộp lại tùy thuộc vào tùy chọn socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
6Các kết nối được gộp đã bật TCP Keep-Alive cho chúng, nhưng các máy chủ vẫn có thể đóng các kết nối không hoạt động, trong trường hợp đó, chúng sẽ bị xóa khỏi nhóm và một kết nối mới sẽ được tạo khi một yêu cầu HTTP mới được thực hiện cho máy chủ và cổng đó. Máy chủ cũng có thể từ chối cho phép nhiều yêu cầu trên cùng một kết nối, trong trường hợp đó, kết nối sẽ phải được tạo lại cho mọi yêu cầu và không thể gộp chung.
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
5 sẽ vẫn thực hiện các yêu cầu tới máy chủ đó, nhưng mỗi yêu cầu sẽ xảy ra trên một kết nối mớiKhi một kết nối bị đóng bởi máy khách hoặc máy chủ, nó sẽ bị xóa khỏi nhóm. Bất kỳ ổ cắm không sử dụng nào trong nhóm sẽ không được kiểm tra để không giữ lại Nút. js đang chạy khi không có yêu cầu chưa xử lý. [xem
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
8]Đó là một cách tốt để
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
9 phiên bản socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
5 khi nó không còn được sử dụng nữa, vì các ổ cắm không được sử dụng sẽ tiêu tốn tài nguyên hệ điều hànhỔ cắm bị xóa khỏi tác nhân khi ổ cắm phát ra sự kiện
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
31 hoặc sự kiện socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
32. Khi có ý định giữ một yêu cầu HTTP mở trong một thời gian dài mà không giữ nó trong tác nhân, có thể thực hiện một số thao tác như sauMột đại lý cũng có thể được sử dụng cho một yêu cầu cá nhân. Bằng cách cung cấp
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
33 như một tùy chọn cho các chức năng của socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
34 hoặc socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
35, một socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
5 sử dụng một lần với các tùy chọn mặc định sẽ được sử dụng cho kết nối máy kháchsocket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
37socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
38#
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
Lịch sửPhiên bảnThay đổiv15. 6. 0, v14. 17. 0
Thay đổi lịch trình mặc định từ 'fifo' thành 'lifo'
v14. 5. 0, v12. 20. 0Thêm tùy chọn
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
39 để chỉ định chiến lược lập lịch ổ cắm miễn phív14. 5. 0, v12. 19. 0Thêm tùy chọn
socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
20 vào hàm tạo tác nhânv0. 3. 4Đã thêm vào. v0. 3. 4
21 Tập hợp các tùy chọn có thể định cấu hình để đặt trên tác nhân. Có thể có các trường sausocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 Giữ các ổ cắm xung quanh ngay cả khi không có yêu cầu chưa giải quyết, để chúng có thể được sử dụng cho các yêu cầu trong tương lai mà không phải thiết lập lại kết nối TCP. Đừng nhầm lẫn với giá trịsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
23 của tiêu đềsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
24. Tiêu đềsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
25 luôn được gửi khi sử dụng một tác nhân trừ khi tiêu đềsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
24 được chỉ định rõ ràng hoặc khi các tùy chọnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
28 được đặt tương ứng thànhsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29 vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20, trong trường hợp đó,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21 sẽ được sử dụng. Mặc định.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
23 When using thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 option, specifies the initial delay for TCP Keep-Alive packets. Bị bỏ qua khi tùy chọnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29 hoặcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
27. Mặc định.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
28socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
28 Số lượng ổ cắm tối đa cho phép trên mỗi máy chủ. Nếu cùng một máy chủ mở nhiều kết nối đồng thời, mỗi yêu cầu sẽ sử dụng ổ cắm mới cho đến khi đạt được giá trịsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
28. Nếu máy chủ cố gắng mở nhiều kết nối hơnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
28, các yêu cầu bổ sung sẽ nhập vào hàng đợi yêu cầu đang chờ xử lý và sẽ chuyển sang trạng thái kết nối hoạt động khi kết nối hiện có chấm dứt. Điều này đảm bảo rằng có tối đa 228 kết nối đang hoạt động tại bất kỳ thời điểm nào, từ một máy chủ nhất định. Mặc định.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20 Tổng số ổ cắm tối đa được phép cho tất cả các máy chủ. Mỗi yêu cầu sẽ sử dụng một ổ cắm mới cho đến khi đạt đến mức tối đa. Mặc định.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
86 Số lượng ổ cắm tối đa trên mỗi máy chủ để mở ở trạng thái tự do. Chỉ phù hợp nếusocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 được đặt thànhsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88. Mặc định.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
89socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
39 Chiến lược lập lịch trình để áp dụng khi chọn ổ cắm miễn phí tiếp theo để sử dụng. Nó có thể làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31 hoặc[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
32. Sự khác biệt chính giữa hai chiến lược lập lịch là ________ 532 chọn ổ cắm được sử dụng gần đây nhất, trong khi ________ 531 chọn ổ cắm ít được sử dụng gần đây nhất. Trong trường hợp tốc độ yêu cầu mỗi giây thấp, lập lịch trình[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
32 sẽ giảm rủi ro chọn một ổ cắm có thể đã bị đóng bởi máy chủ do không hoạt động. Trong trường hợp tốc độ yêu cầu mỗi giây cao, lịch trình[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31 sẽ tối đa hóa số lượng ổ cắm đang mở, trong khi lịch trình[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
32 sẽ giữ nó ở mức thấp nhất có thể. Default.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
32[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
39 Socket timeout in milliseconds. Điều này sẽ đặt thời gian chờ khi ổ cắm được tạo[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
21 trongsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31 cũng được hỗ trợsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
32 mặc định được sử dụng bởisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
35 có tất cả các giá trị này được đặt thành giá trị mặc định tương ứng của chúngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Để định cấu hình bất kỳ phiên bản nào trong số chúng, phải tạo một phiên bản
4 tùy chỉnhsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
7socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
35#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Produces a socket/stream to be used for HTTP requests
Theo mặc định, chức năng này giống như
36. However, custom agents may override this method in case greater flexibility is desiredsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
A socket/stream can be supplied in one of two ways. by returning the socket/stream from this function, or by passing the socket/stream to
37socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This method is guaranteed to return an instance of the class, a subclass of , unless the user specifies a socket type other than
37 has a signature ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
39socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
00#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Called when
01 is detached from a request and could be persisted by the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
5. Default behavior is tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This method can be overridden by a particular
5 subclass. If this method returns a falsy value, the socket will be destroyed instead of persisting it for use with the next requestsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
01 argument can be an instance of , a subclass of[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
05#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Called when
01 is attached to[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
07 after being persisted because of the keep-alive options. Default behavior is to[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
3socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This method can be overridden by a particular
5 subclasssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
01 argument can be an instance of , a subclass of[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
10#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Destroy any sockets that are currently in use by the agent
It is usually not necessary to do this. However, if using an agent with
6 enabled, then it is best to explicitly shut down the agent when it is no longer needed. Mặt khác, các ổ cắm có thể vẫn mở trong một thời gian khá dài trước khi máy chủ kết thúc chúngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
12#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
HistoryVersionChangesv16. 0. 0
The property now has a
13 prototypev0. 11. 4[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v0. 11. 4
An object which contains arrays of sockets currently awaiting use by the agent when
6 is enabled. Do not modifysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Sockets in the
15 list will be automatically destroyed and removed from the array on[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
16[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
17#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
HistoryVersionChangesv17. 7. 0, v16. 15. 0
The
21 parameter is now optionalv0. 11. 4socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v0. 11. 4
21 A set of options providing information for name generationsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20 A domain name or IP address of the server to issue the request to[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
21 Port of remote server[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
22 Local interface to bind for network connections when issuing the request[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
23 Must be 4 or 6 if this doesn't equal[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
27socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- Returns.
Get a unique name for a set of request options, to determine whether a connection can be reused. For an HTTP agent, this returns
25 or[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
26. For an HTTPS agent, the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options that determine socket reusability[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
27#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
By default set to 256. For agents with
6 enabled, this sets the maximum number of sockets that will be left open in the free statesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
By default set to
20. Determines how many concurrent sockets the agent can have open per origin. Origin is the returned value ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
32#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v14. 5. 0, v12. 19. 0
By default set to
20. Determines how many concurrent sockets the agent can have open. Unlikesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
28, this parameter applies across all originssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
35#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
HistoryVersionChangesv16. 0. 0
The property now has a
13 prototypev0. 5. 9[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v0. 5. 9
An object which contains queues of requests that have not yet been assigned to sockets. Do not modify
37#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
HistoryVersionChangesv16. 0. 0
The property now has a
13 prototypev0. 3. 6[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v0. 3. 6
An object which contains arrays of sockets currently in use by the agent. Do not modify
Class.
39#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đối tượng này được tạo nội bộ và được trả về từ
35. It represents an in-progress request whose header has already been queued. The header is still mutable using thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
41,[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
42,[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
43 API. The actual header will be sent along with the first data chunk or when calling[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
44[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
To get the response, add a listener for
45 to the request object.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45 will be emitted from the request object when the response headers have been received. The[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45 event is executed with one argument which is an instance of[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
48[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
During the
45 event, one can add listeners to the response object; particularly to listen for the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 event[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
If no
45 handler is added, then the response will be entirely discarded. However, if a[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45 event handler is added, then the data from the response object must be consumed, either by calling[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
53 whenever there is a[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
54 event, or by adding a[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 handler, or by calling the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
56 method. Until the data is consumed, the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
57 event will not fire. Also, until the data is read it will consume memory that can eventually lead to a 'process out of memory' error[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
For backward compatibility,
58 will only emit[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 if there is an[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 listener registered[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đặt tiêu đề
61 để giới hạn kích thước nội dung phản hồi. Mismatching the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
61 header value will result in an [[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
63][] being thrown, identified by[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
64[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
65[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
61 value should be in bytes, not characters. Use[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
67 to determine the length of the body in bytes[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
68#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v1. 4. 1Deprecated since. v17. 0. 0, v16. 12. 0
Stability. 0 - Deprecated. Listen for the
31 event insteadsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Emitted when the request has been aborted by the client. This event is only emitted on the first call to
70[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
31#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Indicates that the request is completed, or its underlying connection was terminated prematurely [before the response completion]
Event.
72#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted each time a server responds to a request with a
73 method. If this event is not being listened for, clients receiving a[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
73 method will have their connections closed[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
A client and server pair demonstrating how to listen for the
72 event[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
76#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted when the server sends a '100 Continue' HTTP response, usually because the request contained 'Expect. 100-continue'. This is an instruction that the client should send the request body
Event.
77#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted when the request has been sent. More specifically, this event is emitted when the last segment of the response headers and body have been handed off to the operating system for transmission over the network. It does not imply that the server has received anything yet
Event.
78#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted when the server sends a 1xx intermediate response [excluding 101 Upgrade]. Người nghe của sự kiện này sẽ nhận được một đối tượng chứa phiên bản HTTP, mã trạng thái, thông báo trạng thái, đối tượng tiêu đề khóa-giá trị và mảng có tên tiêu đề thô theo sau là giá trị tương ứng của chúng
101 Upgrade statuses do not fire this event due to their break from the traditional HTTP request/response chain, such as web sockets, in-place TLS upgrades, or HTTP 2. 0. To be notified of 101 Upgrade notices, listen for the
79 event instead[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
45#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted when a response is received to this request. This event is emitted only once
Event.
81#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
Event.
16[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted when the underlying socket times out from inactivity. This only notifies that the socket has been idle. The request must be destroyed manually
See also.
83[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
79#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted each time a server responds to a request with an upgrade. If this event is not being listened for and the response status code is 101 Switching Protocols, clients receiving an upgrade header will have their connections closed
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
A client server pair demonstrating how to listen for the
79 event[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
86#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v0. 3. 8Deprecated since. v14. 1. 0, v13. 14. 0
Đánh dấu yêu cầu là hủy bỏ. Gọi điều này sẽ khiến dữ liệu còn lại trong phản hồi bị hủy và ổ cắm bị hủy
87#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Lịch sửPhiên bảnThay đổiv17. 0. 0, v16. 12. 0
Không dùng nữa kể từ. v17. 0. 0, v16. 12. 0
v11. 0. 0Thuộc tính
88 không còn là số dấu thời gianv0. 11. 14[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v0. 11. 14
The
87 property will be[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
88 if the request has been abortedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
91#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v0. 3. 0Deprecated since. v13. 0. 0
Xem
92[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
93#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Added in. v13. 2. 0, v12. 16. 0
Xem
94[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
95#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Lịch sửPhiên bảnThay đổiv15. 0. 0
Tham số
96 bây giờ có thể là một[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
97v10. 0. 0[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Phương thức này bây giờ trả về một tham chiếu tới
98v0. 1. 90[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đã thêm vào. v0. 1. 90
Kết thúc gửi yêu cầu. Nếu bất kỳ bộ phận nào của cơ thể không được gửi, nó sẽ xả chúng vào luồng. Nếu yêu cầu được chunked, điều này sẽ gửi kết thúc
99[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Nếu chỉ định
96, nó tương đương với việc gọi[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
701 theo sau làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
702socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu
37 được chỉ định, nó sẽ được gọi khi luồng yêu cầu kết thúcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
704#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnChangesv14. 5. 0
Hàm trả về
705 để thống nhất với các luồng Có thể đọc khácv0. 3. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 3. 0
706 Tùy chọn, một lỗi phát ra với sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
59[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- Returns.
Hủy yêu cầu. Tùy chọn phát ra sự kiện
59 và phát ra sự kiện[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31. Gọi điều này sẽ khiến dữ liệu còn lại trong phản hồi bị hủy và ổ cắm bị hủysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xem
710 để biết thêm chi tiếtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
711#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v14. 1. 0, v13. 14. 0
Là
88 sau khisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
713 đã được gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xem
714 để biết thêm chi tiếtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
715#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 0. 1Deprecated since. v13. 4. 0, v12. 16. 0
Thuộc tính
715 sẽ làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 nếusocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
44 đã được gọi.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
44 sẽ tự động được gọi nếu yêu cầu được bắt đầu thông qua[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
34socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
721socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xóa các tiêu đề yêu cầu
Vì lý do hiệu quả, Node. js thường đệm các tiêu đề yêu cầu cho đến khi
44 được gọi hoặc đoạn đầu tiên của dữ liệu yêu cầu được ghi. Sau đó, nó sẽ cố gắng đóng gói các tiêu đề và dữ liệu của yêu cầu vào một gói TCP duy nhất[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Điều đó thường được mong muốn [nó tiết kiệm một chuyến đi khứ hồi TCP], nhưng không phải khi dữ liệu đầu tiên không được gửi cho đến khi có thể rất lâu sau đó.
721 bỏ qua tối ưu hóa và bắt đầu yêu cầusocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
724socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đọc tiêu đề theo yêu cầu. Tên không phân biệt chữ hoa chữ thường. Loại giá trị trả về phụ thuộc vào các đối số được cung cấp cho
725socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
726socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một mảng chứa các tên duy nhất của các tiêu đề gửi đi hiện tại. Tất cả các tên tiêu đề là chữ thường
727socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một bản sao nông của các tiêu đề gửi đi hiện tại. Vì một bản sao nông được sử dụng, các giá trị mảng có thể bị thay đổi mà không cần gọi thêm các phương thức mô-đun http liên quan đến tiêu đề khác nhau. Các khóa của đối tượng được trả về là tên tiêu đề và các giá trị là giá trị tiêu đề tương ứng. Tất cả các tên tiêu đề là chữ thường
Đối tượng được trả về bởi phương thức
727 không kế thừa nguyên mẫu từ JavaScriptsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
729. Điều này có nghĩa là các phương thứcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
729 điển hình nhưsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
731,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
732 và các phương thức khác không được xác định và sẽ không hoạt độngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
733socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v15. 13. 0, v14. 17. 0
Trả về một mảng chứa các tên duy nhất của các tiêu đề thô gửi đi hiện tại. Tên tiêu đề được trả về với cách viết hoa chính xác của chúng được đặt
734socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về
88 nếu tiêu đề được xác định bởisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
736 hiện được đặt trong tiêu đề gửi đi. Khớp tên tiêu đề không phân biệt chữ hoa chữ thườngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
2socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
737socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Giới hạn số lượng tiêu đề phản hồi tối đa. Nếu được đặt thành 0, sẽ không có giới hạn nào được áp dụng
738#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
739#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
740#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v14. 5. 0, v12. 19. 0
741#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v14. 5. 0, v12. 19. 0
742socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xóa tiêu đề đã được xác định trong đối tượng tiêu đề
2socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
743#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v13. 0. 0, v12. 16. 0
- Liệu yêu cầu có được gửi qua một ổ cắm được sử dụng lại hay không
Khi gửi yêu cầu thông qua tác nhân được kích hoạt liên tục, ổ cắm bên dưới có thể được sử dụng lại. Nhưng nếu máy chủ đóng kết nối vào thời điểm không may, máy khách có thể gặp lỗi 'ECONNRESET'
Bằng cách đánh dấu một yêu cầu cho dù nó có sử dụng lại ổ cắm hay không, chúng tôi có thể thực hiện thử lại lỗi tự động dựa trên nó
744socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đặt một giá trị tiêu đề duy nhất cho đối tượng tiêu đề. Nếu tiêu đề này đã tồn tại trong các tiêu đề được gửi, giá trị của nó sẽ được thay thế. Sử dụng một chuỗi các chuỗi ở đây để gửi nhiều tiêu đề có cùng tên. Các giá trị không phải chuỗi sẽ được lưu trữ mà không sửa đổi. Do đó,
745 có thể trả về các giá trị không phải chuỗi. Tuy nhiên, các giá trị không phải chuỗi sẽ được chuyển đổi thành chuỗi để truyền qua mạngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
8socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
hoặc
3[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Khi giá trị là một chuỗi, một ngoại lệ sẽ được đưa ra nếu nó chứa các ký tự bên ngoài mã hóa
746socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu bạn cần chuyển các ký tự UTF-8 vào giá trị, vui lòng mã hóa giá trị bằng tiêu chuẩn RFC 8187
3socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
747#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi một ổ cắm được gán cho yêu cầu này và được kết nối,
748 sẽ được gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
749#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi một ổ cắm được gán cho yêu cầu này và được kết nối,
750 sẽ được gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
751socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnChangesv9. 0. 0
Chỉ đặt thời gian chờ của ổ cắm một cách nhất quán khi ổ cắm được kết nối
v0. 5. 9Added in. v0. 5. 9
39 Mili giây trước khi yêu cầu hết thời gian chờ[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
37 Chức năng tùy chọn được gọi khi hết thời gian chờ. Tương tự như ràng buộc với sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
16[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- Returns.
Khi một ổ cắm được gán cho yêu cầu này và được kết nối,
755 sẽ được gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
92#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Tham chiếu đến ổ cắm bên dưới. Thông thường người dùng sẽ không muốn truy cập thuộc tính này. Cụ thể, ổ cắm sẽ không phát ra các sự kiện
54 do cách trình phân tích cú pháp giao thức gắn vào ổ cắm[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Thuộc tính này được đảm bảo là một thể hiện của lớp, lớp con của , trừ khi người dùng chỉ định loại ổ cắm khác với
758#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v13. 2. 0, v12. 16. 0
Xem
759socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
760#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Là
88 sau khisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
44 đã được gọi. Thuộc tính này không cho biết liệu dữ liệu đã được xóa hay chưa, thay vào đó, hãy sử dụng[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
763socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
763#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Là
88 nếu tất cả dữ liệu đã được chuyển sang hệ thống bên dưới, ngay trước khi sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
77 được phát ra[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
767#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv15. 0. 0
Tham số
768 bây giờ có thể là mộtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
97v0. 1. 29[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đã thêm vào. v0. 1. 29
Gửi một đoạn cơ thể. Phương thức này có thể được gọi nhiều lần. Nếu không đặt
61, dữ liệu sẽ tự động được mã hóa bằng mã hóa chuyển HTTP Chunked, để máy chủ biết khi nào dữ liệu kết thúc. Tiêu đề[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
771 được thêm vào. Gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
44 là cần thiết để hoàn tất việc gửi yêu cầu[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đối số
773 là tùy chọn và chỉ áp dụng khisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
768 là một chuỗi. Mặc định làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
775socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đối số
37 là tùy chọn và sẽ được gọi khi đoạn dữ liệu này bị xóa, nhưng chỉ khi đoạn dữ liệu này không trốngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về
88 nếu toàn bộ dữ liệu đã được xóa thành công vào bộ đệm kernel. Trả vềsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29 nếu tất cả hoặc một phần dữ liệu được xếp hàng đợi trong bộ nhớ người dùng.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
779 sẽ được phát ra khi bộ đệm trống trở lạisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi hàm
780 được gọi với chuỗi rỗng hoặc bộ đệm, nó không làm gì cả và đợi thêm đầu vàosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lớp.
781#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Biến cố.
782#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Được phát ra mỗi khi nhận được yêu cầu có HTTP
783. Nếu sự kiện này không được lắng nghe, máy chủ sẽ tự động phản hồi bằng mộtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
784 khi thích hợpsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xử lý sự kiện này liên quan đến việc gọi
785 nếu máy khách tiếp tục gửi nội dung yêu cầu hoặc tạo phản hồi HTTP thích hợp [e. g. 400 Bad Request] nếu khách hàng không nên tiếp tục gửi phần thân yêu cầusocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi sự kiện này được phát ra và xử lý, sự kiện
786 sẽ không được phát rasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Biến cố.
787#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Được phát ra mỗi khi nhận được yêu cầu có tiêu đề HTTP
788, trong đó giá trị không phải làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
789. Nếu sự kiện này không được lắng nghe, máy chủ sẽ tự động phản hồi bằngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
790 khi thích hợpsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi sự kiện này được phát ra và xử lý, sự kiện
786 sẽ không được phát rasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Biến cố.
792#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnChangesv12. 0. 0
Hành vi mặc định sẽ trả về Trường tiêu đề yêu cầu 431 quá lớn nếu xảy ra lỗi HPE_HEADER_OVERFLOW
v9. 4. 0
793 là bộ đệm hiện tại vừa phân tích cú pháp. Việc thêm bộ đệm này vào đối tượng lỗi của sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
792 là để các nhà phát triển có thể ghi lại gói bị hỏngv6. 0. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The default action of calling
795 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
01 will no longer take place if there are listeners attached for[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
792v0. 1. 94socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 94
Nếu kết nối máy khách phát ra sự kiện
59, nó sẽ được chuyển tiếp tới đây. Người nghe sự kiện này chịu trách nhiệm đóng/hủy ổ cắm bên dưới. Ví dụ: một người có thể muốn đóng ổ cắm một cách duyên dáng hơn bằng phản hồi HTTP tùy chỉnh thay vì đột ngột cắt đứt kết nối[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
Hành vi mặc định là thử đóng socket với HTTP '400 Bad Request' hoặc HTTP '431 Request Header Fields Too Large' trong trường hợp xảy ra lỗi
799. If the socket is not writable or headers of the current attachedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
00 has been sent, it is immediately destroyedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
01 is the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
02 object that the error originated fromsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
0[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
When the
792 event occurs, there is nosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
07 or[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
05 object, so any HTTP response sent, including response headers and payload, must be written directly to thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
01 object. Care must be taken to ensure the response is a properly formatted HTTP response message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
07 is an instance ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
63 with two extra columns[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
09. số byte của gói yêu cầu mà Nút. js có thể đã phân tích cú pháp chính xác;socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
793. the raw packet of current requestsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trong một số trường hợp, máy khách đã nhận được phản hồi và/hoặc ổ cắm đã bị hủy, như trong trường hợp lỗi
11. Before trying to send data to the socket, it is better to check that it is still writablesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
1[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
31#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Phát ra khi máy chủ đóng
Event.
72#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Được phát ra mỗi khi khách hàng yêu cầu phương thức HTTP
73. Nếu sự kiện này không được lắng nghe, thì các máy khách yêu cầu phương thức[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
73 sẽ bị đóng kết nối[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
After this event is emitted, the request's socket will not have a
50 event listener, meaning it will need to be bound in order to handle data sent to the server on that socket[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Event.
17#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Sự kiện này được phát ra khi một luồng TCP mới được thiết lập.
01 thường là một đối tượng kiểu[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
02. Usually users will not want to access this event. Cụ thể, ổ cắm sẽ không phát ra các sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
54 do cách trình phân tích cú pháp giao thức gắn vào ổ cắm.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
01 cũng có thể được truy cập tại[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
92[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
This event can also be explicitly emitted by users to inject connections into the HTTP server. Trong trường hợp đó, bất kỳ luồng
23 nào cũng có thể được thông quasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu
755 được gọi ở đây, thời gian chờ sẽ được thay thế bằngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
25 khi ổ cắm đã phục vụ yêu cầu [nếusocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
25 khác 0]socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
Event.
27#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v18. 7. 0, v16. 17. 0
When the number of requests on a socket reaches the threshold of
28, the server will drop new requests and emitsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
27 event instead, then sendsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
30 to clientsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Biến cố.
786#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Phát ra mỗi khi có yêu cầu. Có thể có nhiều yêu cầu cho mỗi kết nối [trong trường hợp kết nối HTTP Keep-Alive]
Event.
79#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Lịch sửPhiên bảnThay đổiv10. 0. 0
Not listening to this event no longer causes the socket to be destroyed if a client sends an Upgrade header
v0. 1. 94Đã thêm vào. v0. 1. 94
Emitted each time a client requests an HTTP upgrade. Lắng nghe sự kiện này là tùy chọn và khách hàng không thể yêu cầu thay đổi giao thức
After this event is emitted, the request's socket will not have a
50 event listener, meaning it will need to be bound in order to handle data sent to the server on that socket[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than
34#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv19. 0. 0
Phương thức đóng các kết nối nhàn rỗi trước khi quay lại
v0. 1. 90Đã thêm vào. v0. 1. 90
Stops the server from accepting new connections and closes all connections connected to this server which are not sending a request or waiting for a response. Xem
35socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
36#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Closes all connections connected to this server
37#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Closes all connections connected to this server which are not sending a request or waiting for a response
38socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v11. 3. 0, v10. 14. 0
Giới hạn lượng thời gian trình phân tích cú pháp sẽ đợi để nhận được các tiêu đề HTTP hoàn chỉnh
Nếu hết thời gian chờ, máy chủ sẽ phản hồi với trạng thái 408 mà không chuyển tiếp yêu cầu tới người nghe yêu cầu và sau đó đóng kết nối
It must be set to a non-zero value [e. g. 120 seconds] to protect against potential Denial-of-Service attacks in case the server is deployed without a reverse proxy in front
39#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Starts the HTTP server listening for connections. This method is identical to
39 fromsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
41socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
42#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- Indicates whether or not the server is listening for connections
43socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Limits maximum incoming headers count. If set to 0, no limit will be applied
44socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv18. 0. 0
The default request timeout changed from no timeout to 300s [5 minutes]
v14. 11. 0Added in. v14. 11. 0
Sets the timeout value in milliseconds for receiving the entire request from the client
Nếu hết thời gian chờ, máy chủ sẽ phản hồi với trạng thái 408 mà không chuyển tiếp yêu cầu tới người nghe yêu cầu và sau đó đóng kết nối
It must be set to a non-zero value [e. g. 120 seconds] to protect against potential Denial-of-Service attacks in case the server is deployed without a reverse proxy in front
45socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv13. 0. 0
The default timeout changed from 120s to 0 [no timeout]
v0. 9. 12Added in. v0. 9. 12
Đặt giá trị thời gian chờ cho ổ cắm và phát ra sự kiện
16 trên đối tượng Máy chủ, chuyển ổ cắm dưới dạng đối số, nếu hết thời gian chờ xảy ra[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
If there is a
16 event listener on the Server object, then it will be called with the timed-out socket as an argument[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
By default, the Server does not timeout sockets. Tuy nhiên, nếu một cuộc gọi lại được chỉ định cho sự kiện
16 của Máy chủ, thời gian chờ phải được xử lý rõ ràng[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
28#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- Yêu cầu trên mỗi ổ cắm. Mặc định. 0 [không giới hạn]
The maximum number of requests socket can handle before closing keep alive connection
A value of
50 will disable the limitsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi đạt đến giới hạn, nó sẽ đặt giá trị tiêu đề
24 thànhsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
52, nhưng sẽ không thực sự đóng kết nối, các yêu cầu tiếp theo được gửi sau khi đạt đến giới hạn sẽ nhận được phản hồisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
53socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
54socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv13. 0. 0
The default timeout changed from 120s to 0 [no timeout]
v0. 9. 12Added in. v0. 9. 12
- Timeout in milliseconds. Mặc định. 0 [không có thời gian chờ]
The number of milliseconds of inactivity before a socket is presumed to have timed out
A value of
50 will disable the timeout behavior on incoming connectionssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections
25socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- Timeout in milliseconds. Mặc định.
57 [5 giây]socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed. Nếu máy chủ nhận được dữ liệu mới trước khi hết thời gian chờ duy trì, nó sẽ đặt lại thời gian chờ không hoạt động thông thường, tôi. e. ,
54socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
A value of
50 will disable the keep-alive timeout behavior on incoming connections. Giá trị củasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
50 làm cho máy chủ http hoạt động tương tự như Node. js trước 8. 0. 0, which did not have a keep-alive timeoutsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections
Lớp.
00#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đối tượng này được tạo bên trong bởi một máy chủ HTTP, không phải bởi người dùng. Nó được truyền dưới dạng tham số thứ hai cho sự kiện
786socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Event.
31#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Cho biết rằng phản hồi đã hoàn thành hoặc kết nối cơ bản của nó đã bị chấm dứt sớm [trước khi hoàn thành phản hồi]
Event.
77#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Phát ra khi phản hồi đã được gửi. More specifically, this event is emitted when the last segment of the response headers and body have been handed off to the operating system for transmission over the network. Nó không có nghĩa là khách hàng đã nhận được bất cứ điều gì
65socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This method adds HTTP trailing headers [a header but at the end of the message] to the response
Trailers will only be emitted if chunked encoding is used for the response; if it is not [e. g. nếu yêu cầu là HTTP/1. 0], chúng sẽ bị loại bỏ một cách âm thầm
HTTP requires the
66 header to be sent in order to emit trailers, with a list of the header fields in its value. e. g. ,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
2[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Việc cố gắng đặt tên hoặc giá trị trường tiêu đề chứa các ký tự không hợp lệ sẽ dẫn đến việc ném
67socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
68#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v0. 3. 0Deprecated since. v13. 0. 0
See
69socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
70#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v13. 2. 0, v12. 16. 0
Xem
94[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
72#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv15. 0. 0
Tham số
96 bây giờ có thể là một[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
97v10. 0. 0[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Phương thức này bây giờ trả về một tham chiếu tới
75v0. 1. 90socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 90
Phương pháp này báo hiệu cho máy chủ rằng tất cả các tiêu đề và nội dung phản hồi đã được gửi; . Phương thức,
76, PHẢI được gọi trên mỗi phản hồisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
If
96 is specified, it is similar in effect to calling[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
78 followed bysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
79socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu
37 được chỉ định, nó sẽ được gọi khi luồng phản hồi kết thúcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
81#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 0. 2Không dùng nữa kể từ đó. v13. 4. 0, v12. 16. 0
Thuộc tính
81 sẽ làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 nếusocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
76 đã được gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
85socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xóa các tiêu đề phản hồi. Xem thêm.
721socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
87socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Reads out a header that's already been queued but not sent to the client. Tên không phân biệt chữ hoa chữ thường. Loại giá trị trả về phụ thuộc vào các đối số được cung cấp cho
88socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
89socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một mảng chứa các tên duy nhất của các tiêu đề gửi đi hiện tại. Tất cả các tên tiêu đề là chữ thường
90socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một bản sao nông của các tiêu đề gửi đi hiện tại. Vì một bản sao nông được sử dụng, các giá trị mảng có thể bị thay đổi mà không cần gọi thêm các phương thức mô-đun http liên quan đến tiêu đề khác nhau. Các khóa của đối tượng được trả về là tên tiêu đề và các giá trị là giá trị tiêu đề tương ứng. Tất cả các tên tiêu đề là chữ thường
Đối tượng được trả về bởi phương thức
90 không kế thừa nguyên mẫu từ JavaScriptsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
729. This means that typicalsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
729 methods such assocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
731,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
732, and others are not defined and will not worksocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
96socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về
88 nếu tiêu đề được xác định bởisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
736 hiện được đặt trong tiêu đề gửi đi. Khớp tên tiêu đề không phân biệt chữ hoa chữ thườngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
3[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
99socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Boolean [read-only]. Đúng nếu tiêu đề đã được gửi, sai nếu không
300socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Removes a header that's queued for implicit sending
4[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
301#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
A reference to the original HTTP
07 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
303socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Mặc định là true
This should only be disabled for testing; HTTP requires the Date header in responses
304socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về đối tượng phản hồi
Sets a single header value for implicit headers. Nếu tiêu đề này đã tồn tại trong các tiêu đề được gửi, giá trị của nó sẽ được thay thế. Use an array of strings here to send multiple headers with the same name. Non-string values will be stored without modification. Therefore,
305 may return non-string values. Tuy nhiên, các giá trị không phải chuỗi sẽ được chuyển đổi thành chuỗi để truyền qua mạng. The same response object is returned to the caller, to enable call chainingsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
5[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
hoặc
6[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Việc cố gắng đặt tên hoặc giá trị trường tiêu đề chứa các ký tự không hợp lệ sẽ dẫn đến việc ném
67socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
When headers have been set with
88, they will be merged with any headers passed tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
308, with the headers passed tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
308 given precedencesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu phương thức
308 được gọi và phương thức này chưa được gọi, nó sẽ ghi trực tiếp các giá trị tiêu đề được cung cấp vào kênh mạng mà không lưu vào bộ nhớ đệm bên trong vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
305 trên tiêu đề sẽ không mang lại kết quả như mong đợi. If progressive population of headers is desired with potential future retrieval and modification, usesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 instead ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
308socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
314socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đặt giá trị thời gian chờ của Ổ cắm thành
315. If a callback is provided, then it is added as a listener on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
16 event on the response object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Nếu không có trình nghe
16 nào được thêm vào yêu cầu, phản hồi hoặc máy chủ, thì ổ cắm sẽ bị hủy khi hết thời gian chờ. If a handler is assigned to the request, the response, or the server's[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
16 events, timed out sockets must be handled explicitly[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
69#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Reference to the underlying socket. Thông thường người dùng sẽ không muốn truy cập thuộc tính này. In particular, the socket will not emit
54 events because of how the protocol parser attaches to the socket. Sau[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
76, thuộc tính không có giá trịsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
7[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Thuộc tính này được đảm bảo là một thể hiện của lớp, lớp con của , trừ khi người dùng chỉ định loại ổ cắm khác với
322#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Khi sử dụng các tiêu đề ẩn [không gọi rõ ràng
308], thuộc tính này kiểm soát mã trạng thái sẽ được gửi tới máy khách khi các tiêu đề bị xóasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
8[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Sau khi tiêu đề phản hồi được gửi đến máy khách, thuộc tính này cho biết mã trạng thái đã được gửi đi
324#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
When using implicit headers [not calling
308 explicitly], this property controls the status message that will be sent to the client when the headers get flushed. If this is left assocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
27 then the standard message for the status code will be usedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
9[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
After response header was sent to the client, this property indicates the status message which was sent out
327#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v13. 2. 0, v12. 16. 0
Xem
759socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
329#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Là
88 sau khisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
76 được gọi. Thuộc tính này không cho biết liệu dữ liệu đã được xóa hay chưa, thay vào đó, hãy sử dụngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
332socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
332#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Là
88 nếu tất cả dữ liệu đã được chuyển sang hệ thống bên dưới, ngay trước khi sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
77 được phát ra[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
336#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv15. 0. 0
Tham số
768 bây giờ có thể là mộtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
97v0. 1. 29[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đã thêm vào. v0. 1. 29
If this method is called and
308 has not been called, it will switch to implicit header mode and flush the implicit headerssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This sends a chunk of the response body. Phương pháp này có thể được gọi nhiều lần để cung cấp các phần liên tiếp của cơ thể
Trong mô-đun
340, nội dung phản hồi bị bỏ qua khi yêu cầu là yêu cầu HEAD. Tương tự, phản hồisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
341 vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
342 không được bao gồm nội dung thưsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
768 can be a string or a buffer. Ifsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
768 is a string, the second parameter specifies how to encode it into a byte stream.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
37 sẽ được gọi khi đoạn dữ liệu này bị xóasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đây là phần thân HTTP thô và không liên quan gì đến mã hóa phần thân nhiều phần cấp cao hơn có thể được sử dụng
Lần đầu tiên
346 được gọi, nó sẽ gửi thông tin tiêu đề được đệm và đoạn đầu tiên của phần thân cho máy khách. The second timesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
346 is called, Node. js assumes data will be streamed, and sends the new data separately. Nghĩa là, phản hồi được đệm đến đoạn đầu tiên của nội dungsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về
88 nếu toàn bộ dữ liệu đã được xóa thành công vào bộ đệm kernel. Trả vềsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29 nếu tất cả hoặc một phần dữ liệu được xếp hàng đợi trong bộ nhớ người dùng.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
779 sẽ được phát ra khi bộ đệm trống trở lạisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
785#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Gửi một HTTP/1. 1 100 Tin nhắn tiếp tục tới máy khách, cho biết rằng nội dung yêu cầu sẽ được gửi. See the
782 event onsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
353socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
354#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv18. 11. 0
Cho phép chuyển gợi ý dưới dạng đối tượng
v18. 11. 0Đã thêm vào. v18. 11. 0
Gửi một HTTP/1. 1 103 Thông báo Gợi ý sớm tới máy khách với tiêu đề Liên kết, cho biết rằng tác nhân người dùng có thể tải trước/kết nối trước các tài nguyên được liên kết.
355 là một đối tượng chứa các giá trị của các tiêu đề được gửi cùng với thông báo gợi ý sớm. Đối số tùy chọnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
37 sẽ được gọi khi thông báo phản hồi đã được viếtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Thí dụ
70socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
357socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv14. 14. 0
Allow passing headers as an array
v11. 10. 0, v10. 17. 0Return
705 fromsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
359 to allow chaining withsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
360v5. 11. 0, v4. 4. 5socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
A
361 is thrown ifsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
362 is not a number in the rangesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
363v0. 1. 30socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 30
Sends a response header to the request. The status code is a 3-digit HTTP status code, like
364. The last argument,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
365, are the response headers. Theo tùy chọn, người ta có thể đưa ra một con người có thể đọc đượcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
366 làm đối số thứ haisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
365 may be ansocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
368 where the keys and values are in the same list. Nó không phải là một danh sách các bộ dữ liệu. So, the even-numbered offsets are key values, and the odd-numbered offsets are the associated values. The array is in the same format assocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
369socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một tham chiếu đến
75, để các cuộc gọi có thể được xâu chuỗisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
71socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This method must only be called once on a message and it must be called before
76 is calledsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu
346 hoặcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
76 được gọi trước khi gọi hàm này, các tiêu đề ẩn/có thể thay đổi sẽ được tính toán và gọi hàm nàysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
When headers have been set with
88, they will be merged with any headers passed tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
308, with the headers passed tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
308 given precedencesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu phương thức này được gọi và
88 chưa được gọi, nó sẽ ghi trực tiếp các giá trị tiêu đề được cung cấp vào kênh mạng mà không lưu vào bộ nhớ đệm bên trong vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
305 trên tiêu đề sẽ không mang lại kết quả như mong đợi. Nếu muốn có số lượng tiêu đề tăng dần với khả năng truy xuất và sửa đổi trong tương lai, hãy sử dụngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 thay thếsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
61 được đọc theo byte, không phải ký tự. Use[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
67 to determine the length of the body in bytes. Node. js will check whether[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
61 and the length of the body which has been transmitted are equal or not[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Cố gắng đặt tên hoặc giá trị trường tiêu đề chứa các ký tự không hợp lệ sẽ dẫn đến [
63][] bị ném[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
384#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Sends a HTTP/1. 1 102 Đang xử lý thông báo tới máy khách, cho biết nội dung yêu cầu sẽ được gửi
Lớp.
48#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
HistoryVersionChangesv15. 5. 0
The
386 value returnssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 after the incoming data is consumedv13. 1. 0, v12. 16. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
388 value mirrors that of the socketv0. 1. 17socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 17
Một đối tượng
389 được tạo bởisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
781 hoặcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
39 và được chuyển làm đối số đầu tiên cho sự kiện[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
786 vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
45 tương ứng. Nó có thể được sử dụng để truy cập trạng thái phản hồi, tiêu đề và dữ liệu[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Khác với giá trị
01 của nó là một lớp con của , bản thân[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
389 mở rộng và được tạo riêng để phân tích cú pháp và phát ra các tiêu đề và tải trọng HTTP đến, vì ổ cắm bên dưới có thể được sử dụng lại nhiều lần trong trường hợp duy trì hoạt độngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Biến cố.
396#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 3. 8Không dùng nữa kể từ đó. v17. 0. 0, v16. 12. 0
Phát ra khi yêu cầu đã bị hủy bỏ
Event.
31#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv16. 0. 0
Sự kiện đóng hiện được phát ra khi yêu cầu đã được hoàn thành chứ không phải khi đóng ổ cắm bên dưới
v0. 4. 2Đã thêm vào. v0. 4. 2
Emitted when the request has been completed
398#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v10. 1. 0Deprecated since. v17. 0. 0, v16. 12. 0
The
398 property will besocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 if the request has been abortedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
201#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
201 property will besocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88 if a complete HTTP message has been received and successfully parsedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Thuộc tính này đặc biệt hữu ích như một phương tiện xác định xem máy khách hoặc máy chủ có truyền hoàn toàn thông báo trước khi kết nối bị ngắt hay không
72socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
204#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 90Không dùng nữa kể từ đó. v16. 0. 0
Alias for
205socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
206#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv14. 5. 0, v12. 19. 0
Hàm trả về
705 để thống nhất với các luồng Có thể đọc khácv0. 3. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 3. 0
Các cuộc gọi
9 trên ổ cắm đã nhận đượcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
389. Nếu cung cấpsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
706, một sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
59 được phát ra trên ổ cắm và[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
706 được chuyển dưới dạng đối số cho bất kỳ người nghe nào trong sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv15. 1. 0
0 hiện được tính toán một cách lười biếng bằng cách sử dụng thuộc tính trình truy cập trên nguyên mẫu và không còn đếm được nữav0. 1. 5socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 5
The request/response headers object
Key-value pairs of header names and values. Header names are lower-cased
Duplicates in raw headers are handled in the following ways, depending on the header name
- Các bản sao của
215,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
216,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
217,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
218,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
219,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
220,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
221,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20,[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
223,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
224,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
225,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
226,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
227,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
228,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
229,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
230,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
231 hoặcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
232 sẽ bị loại bỏsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
233 luôn là một mảng. Các bản sao được thêm vào mảngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- For duplicate
234 headers, the values are joined together withsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
235socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- For all other headers, the values are joined together with
236socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
237socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v18. 3. 0, v16. 17. 0
Tương tự như
0, nhưng không có logic nối và các giá trị luôn là các chuỗi chuỗi, ngay cả đối với các tiêu đề chỉ nhận được một lầnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
239#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server. Có thể là
240 hoặcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
241socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Ngoài ra,
242 là số nguyên đầu tiên vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
243 là số thứ haisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
244#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Chỉ hợp lệ cho yêu cầu thu được từ
781socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Phương thức yêu cầu dưới dạng chuỗi. Read only. Examples. ________ 2246, ________ 2247
248socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Tiêu đề yêu cầu/phản hồi thô liệt kê chính xác như chúng đã nhận được
Các khóa và giá trị nằm trong cùng một danh sách. It is not a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered offsets are the associated values
Header names are not lowercased, and duplicates are not merged
249#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The raw request/response trailer keys and values exactly as they were received. Chỉ được phổ biến tại sự kiện
57[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
251socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Cuộc gọi
252socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
205#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đối tượng
02 được liên kết với kết nốisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
With HTTPS support, use
255 to obtain the client's authentication detailssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Thuộc tính này được đảm bảo là một thể hiện của lớp, một lớp con của , trừ khi người dùng chỉ định một loại ổ cắm khác hoặc bị vô hiệu hóa bên trong
256#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Chỉ có giá trị đối với phản hồi thu được từ
39[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Mã trạng thái phản hồi HTTP gồm 3 chữ số. e. G.
364socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
259#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Chỉ có giá trị đối với phản hồi thu được từ
39[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
The HTTP response status message [reason phrase]. E. G.
261 orsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
262socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
263#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The request/response trailers object. Only populated at the
57 event[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
265#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v18. 3. 0, v16. 17. 0
Tương tự như
263, nhưng không có logic nối và các giá trị luôn là các chuỗi chuỗi, ngay cả đối với các tiêu đề chỉ nhận được một lần. Chỉ được phổ biến tại sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
57[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
268#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Chỉ hợp lệ cho yêu cầu thu được từ
781socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Yêu cầu chuỗi URL. Điều này chỉ chứa URL có trong yêu cầu HTTP thực tế. Nhận yêu cầu sau
73socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Để phân tích URL thành các phần của nó
74socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
When
270 issocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
271 andsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
272 issocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
273socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
75socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Class.
274#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This class serves as the parent class of
39 and[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
00. It is an abstract outgoing message from the perspective of the participants of an HTTP transactionsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Event.
779#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Emitted when the buffer of the message is free again
Event.
77#[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Emitted when the transmission is finished successfully
Event.
279#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Emitted after
280 is called. When the event is emitted, all data has been processed but not necessarily completely flushedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
281socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Adds HTTP trailers [headers but at the end of the message] to the message
Trailers will only be emitted if the message is chunked encoded. If not, the trailers will be silently discarded
HTTP requires the
66 header to be sent to emit trailers, with a list of header field names in its value, e. gsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
76socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Việc cố gắng đặt tên hoặc giá trị trường tiêu đề chứa các ký tự không hợp lệ sẽ dẫn đến việc ném
67socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
284socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v18. 3. 0, v16. 17. 0
Append a single header value for the header object
If the value is an array, this is equivalent of calling this method multiple times
If there were no previous value for the header, this is equivalent of calling
285socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Depending of the value of
286 when the client request or the server were created, this will end up in the header being sent multiple times or a single time with values joined usingsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
235socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
288#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v0. 3. 0Deprecated since. v15. 12. 0, v14. 17. 1
Alias of
289socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
290#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v13. 2. 0, v12. 16. 0
Xem
94[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
292#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
706 Optional, an error to emit withsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
706 eventsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- Returns.
Destroys the message. Khi một ổ cắm được liên kết với tin nhắn và được kết nối, ổ cắm đó cũng sẽ bị hủy
295#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv15. 0. 0
Tham số
768 bây giờ có thể là mộtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
97v0. 11. 6[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
thêm đối số
37v0. 1. 90socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 90
Kết thúc tin nhắn gửi đi. Nếu bất kỳ bộ phận nào của cơ thể không được gửi, nó sẽ chuyển chúng đến hệ thống bên dưới. Nếu tin nhắn bị chunk, nó sẽ gửi đoạn kết thúc
299 và gửi các đoạn giới thiệu [nếu có]socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu chỉ định
768, nó tương đương với việc gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
201, tiếp theo làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
202socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu cung cấp
37, nó sẽ được gọi khi tin nhắn kết thúc [tương đương với một người nghe của sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
77][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
205socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Xóa tiêu đề thư
Vì lý do hiệu quả, Node. js thường đệm các tiêu đề thư cho đến khi
280 được gọi hoặc đoạn đầu tiên của dữ liệu thư được ghi. Sau đó, nó cố gắng đóng gói các tiêu đề và dữ liệu vào một gói TCP duy nhấtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nó thường được mong muốn [nó tiết kiệm một chuyến đi khứ hồi TCP], nhưng không phải khi dữ liệu đầu tiên không được gửi cho đến khi có thể rất lâu sau đó.
205 bỏ qua quá trình tối ưu hóa và khởi động thông báosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
208socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nhận giá trị của tiêu đề HTTP với tên đã cho. Nếu tiêu đề đó không được đặt, giá trị trả về sẽ là
27socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
210socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một mảng chứa các tên duy nhất của các tiêu đề gửi đi hiện tại. Tất cả các tên đều là chữ thường
211socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về một bản sao nông của các tiêu đề gửi đi hiện tại. Vì một bản sao nông được sử dụng, các giá trị mảng có thể bị thay đổi mà không cần gọi thêm các phương thức mô-đun HTTP liên quan đến tiêu đề khác nhau. Các khóa của đối tượng được trả về là tên tiêu đề và các giá trị là giá trị tiêu đề tương ứng. Tất cả các tên tiêu đề là chữ thường
Đối tượng được trả về bởi phương thức
211 không kế thừa nguyên mẫu từ JavaScriptsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
729. Điều này có nghĩa là các phương thứcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
729 điển hình nhưsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
731,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
732 và các phương thức khác không được xác định và sẽ không hoạt độngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
217socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Trả về
88 nếu tiêu đề được xác định bởisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
736 hiện được đặt trong tiêu đề gửi đi. Tên tiêu đề không phân biệt chữ hoa chữ thườngsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
77socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
220socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Chỉ đọc.
88 nếu các tiêu đề đã được gửi, nếu không thìsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
223#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Ghi đè phương thức
224 kế thừa từ lớp kế thừasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
225 là lớp cha củasocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
274socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Gọi phương thức này sẽ tạo ra một
63 vì[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
228 là luồng chỉ ghisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
229socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Removes a header that is queued for implicit sending
78socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
285socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Sets a single header value. If the header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings to send multiple headers with the same name
231socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
232socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
37 Optional function to be called when a timeout occurs. Same as binding to thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
39 event[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- Returns.
Once a socket is associated with the message and is connected,
755 will be called withsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
315 as the first parametersocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
289#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Reference to the underlying socket. Usually, users will not want to access this property
After calling
280, this property will be nulledsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
239#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v13. 2. 0, v12. 16. 0
See
759socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
241#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v13. 2. 0, v12. 16. 0
The number of times
290 has been calledsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
243#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Is
88 ifsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
280 has been called. This property does not indicate whether the data has been flushed. For that purpose, usesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
246 insteadsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
247#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Is
88 if all data has been flushed to the underlying systemsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
249#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
250 of the underlying socket if assigned. Otherwise, the default buffer level whensocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
251 starts returning false [socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
252]socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
253#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The number of buffered bytes
254#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Always
29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
256#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv15. 0. 0
Tham số
768 bây giờ có thể là mộtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
97v0. 11. 6[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
The
37 argument was addedv0. 1. 29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Đã thêm vào. v0. 1. 29
Sends a chunk of the body. This method can be called multiple times
The
773 argument is only relevant whensocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
768 is a string. Defaults tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
775socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
37 argument is optional and will be called when this chunk of data is flushedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Returns
88 if the entire data was flushed successfully to the kernel buffer. Returnssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29 if all or part of the data was queued in the user memory. Thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
779 event will be emitted when the buffer is free againsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
267#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
A list of the HTTP methods that are supported by the parser
268#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
A collection of all the standard HTTP response status codes, and the short description of each. For example,
269socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
270#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv18. 0. 0
Các tùy chọn
271,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
272,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
273 vàsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
274 hiện được hỗ trợv18. 0. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Tùy chọn
275 hiện mặc định làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88v17. 7. 0, v16. 15. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
275,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 andsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
279 options are supported nowv13. 3. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
280 option is supported nowv13. 8. 0, v12. 15. 0, v10. 19. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
281 option is supported nowv9. 6. 0, v8. 12. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
21 argument is supported nowv0. 1. 13socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v0. 1. 13
21socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
389 Specifies thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
389 class to be used. Useful for extending the originalsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
389. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
389socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
75 Specifies thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
75 class to be used. Useful for extending the originalsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
75. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
75socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
271. Sets the timeout value in milliseconds for receiving the entire request from the client. Seesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
44 for more information. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
294socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
272. Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. Seesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
38 for more information. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
297socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
273. The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed. Seesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
25 for more information. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
57socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
274. Đặt giá trị khoảng thời gian tính bằng mili giây để kiểm tra thời gian chờ của yêu cầu và tiêu đề trong các yêu cầu chưa hoàn thành. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
802socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
281 Use an insecure HTTP parser that accepts invalid HTTP headers whensocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88. Using the insecure parser should be avoided. Seesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
805 for more information. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
280 Optionally overrides the value ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
808 for requests received by this server, i. e. the maximum length of request headers in bytes. Default. 16384 [16 KiB]socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
275 If set tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
6 If set tosocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, similarly on what is done in [socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
814][socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
815]. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
279 If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
50socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
819 A list of response headers that should be sent only once. If the header's value is an array, the items will be joined usingsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
235socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
821socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Returns.
Returns a new instance of
781socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
821 is a function which is automatically added to thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
786 eventsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
825#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
826#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv10. 9. 0
The
827 parameter can now be passed along with a separatesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21 objectv7. 5. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
21 parameter can be a WHATWGsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
830 objectv0. 3. 6socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v0. 3. 6
Since most requests are GET requests without bodies, Node. js provides this convenience method. The only difference between this method and
35 is that it sets the method to GET and callssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
832 automatically. The callback must take care to consume the response data for reasons stated insocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
39 section[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
The
37 is invoked with a single argument that is an instance ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
48[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
JSON fetching example
32#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Lịch sửPhiên bảnThay đổiv19. 0. 0
The agent now uses HTTP Keep-Alive by default
v0. 5. 9Added in. v0. 5. 9
Global instance of
5 which is used as the default for all HTTP client requestssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
838socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v11. 6. 0, v10. 15. 0
Read-only property specifying the maximum allowed size of HTTP headers in bytes. Defaults to 16 KiB. Configurable using the
808 CLI optionsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
This can be overridden for servers and client requests by passing the
280 optionsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
841#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
842#socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
HistoryVersionChangesv16. 7. 0, v14. 18. 0
When using a
830 object parsed username and password will now be properly URI decodedv15. 3. 0, v14. 17. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Có thể hủy bỏ yêu cầu bằng AbortSignal
v13. 3. 0The
280 option is supported nowv13. 8. 0, v12. 15. 0, v10. 19. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
281 option is supported nowv10. 9. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
827 parameter can now be passed along with a separatesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21 objectv7. 5. 0socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The
21 parameter can be a WHATWGsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
830 objectv0. 3. 6socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Added in. v0. 3. 6
827.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
852. Kiểm soát hành visocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
5. Possible valuessocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
27 [default]. usesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
32 for this host and portsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- đối tượng
5. rõ ràng sử dụng thông qua trongsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
5socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29. causes a newsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
5 with default values to be usedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
860 Basic authentication [socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
861] to compute an Authorization headersocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
862 A function that produces a socket/stream to use for the request when thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
852 option is not used. This can be used to avoid creating a customsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
5 class just to override the defaultsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
862 function. Seesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
866 for more details. Anysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
23 stream is a valid return valuesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
868 Cổng mặc định cho giao thức. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
869 if ansocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
5 is used, elsesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
27socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
23 IP address family to use when resolving[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
20 or[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
874. Các giá trị hợp lệ làsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
875 hoặcsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
876. When unspecified, both IP v4 and v6 will be usedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
365 An object containing request headerssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
355 Optionalsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
879 hintssocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20 A domain name or IP address of the server to issue the request to. Default.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
881socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
874 Alias forsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20. To support[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
884,socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
874 will be used if bothsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
20 and[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
874 are specifiedsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
281 Use an insecure HTTP parser that accepts invalid HTTP headers whensocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
88. Using the insecure parser should be avoided. Seesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
805 for more information. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
29socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
22 Local interface to bind for network connections[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
893 Local port to connect fromsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
894 Custom lookup function. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
879socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
280 Optionally overrides the value ofsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
808 [the maximum length of response headers in bytes] for responses received from the server. Default. 16384 [16 KiB]socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
898 A string specifying the HTTP request method. Default.socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
246socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
300 Request path. Should include query string if any. E. G.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
301. An exception is thrown when the request path contains illegal characters. Currently, only spaces are rejected but that may change in the future. Default.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
302[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
21 Port of remote server. Default.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
868 if set, elsesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
305[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
306 Protocol to use. Default.[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
307[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
308 . Specifies whether or not to automatically add the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
309 header. Defaults to[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
88socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
311 . An AbortSignal that may be used to abort an ongoing request[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
312 Unix domain socket. Cannot be used if one of[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
20 or[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
21 is specified, as those specify a TCP Socket[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
39 . A number specifying the socket timeout in milliseconds. This will set the timeout before the socket is connected[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
819 A list of request headers that should be sent only once. If the header's value is an array, the items will be joined usingsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
235socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
37socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
- Returns.
21 trongsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31 cũng được hỗ trợsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Node. js maintains several connections per server to make HTTP requests. This function allows one to transparently issue requests
827 can be a string or asocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
830 object. Ifsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
827 is a string, it is automatically parsed withsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
324. If it is a[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
830 object, it will be automatically converted to an ordinarysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21 objectsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
If both
827 andsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21 are specified, the objects are merged, with thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21 properties taking precedencesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
The optional
37 parameter will be added as a one-time listener for thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
45 event[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
35 returns an instance of thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
39 class. The[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
98 instance is a writable stream. If one needs to upload a file with a POST request, then write to the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
98 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
In the example
832 was called. Withsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
35 one must always callsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
832 to signify the end of the request - even if there is no data being written to the request bodysocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
If any error is encountered during the request [be that with DNS resolution, TCP level errors, or actual HTTP parse errors] an
59 event is emitted on the returned request object. As with all[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 events, if no listeners are registered the error will be thrown[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
There are a few special headers that should be noted
Sending a 'Connection. keep-alive' will notify Node. js that the connection to the server should be persisted until the next request
Sending a 'Content-Length' header will disable the default chunked encoding
Sending an 'Expect' header will immediately send the request headers. Usually, when sending 'Expect. 100-continue', both a timeout and a listener for the
76 event should be set. See RFC 2616 Section 8. 2. 3 for more information[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Sending an Authorization header will override using the
860 option to compute basic authenticationsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Example using a
830 assocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
21socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
In a successful request, the following events will be emitted in the following order
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 any number of times, on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object [[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 will not be emitted at all if the response body is empty, for instance, in most redirects][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
57 on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
In the case of a connection error, the following events will be emitted
In the case of a premature connection close before the response is received, the following events will be emitted in the following order
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
355 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
In the case of a premature connection close after the response is received, the following events will be emitted in the following order
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 any number of times, on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [connection closed here]
396 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
366 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
If
371 is called before a socket is assigned, the following events will be emitted in the following order[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [
371 called here][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
355 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
If
371 is called before the connection succeeds, the following events will be emitted in the following order[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [
371 called here][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
355 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
If
371 is called after the response is received, the following events will be emitted in the following order[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 any number of times, on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [
371 called here][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
396 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
366 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
If
399 is called before a socket is assigned, the following events will be emitted in the following order[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [
399 được gọi ở đây][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
68[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu
399 được gọi trước khi kết nối thành công, các sự kiện sau sẽ được phát ra theo thứ tự sau[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [
399 được gọi ở đây][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
68[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
355 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Nếu
399 được gọi sau khi nhận được phản hồi, các sự kiện sau sẽ được phát ra theo thứ tự sau[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
81[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
45[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
50 any number of times, on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
- [
399 được gọi ở đây][ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
68[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
396 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
59 on the[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
58 object with an error with message[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
366 and code[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
356[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
31socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
31 on thesocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
58 object[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Đặt tùy chọn
39 hoặc sử dụng chức năng[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
328 sẽ không hủy bỏ yêu cầu hoặc thực hiện bất kỳ điều gì ngoài việc thêm sự kiệnsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
16[ 'ConTent-Length', '123456', 'content-LENGTH', '123', 'content-type', 'text/plain', 'CONNECTION', 'keep-alive', 'Host', 'example.com', 'accepT', '*/*' ]
Vượt qua một
330 và sau đó gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
331 trênsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
332 tương ứng sẽ hoạt động giống như gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
795 trên chính yêu cầu đósocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
334socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Thực hiện xác thực mức thấp trên
736 được cung cấp được thực hiện khisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
336 được gọisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Việc chuyển giá trị bất hợp pháp là
736 sẽ dẫn đến việc ném mộtsocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
67, được xác định bởisocket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
339socket.setKeepAlive[true, this.keepAliveMsecs]; socket.unref[]; return true;
Không cần thiết phải sử dụng phương pháp này trước khi chuyển các tiêu đề tới một yêu cầu hoặc phản hồi HTTP. Mô-đun HTTP sẽ tự động xác thực các tiêu đề đó
Tiêu đề trong ví dụ yêu cầu HTTP là gì?
Tiêu đề HTTP là trường của yêu cầu hoặc phản hồi HTTP chuyển ngữ cảnh và siêu dữ liệu bổ sung về yêu cầu hoặc phản hồi. Ví dụ: thông báo yêu cầu có thể sử dụng tiêu đề để cho biết định dạng phương tiện ưa thích của nó , trong khi phản hồi có thể sử dụng tiêu đề để chỉ định định dạng phương tiện của nội dung được trả về.4 loại tiêu đề HTTP là gì?
Các tiêu đề cũng có thể được phân loại theo cách proxy xử lý chúng. .Sự liên quanCố sống điProxy-Xác thựcỦy quyền ủy quyềnGiới thiệu tóm tắtMã hóa chuyển giaoxác thựcJavaScript có thể đọc tiêu đề yêu cầu không?
Lấy tiêu đề trong JavaScript khó hơn vì ngôn ngữ này hoạt động ở phía máy khách . Nhưng bạn có thể gửi yêu cầu đến máy chủ bằng Ajax và nhận các tiêu đề gần giống nhau bằng hàm getAllResponseHeaders.Tôi có thể thêm tiêu đề tùy chỉnh vào yêu cầu HTTP không?
Trong ngăn Trang chủ, bấm đúp vào Tiêu đề phản hồi HTTP. Trong ngăn Tiêu đề phản hồi HTTP, nhấp vào Thêm. trong ngăn Hành động. Trong hộp thoại Thêm tiêu đề phản hồi HTTP tùy chỉnh, đặt tên và giá trị cho tiêu đề tùy chỉnh của bạn, rồi bấm OK