File tree Expand file tree Collapse file tree 4 files changed +8
-13
lines changed Expand file tree Collapse file tree 4 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ function main({ len, n }) {
16
16
const kOnHeadersComplete = HTTPParser . kOnHeadersComplete | 0 ;
17
17
const kOnBody = HTTPParser . kOnBody | 0 ;
18
18
const kOnMessageComplete = HTTPParser . kOnMessageComplete | 0 ;
19
- const CRLF = '\r\n' ;
20
19
21
20
function processHeader ( header , n ) {
22
21
const parser = newParser ( REQUEST ) ;
@@ -43,12 +42,12 @@ function main({ len, n }) {
43
42
return parser ;
44
43
}
45
44
46
- let header = `GET /hello HTTP/1.1${ CRLF } Content -Type: text/plain${ CRLF } ` ;
45
+ let header = `GET /hello HTTP/1.1\r\nContent -Type: text/plain\r\n ` ;
47
46
48
47
for ( let i = 0 ; i < len ; i ++ ) {
49
- header += `X-Filler${ i } : ${ Math . random ( ) . toString ( 36 ) . substring ( 2 ) } ${ CRLF } ` ;
48
+ header += `X-Filler${ i } : ${ Math . random ( ) . toString ( 36 ) . substring ( 2 ) } \r\n ` ;
50
49
}
51
- header += CRLF ;
50
+ header += '\r\n' ;
52
51
53
52
processHeader ( Buffer . from ( header ) , n ) ;
54
53
}
Original file line number Diff line number Diff line change @@ -4,14 +4,13 @@ const assert = require('assert');
4
4
const { createServer, maxHeaderSize } = require ( 'http' ) ;
5
5
const { createConnection } = require ( 'net' ) ;
6
6
7
- const CRLF = '\r\n' ;
8
7
const DUMMY_HEADER_NAME = 'Cookie: ' ;
9
8
const DUMMY_HEADER_VALUE = 'a' . repeat (
10
9
// Plus one is to make it 1 byte too big
11
10
maxHeaderSize - DUMMY_HEADER_NAME . length + 1
12
11
) ;
13
12
const PAYLOAD_GET = 'GET /blah HTTP/1.1' ;
14
- const PAYLOAD = PAYLOAD_GET + CRLF + DUMMY_HEADER_NAME + DUMMY_HEADER_VALUE ;
13
+ const PAYLOAD = PAYLOAD_GET + '\r\n' + DUMMY_HEADER_NAME + DUMMY_HEADER_VALUE ;
15
14
16
15
const server = createServer ( ) ;
17
16
Original file line number Diff line number Diff line change 23
23
const common = require ( '../common' ) ;
24
24
const http = require ( 'http' ) ;
25
25
26
- const CRLF = '\r\n' ;
27
-
28
26
const server = http . createServer ( ) ;
29
27
server . on ( 'upgrade' , function ( req , socket ) {
30
- socket . write ( `HTTP/1.1 101 Ok${ CRLF } ` +
31
- `Connection: Upgrade${ CRLF } ` +
32
- `Upgrade: Test${ CRLF } ${ CRLF } ` +
28
+ socket . write ( `HTTP/1.1 101 Ok\r\n ` +
29
+ `Connection: Upgrade\r\n ` +
30
+ `Upgrade: Test\r\n\r\n ` +
33
31
'head' ) ;
34
32
socket . on ( 'end' , function ( ) {
35
33
socket . end ( ) ;
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ const webIdUrl = 'URI:http://example.com/#me';
47
47
const modulus = fixtures . readKey ( 'rsa_cert_foafssl_b.modulus' , 'ascii' ) . replace ( / \n / g, '' ) ;
48
48
const exponent = fixtures . readKey ( 'rsa_cert_foafssl_b.exponent' , 'ascii' ) . replace ( / \n / g, '' ) ;
49
49
50
- const CRLF = '\r\n' ;
51
50
const body = 'hello world\n' ;
52
51
let cert ;
53
52
@@ -76,7 +75,7 @@ server.listen(0, function() {
76
75
client . stdout . on ( 'data' , function ( data ) {
77
76
console . log ( 'response received' ) ;
78
77
const message = data . toString ( ) ;
79
- const contents = message . split ( CRLF + CRLF ) . pop ( ) ;
78
+ const contents = message . split ( '\r\n\r\n' ) . pop ( ) ;
80
79
assert . strictEqual ( body , contents ) ;
81
80
server . close ( ( e ) => {
82
81
assert . ifError ( e ) ;
You can’t perform that action at this time.
0 commit comments