Ví dụ tiêu đề yêu cầu javascript http

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;
39

The 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;
41

Nế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ày

Nế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ặp

Cá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#

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;
6

Cá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ới

Khi 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ư sau

Mộ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ách

socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
37

socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
38#

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. 0

Thê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. 0

Thêm tùy chọn

socket.setKeepAlive[true, this.keepAliveMsecs];
socket.unref[];
return true;
20 vào hàm tạo tác nhân

v0. 3. 4

Đã thêm vào. v0. 3. 4

  • socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    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 sau
    • socket.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ọn
      socket.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ành
      socket.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;
      29
    • socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      23 When using the
      socket.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ọn
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      6 là
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      29 hoặc
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      27. Mặc định.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      28
    • socket.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ơn
      socket.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;
      20
    • socket.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;
      20
    • socket.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ếu
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      6 được đặt thành
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88. Mặc định.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      89
    • socket.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à
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    21 trong
    socket.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ởi
    socket.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úng

    Để đị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

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    4 tùy chỉnh

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    7

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    35#

    Produces a socket/stream to be used for HTTP requests

    Theo mặc định, chức năng này giống như

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    36. However, custom agents may override this method in case greater flexibility is desired

    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

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    37

    This method is guaranteed to return an instance of the class, a subclass of , unless the user specifies a socket type other than

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    37 has a signature of
    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    39

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    00#

    Called when

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    01 is detached from a request and could be persisted by the
    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    5. Default behavior is to

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;

    This method can be overridden by a particular

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    5 subclass. If this method returns a falsy value, the socket will be destroyed instead of persisting it for use with the next request

    The

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    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#

    Called when

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    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

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    3

    This method can be overridden by a particular

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    5 subclass

    The

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    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#

    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

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    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úng

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    12#

    HistoryVersionChangesv16. 0. 0

    The property now has a

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    13 prototype

    v0. 11. 4

    Added in. v0. 11. 4

    An object which contains arrays of sockets currently awaiting use by the agent when

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    6 is enabled. Do not modify

    Sockets in the

    [ 'ConTent-Length', '123456',
      'content-LENGTH', '123',
      'content-type', 'text/plain',
      'CONNECTION', 'keep-alive',
      'Host', 'example.com',
      'accepT', '*/*' ]
    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#

    HistoryVersionChangesv17. 7. 0, v16. 15. 0

    The

    socket.setKeepAlive[true, this.keepAliveMsecs];
    socket.unref[];
    return true;
    21 parameter is now optional

    v0. 11. 4

    Added in. v0. 11. 4

    • socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      21 A set of options providing information for name generation
      • [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        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
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        27
    • 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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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#

      By default set to 256. For agents with

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      6 enabled, this sets the maximum number of sockets that will be left open in the free state

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      29#

      By default set to

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      20. Determines how many concurrent sockets the agent can have open per origin. Origin is the returned value of
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      31

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      32#

      Added in. v14. 5. 0, v12. 19. 0

      By default set to

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      20. Determines how many concurrent sockets the agent can have open. Unlike
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      28, this parameter applies across all origins

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      35#

      HistoryVersionChangesv16. 0. 0

      The property now has a

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      13 prototype

      v0. 5. 9

      Added in. v0. 5. 9

      An object which contains queues of requests that have not yet been assigned to sockets. Do not modify

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      37#

      HistoryVersionChangesv16. 0. 0

      The property now has a

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      13 prototype

      v0. 3. 6

      Added in. v0. 3. 6

      An object which contains arrays of sockets currently in use by the agent. Do not modify

      Class.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      39#

      Đối tượng này được tạo nội bộ và được trả về từ

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      35. It represents an in-progress request whose header has already been queued. The header is still mutable using the
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      To get the response, add a listener for

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      During the

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      If no

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      For backward compatibility,

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      Đặt tiêu đề

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      68#

      Added in. v1. 4. 1Deprecated since. v17. 0. 0, v16. 12. 0

      Stability. 0 - Deprecated. Listen for the

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      31 event instead

      Emitted when the request has been aborted by the client. This event is only emitted on the first call to

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      70

      Event.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      31#

      Indicates that the request is completed, or its underlying connection was terminated prematurely [before the response completion]

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      72#

      Emitted each time a server responds to a request with a

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      72 event

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      76#

      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.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      77#

      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.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      78#

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      79 event instead

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      45#

      Emitted when a response is received to this request. This event is emitted only once

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      81#

      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.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      16

      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.

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      83

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      79#

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      79 event

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      86#

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      87#

      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. 0

      Thuộc tính

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      88 không còn là số dấu thời gian

      v0. 11. 14

      Added in. v0. 11. 14

      The

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      87 property will be
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 if the request has been aborted

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      91#

      Added in. v0. 3. 0Deprecated since. v13. 0. 0

      Xem

      [ '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', '*/*' ]
      93#

      Added in. v13. 2. 0, v12. 16. 0

      Xem

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      94

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      95#

      Lịch sửPhiên bảnThay đổiv15. 0. 0

      Tham số

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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', '*/*' ]
      97

      v10. 0. 0

      Phương thức này bây giờ trả về một tham chiếu tới

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      98

      v0. 1. 90

      Đã 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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      99

      Nếu chỉ định

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      96, nó tương đương với việc gọi
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      701 theo sau là
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      702

      Nếu

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37 được chỉ định, nó sẽ được gọi khi luồng yêu cầu kết thúc

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      704#

      Lịch sửPhiên bảnChangesv14. 5. 0

      Hàm trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      705 để thống nhất với các luồng Có thể đọc khác

      v0. 3. 0

      Đã thêm vào. v0. 3. 0

      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        706 Tùy chọn, một lỗi phát ra với sự kiện
        [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        59
      • Returns.

      Hủy yêu cầu. Tùy chọn phát ra sự kiện

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      59 và phát ra sự kiện
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ủy

      Xem

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      710 để biết thêm chi tiết

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      711#

      Đã thêm vào. v14. 1. 0, v13. 14. 0

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 sau khi
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      713 đã được gọi

      Xem

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      714 để biết thêm chi tiết

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      715#

      Đã thêm vào. v0. 0. 1Deprecated since. v13. 4. 0, v12. 16. 0

      Thuộc tính

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      715 sẽ là
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 nếu
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      34

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      721

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      Đ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 đó.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      721 bỏ qua tối ưu hóa và bắt đầu yêu cầu

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      724

      Đọ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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      725

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      726

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      727

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      727 không kế thừa nguyên mẫu từ JavaScript
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      729. Điều này có nghĩa là các phương thức
      socket.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 động

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      733

      Đã 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      734

      Trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 nếu tiêu đề được xác định bởi
      socket.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ường

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      2

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      737

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      738#

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      739#

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      740#

      Added in. v14. 5. 0, v12. 19. 0

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      741#

      Added in. v14. 5. 0, v12. 19. 0

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      742

      Xóa tiêu đề đã được xác định trong đối tượng tiêu đề

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      2

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      743#

      Đã 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ó

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      744

      Đặ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 đó,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ạng

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      8

      hoặc

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      3

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      746

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      3

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      747#

      Khi một ổ cắm được gán cho yêu cầu này và được kết nối,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      748 sẽ được gọi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      749#

      Khi một ổ cắm được gán cho yêu cầu này và được kết nối,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      750 sẽ được gọi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      751

      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. 9

      Added in. v0. 5. 9

      • [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        39 Mili giây trước khi yêu cầu hết thời gian chờ
      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        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ện
        [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        16
      • Returns.

      Khi một ổ cắm được gán cho yêu cầu này và được kết nối,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      755 sẽ được gọi

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      92#

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      54 do cách trình phân tích cú pháp giao thức gắn vào ổ cắm

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      758#

      Added in. v13. 2. 0, v12. 16. 0

      Xem

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      759

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      760#

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 sau khi
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      763

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      763#

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ện
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      77 được phát ra

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      767#

      Lịch sửPhiên bảnThay đổiv15. 0. 0

      Tham số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      768 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', '*/*' ]
      97

      v0. 1. 29

      Đã 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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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 đề
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      771 được thêm vào. Gọi
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      44 là cần thiết để hoàn tất việc gửi yêu cầu

      Đối số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      773 là tùy chọn và chỉ áp dụng khi
      socket.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;
      775

      Đối số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ống

      Trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ại

      Khi hàm

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ào

      Lớp.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      781#

      Biến cố.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      782#

      Được phát ra mỗi khi nhận được yêu cầu có HTTP

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ột
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      784 khi thích hợp

      Xử lý sự kiện này liên quan đến việc gọi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ầu

      Khi sự kiện này được phát ra và xử lý, sự kiện

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      786 sẽ không được phát ra

      Biến cố.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      787#

      Được phát ra mỗi khi nhận được yêu cầu có tiêu đề HTTP

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ằng
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      790 khi thích hợp

      Khi sự kiện này được phát ra và xử lý, sự kiện

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      786 sẽ không được phát ra

      Biến cố.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      792#

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ện
      socket.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ỏng

      v6. 0. 0

      The default action of calling

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      795 on the
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      01 will no longer take place if there are listeners attached for
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      792

      v0. 1. 94

      Đã thêm vào. v0. 1. 94

      Nếu kết nối máy khách phát ra sự kiện

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      799. If the socket is not writable or headers of the current attached
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      00 has been sent, it is immediately destroyed

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      01 is the
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      02 object that the error originated from

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      0

      When the

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      792 event occurs, there is no
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      07 or
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      05 object, so any HTTP response sent, including response headers and payload, must be written directly to the
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      01 object. Care must be taken to ensure the response is a properly formatted HTTP response message

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      07 is an instance of
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      63 with two extra columns

      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        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 request

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      11. Before trying to send data to the socket, it is better to check that it is still writable

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      1

      Event.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      31#

      Phát ra khi máy chủ đóng

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      72#

      Được phát ra mỗi khi khách hàng yêu cầu phương thức HTTP

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      50 event listener, meaning it will need to be bound in order to handle data sent to the server on that socket

      Event.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      17#

      Sự kiện này được phát ra khi một luồng TCP mới được thiết lập.

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      01 thường là một đối tượng kiểu
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      02. Usually users will not want to access this event. Cụ thể, ổ cắm sẽ không phát ra các sự kiện
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      23 nào cũng có thể được thông qua

      Nếu

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      755 được gọi ở đây, thời gian chờ sẽ được thay thế bằng
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      25 khi ổ cắm đã phục vụ yêu cầu [nếu
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      25 khác 0]

      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.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      27#

      Đã thêm vào. v18. 7. 0, v16. 17. 0

      When the number of requests on a socket reaches the threshold of

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      28, the server will drop new requests and emit
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      27 event instead, then send
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      30 to client

      Biến cố.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      786#

      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.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      79#

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      50 event listener, meaning it will need to be bound in order to handle data sent to the server on that socket

      This event is guaranteed to be passed an instance of the class, a subclass of , unless the user specifies a socket type other than

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      34#

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      35

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      36#

      Closes all connections connected to this server

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37#

      Closes all connections connected to this server which are not sending a request or waiting for a response

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      38

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      39#

      Starts the HTTP server listening for connections. This method is identical to

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      39 from
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      41

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      42#

      • Indicates whether or not the server is listening for connections

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      43

      Limits maximum incoming headers count. If set to 0, no limit will be applied

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      44

      HistoryVersionChangesv18. 0. 0

      The default request timeout changed from no timeout to 300s [5 minutes]

      v14. 11. 0

      Added 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      45

      HistoryVersionChangesv13. 0. 0

      The default timeout changed from 120s to 0 [no timeout]

      v0. 9. 12

      Added in. v0. 9. 12

      Đặt giá trị thời gian chờ cho ổ cắm và phát ra sự kiện

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      If there is a

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      16 event listener on the Server object, then it will be called with the timed-out socket as an argument

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      16 của Máy chủ, thời gian chờ phải được xử lý rõ ràng

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      28#

      • 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      50 will disable the limit

      Khi đạt đến giới hạn, nó sẽ đặt giá trị tiêu đề

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      24 thành
      socket.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ồi
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      53

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      54

      HistoryVersionChangesv13. 0. 0

      The default timeout changed from 120s to 0 [no timeout]

      v0. 9. 12

      Added 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      50 will disable the timeout behavior on incoming connections

      The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      25

      • Timeout in milliseconds. Mặc định.
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        57 [5 giây]

      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. ,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      54

      A value of

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      50 will disable the keep-alive timeout behavior on incoming connections. Giá trị của
      socket.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 timeout

      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.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      00#

      Đố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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      786

      Event.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      31#

      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.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      77#

      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ì

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      65

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      66 header to be sent in order to emit trailers, with a list of the header fields in its value. e. g. ,

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      2

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      67

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      68#

      Added in. v0. 3. 0Deprecated since. v13. 0. 0

      See

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      69

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      70#

      Added in. v13. 2. 0, v12. 16. 0

      Xem

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      94

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      72#

      Lịch sửPhiên bảnThay đổiv15. 0. 0

      Tham số

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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', '*/*' ]
      97

      v10. 0. 0

      Phương thức này bây giờ trả về một tham chiếu tới

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      75

      v0. 1. 90

      Đã 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,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      76, PHẢI được gọi trên mỗi phản hồi

      If

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      96 is specified, it is similar in effect to calling
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      78 followed by
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      79

      Nếu

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37 được chỉ định, nó sẽ được gọi khi luồng phản hồi kết thúc

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      81#

      Đã thêm vào. v0. 0. 2Không dùng nữa kể từ đó. v13. 4. 0, v12. 16. 0

      Thuộc tính

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      81 sẽ là
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 nếu
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      76 đã được gọi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      85

      Xóa các tiêu đề phản hồi. Xem thêm.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      721

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      87

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      89

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      90

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      90 không kế thừa nguyên mẫu từ JavaScript
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      729. This means that typical
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      729 methods such as
      socket.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 work

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      96

      Trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 nếu tiêu đề được xác định bởi
      socket.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ường

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      3

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      99

      Boolean [read-only]. Đúng nếu tiêu đề đã được gửi, sai nếu không

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      300

      Removes a header that's queued for implicit sending

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      4

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      301#

      A reference to the original HTTP

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      07 object

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      303

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      304

      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,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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 chaining

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      5

      hoặc

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      6

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      67

      When headers have been set with

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88, they will be merged with any headers passed to
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308, with the headers passed to
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308 given precedence

      Nếu phương thức

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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, use
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 instead of
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      314

      Đặt giá trị thời gian chờ của Ổ cắm thành

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      315. If a callback is provided, then it is added as a listener on the
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      16 event on the response object

      Nếu không có trình nghe

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      69#

      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

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      54 events because of how the protocol parser attaches to the socket. Sau
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      76, thuộc tính không có giá trị

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      7

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      322#

      Khi sử dụng các tiêu đề ẩn [không gọi rõ ràng

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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óa

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      8

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      324#

      When using implicit headers [not calling

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308 explicitly], this property controls the status message that will be sent to the client when the headers get flushed. If this is left as
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      27 then the standard message for the status code will be used

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      9

      After response header was sent to the client, this property indicates the status message which was sent out

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      327#

      Added in. v13. 2. 0, v12. 16. 0

      Xem

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      759

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      329#

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 sau khi
      socket.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ụng
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      332

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      332#

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ện
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      77 được phát ra

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      336#

      Lịch sửPhiên bảnThay đổiv15. 0. 0

      Tham số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      768 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', '*/*' ]
      97

      v0. 1. 29

      Đã thêm vào. v0. 1. 29

      If this method is called and

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308 has not been called, it will switch to implicit header mode and flush the implicit headers

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ồi
      socket.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. If
      socket.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óa

      Đâ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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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 time
      socket.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 dung

      Trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ại

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      785#

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      782 event on
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      353

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      354#

      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.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ọn
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37 sẽ được gọi khi thông báo phản hồi đã được viết

      Thí dụ

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      70

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      357

      HistoryVersionChangesv14. 14. 0

      Allow passing headers as an array

      v11. 10. 0, v10. 17. 0

      Return

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      705 from
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      359 to allow chaining with
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      360

      v5. 11. 0, v4. 4. 5

      A

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      361 is thrown if
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      362 is not a number in the range
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      363

      v0. 1. 30

      Đã 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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 được
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      366 làm đối số thứ hai

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      365 may be an
      socket.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 as
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      369

      Trả về một tham chiếu đến

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      75, để các cuộc gọi có thể được xâu chuỗi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      71

      This method must only be called once on a message and it must be called before

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      76 is called

      Nếu

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      346 hoặc
      socket.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ày

      When headers have been set with

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88, they will be merged with any headers passed to
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308, with the headers passed to
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      308 given precedence

      Nếu phương thức này được gọi và

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ụng
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 thay thế

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      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 [

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      63][] bị ném

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      384#

      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.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      48#

      HistoryVersionChangesv15. 5. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      386 value returns
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 after the incoming data is consumed

      v13. 1. 0, v12. 16. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      388 value mirrors that of the socket

      v0. 1. 17

      Đã thêm vào. v0. 1. 17

      Một đối tượng

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      389 được tạo bởi
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      781 hoặc
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      39 và được chuyển làm đối số đầu tiên cho sự kiện
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      786 và
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      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

      Khác với giá trị

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      01 của nó là một lớp con của , bản thân
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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 động

      Biến cố.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      396#

      Đã 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.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      31#

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      398#

      Added in. v10. 1. 0Deprecated since. v17. 0. 0, v16. 12. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      398 property will be
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 if the request has been aborted

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      201#

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      201 property will be
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 if a complete HTTP message has been received and successfully parsed

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      72

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      204#

      Đã thêm vào. v0. 1. 90Không dùng nữa kể từ đó. v16. 0. 0

      Alias for

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      205

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      206#

      HistoryVersionChangesv14. 5. 0, v12. 19. 0

      Hàm trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      705 để thống nhất với các luồng Có thể đọc khác

      v0. 3. 0

      Đã thêm vào. v0. 3. 0

      Các cuộc gọi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      9 trên ổ cắm đã nhận được
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      389. Nếu cung cấp
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      706, một sự kiện
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      59 được phát ra trên ổ cắm và
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      706 được chuyển dưới dạng đối số cho bất kỳ người nghe nào trong sự kiện

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      0

      HistoryVersionChangesv15. 1. 0

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ữa

      v0. 1. 5

      Đã 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
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        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,
        [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        20,
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        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ặc
        socket.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ảng
      • For duplicate
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        234 headers, the values are joined together with
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        235
      • For all other headers, the values are joined together with
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        236

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      237

      Đã thêm vào. v18. 3. 0, v16. 17. 0

      Tương tự như

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ần

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      239#

      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à

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      240 hoặc
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      241

      Ngoài ra,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      242 là số nguyên đầu tiên và
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      243 là số thứ hai

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      244#

      Chỉ hợp lệ cho yêu cầu thu được từ

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      781

      Phương thức yêu cầu dưới dạng chuỗi. Read only. Examples. ________ 2246, ________ 2247

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      248

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      249#

      The raw request/response trailer keys and values exactly as they were received. Chỉ được phổ biến tại sự kiện

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      57

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      251

      Cuộc gọi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      252

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      205#

      Đối tượng

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      02 được liên kết với kết nối

      With HTTPS support, use

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      255 to obtain the client's authentication details

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      256#

      Chỉ có giá trị đối với phản hồi thu được từ

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      39

      Mã trạng thái phản hồi HTTP gồm 3 chữ số. e. G.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      364

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      259#

      Chỉ có giá trị đối với phản hồi thu được từ

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      39

      The HTTP response status message [reason phrase]. E. G.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      261 or
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      262

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      263#

      The request/response trailers object. Only populated at the

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      57 event

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      265#

      Đã thêm vào. v18. 3. 0, v16. 17. 0

      Tương tự như

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ện
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      57

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      268#

      Chỉ hợp lệ cho yêu cầu thu được từ

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      781

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      73

      Để phân tích URL thành các phần của nó

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      74

      When

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      270 is
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      271 and
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      272 is
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      273

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      75

      Class.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      274#

      This class serves as the parent class of

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      39 and
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      00. It is an abstract outgoing message from the perspective of the participants of an HTTP transaction

      Event.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      779#

      Emitted when the buffer of the message is free again

      Event.
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      77#

      Emitted when the transmission is finished successfully

      Event.
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      279#

      Emitted after

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      280 is called. When the event is emitted, all data has been processed but not necessarily completely flushed

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      281

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      66 header to be sent to emit trailers, with a list of header field names in its value, e. g

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      76

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      67

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      284

      Đã 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      285

      Depending of the value of

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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 using
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      235

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      288#

      Added in. v0. 3. 0Deprecated since. v15. 12. 0, v14. 17. 1

      Alias of

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      289

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      290#

      Added in. v13. 2. 0, v12. 16. 0

      Xem

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      94

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      292#

      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        706 Optional, an error to emit with
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        706 event
      • 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      295#

      Lịch sửPhiên bảnThay đổiv15. 0. 0

      Tham số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      768 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', '*/*' ]
      97

      v0. 11. 6

      thêm đối số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37

      v0. 1. 90

      Đã 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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      299 và gửi các đoạn giới thiệu [nếu có]

      Nếu chỉ định

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      768, nó tương đương với việc gọi
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      201, tiếp theo là
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      202

      Nếu cung cấp

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ện
      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      77]

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      205

      Xóa tiêu đề thư

      Vì lý do hiệu quả, Node. js thường đệm các tiêu đề thư cho đến khi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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ất

      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 đó.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      205 bỏ qua quá trình tối ưu hóa và khởi động thông báo

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      208

      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à

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      27

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      210

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      211

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      211 không kế thừa nguyên mẫu từ JavaScript
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      729. Điều này có nghĩa là các phương thức
      socket.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 động

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      217

      Trả về

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 nếu tiêu đề được xác định bởi
      socket.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ường

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      77

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      220

      Chỉ đọc.

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 nếu các tiêu đề đã được gửi, nếu không thì
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      29

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      223#

      Ghi đè phương thức

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      224 kế thừa từ lớp kế thừa
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      225 là lớp cha của
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      274

      Gọi phương thức này sẽ tạo ra một

      [ 'ConTent-Length', '123456',
        'content-LENGTH', '123',
        'content-type', 'text/plain',
        'CONNECTION', 'keep-alive',
        'Host', 'example.com',
        'accepT', '*/*' ]
      63 vì
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      228 là luồng chỉ ghi

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      229

      Removes a header that is queued for implicit sending

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      78

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      285

      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

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      231

      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        232
      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        37 Optional function to be called when a timeout occurs. Same as binding to the
        [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        39 event
      • Returns.

      Once a socket is associated with the message and is connected,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      755 will be called with
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      315 as the first parameter

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      289#

      Reference to the underlying socket. Usually, users will not want to access this property

      After calling

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      280, this property will be nulled

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      239#

      Added in. v13. 2. 0, v12. 16. 0

      See

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      759

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      241#

      Added in. v13. 2. 0, v12. 16. 0

      The number of times

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      290 has been called

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      243#

      Is

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 if
      socket.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, use
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      246 instead

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      247#

      Is

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 if all data has been flushed to the underlying system

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      249#

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      250 of the underlying socket if assigned. Otherwise, the default buffer level when
      socket.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#

      The number of buffered bytes

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      254#

      Always

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      29

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      256#

      Lịch sửPhiên bảnThay đổiv15. 0. 0

      Tham số

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      768 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', '*/*' ]
      97

      v0. 11. 6

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37 argument was added

      v0. 1. 29

      Đã thêm vào. v0. 1. 29

      Sends a chunk of the body. This method can be called multiple times

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      773 argument is only relevant when
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      768 is a string. Defaults to
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      775

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      37 argument is optional and will be called when this chunk of data is flushed

      Returns

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88 if the entire data was flushed successfully to the kernel buffer. Returns
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      29 if all or part of the data was queued in the user memory. The
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      779 event will be emitted when the buffer is free again

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      267#

      A list of the HTTP methods that are supported by the parser

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      268#

      A collection of all the standard HTTP response status codes, and the short description of each. For example,

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      269

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      270#

      HistoryVersionChangesv18. 0. 0

      Các tùy chọn

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      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. 0

      Tùy chọn

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      275 hiện mặc định là
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      88

      v17. 7. 0, v16. 15. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      275,
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      6 and
      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      279 options are supported now

      v13. 3. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      280 option is supported now

      v13. 8. 0, v12. 15. 0, v10. 19. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      281 option is supported now

      v9. 6. 0, v8. 12. 0

      The

      socket.setKeepAlive[true, this.keepAliveMsecs];
      socket.unref[];
      return true;
      21 argument is supported now

      v0. 1. 13

      Added in. v0. 1. 13

      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        21

        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          389 Specifies the
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          389 class to be used. Useful for extending the original
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          389. Default.
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          389
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          75 Specifies the
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          75 class to be used. Useful for extending the original
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          75. Default.
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          75
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          271. Sets the timeout value in milliseconds for receiving the entire request from the client. See
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          44 for more information. Default.
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          294
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          272. Sets the timeout value in milliseconds for receiving the complete HTTP headers from the client. See
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          38 for more information. Default.
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          297
        • socket.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. See
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          25 for more information. Default.
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          57
        • socket.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;
          802
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          281 Use an insecure HTTP parser that accepts invalid HTTP headers when
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          88. Using the insecure parser should be avoided. See
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          805 for more information. Default.
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          29
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          280 Optionally overrides the value of
          socket.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 to
          socket.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;
          88
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          6 If set to
          socket.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;
          29
        • socket.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;
          50
        • socket.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 using
          socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          235
      • socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        821

      • Returns.

      • Returns a new instance of

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        781

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        821 is a function which is automatically added to the
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        786 event

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        825#

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        826#

        HistoryVersionChangesv10. 9. 0

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        827 parameter can now be passed along with a separate
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        21 object

        v7. 5. 0

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        21 parameter can be a WHATWG
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        830 object

        v0. 3. 6

        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

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        35 is that it sets the method to GET and calls
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        832 automatically. The callback must take care to consume the response data for reasons stated in
        [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        39 section

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        37 is invoked with a single argument that is an instance of
        [ 'ConTent-Length', '123456',
          'content-LENGTH', '123',
          'content-type', 'text/plain',
          'CONNECTION', 'keep-alive',
          'Host', 'example.com',
          'accepT', '*/*' ]
        48

        JSON fetching example

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        32#

        Lịch sửPhiên bảnThay đổiv19. 0. 0

        The agent now uses HTTP Keep-Alive by default

        v0. 5. 9

        Added in. v0. 5. 9

        Global instance of

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        5 which is used as the default for all HTTP client requests

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        838

        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

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        808 CLI option

        This can be overridden for servers and client requests by passing the

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        280 option

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        841#

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        842#

        HistoryVersionChangesv16. 7. 0, v14. 18. 0

        When using a

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        830 object parsed username and password will now be properly URI decoded

        v15. 3. 0, v14. 17. 0

        Có thể hủy bỏ yêu cầu bằng AbortSignal

        v13. 3. 0

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        280 option is supported now

        v13. 8. 0, v12. 15. 0, v10. 19. 0

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        281 option is supported now

        v10. 9. 0

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        827 parameter can now be passed along with a separate
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        21 object

        v7. 5. 0

        The

        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        21 parameter can be a WHATWG
        socket.setKeepAlive[true, this.keepAliveMsecs];
        socket.unref[];
        return true;
        830 object

        v0. 3. 6

        Added in. v0. 3. 6

        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          827.
        • socket.setKeepAlive[true, this.keepAliveMsecs];
          socket.unref[];
          return true;
          21
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            852. Kiểm soát hành vi
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            5. Possible values
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              27 [default]. use
              socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              32 for this host and port
            • đối tượng
              socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              5. rõ ràng sử dụng thông qua trong
              socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              5
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              29. causes a new
              socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              5 with default values to be used
          • socket.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 header
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            862 A function that produces a socket/stream to use for the request when the
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            852 option is not used. This can be used to avoid creating a custom
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            5 class just to override the default
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            862 function. See
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            866 for more details. Any
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            23 stream is a valid return value
          • socket.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 an
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            5 is used, else
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            27
          • [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            874. Các giá trị hợp lệ là
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            875 hoặc
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            876. When unspecified, both IP v4 and v6 will be used
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            365 An object containing request headers
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            355 Optional
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            879 hints
          • [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            20 A domain name or IP address of the server to issue the request to. Default.
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            881
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            874 Alias for
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            20. To support
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            884,
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            874 will be used if both
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            20 and
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            874 are specified
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            281 Use an insecure HTTP parser that accepts invalid HTTP headers when
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            88. Using the insecure parser should be avoided. See
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            805 for more information. Default.
            socket.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', '*/*' ]
            22 Local interface to bind for network connections
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            893 Local port to connect from
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            894 Custom lookup function. Default.
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            879
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            280 Optionally overrides the value of
            socket.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;
            246
          • [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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.
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            868 if set, else
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            88
          • [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            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 using
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            235
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            37
          • Returns.
          • socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            21 trong
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            31 cũng được hỗ trợ

            Node. js maintains several connections per server to make HTTP requests. This function allows one to transparently issue requests

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            827 can be a string or a
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            830 object. If
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            827 is a string, it is automatically parsed with
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            324. If it is a
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            830 object, it will be automatically converted to an ordinary
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            21 object

            If both

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            827 and
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            21 are specified, the objects are merged, with the
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            21 properties taking precedence

            The optional

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            37 parameter will be added as a one-time listener for the
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            45 event

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            35 returns an instance of the
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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

            In the example

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            832 was called. With
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            35 one must always call
            socket.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 body

            If any error is encountered during the request [be that with DNS resolution, TCP level errors, or actual HTTP parse errors] an

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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

            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

              [ 'ConTent-Length', '123456',
                'content-LENGTH', '123',
                'content-type', 'text/plain',
                'CONNECTION', 'keep-alive',
                'Host', 'example.com',
                'accepT', '*/*' ]
              76 event should be set. See RFC 2616 Section 8. 2. 3 for more information

            • Sending an Authorization header will override using the

              socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              860 option to compute basic authentication

            Example using a

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            830 as
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            21

            In a successful request, 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', '*/*' ]
                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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31

            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

            • [ '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', '*/*' ]
              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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31

            In the case of a premature connection close 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
            • [connection closed here]
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              396 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', '*/*' ]
              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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31 on the
              [ 'ConTent-Length', '123456',
                'content-LENGTH', '123',
                'content-type', 'text/plain',
                'CONNECTION', 'keep-alive',
                'Host', 'example.com',
                'accepT', '*/*' ]
              58 object

            If

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31

            If

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31

            If

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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]
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              396 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', '*/*' ]
              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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31 on the
              [ 'ConTent-Length', '123456',
                'content-LENGTH', '123',
                'content-type', 'text/plain',
                'CONNECTION', 'keep-alive',
                'Host', 'example.com',
                'accepT', '*/*' ]
              58 object

            If

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31

            Nếu

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31

            Nếu

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              396 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', '*/*' ]
              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
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31
            • socket.setKeepAlive[true, this.keepAliveMsecs];
              socket.unref[];
              return true;
              31 on the
              [ 'ConTent-Length', '123456',
                'content-LENGTH', '123',
                'content-type', 'text/plain',
                'CONNECTION', 'keep-alive',
                'Host', 'example.com',
                'accepT', '*/*' ]
              58 object

            Đặt tùy chọn

            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            39 hoặc sử dụng chức năng
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            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ện
            [ 'ConTent-Length', '123456',
              'content-LENGTH', '123',
              'content-type', 'text/plain',
              'CONNECTION', 'keep-alive',
              'Host', 'example.com',
              'accepT', '*/*' ]
            16

            Vượt qua một

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            330 và sau đó gọi
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            331 trên
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            332 tương ứng sẽ hoạt động giống như gọi
            socket.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;
            334

            Thực hiện xác thực mức thấp trên

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            736 được cung cấp được thực hiện khi
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            336 được gọi

            Việc chuyển giá trị bất hợp pháp là

            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            736 sẽ dẫn đến việc ném một
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            67, được xác định bởi
            socket.setKeepAlive[true, this.keepAliveMsecs];
            socket.unref[];
            return true;
            339

            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 quan
            Cố sống đi
            Proxy-Xác thực
            Ủy quyền ủy quyền
            Giới thiệu tóm tắt
            Mã hóa chuyển giao
            xác thực

            JavaScript 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

Chủ Đề