Skip to content

Commit bccd906

Browse files
authored
Land #18564, Fix an uninitialized constant error in capture/http
2 parents dd701c1 + e9d6bab commit bccd906

File tree

2 files changed

+64
-53
lines changed

2 files changed

+64
-53
lines changed

lib/rex/proto/http/server.rb

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,6 @@ module Rex
66
module Proto
77
module Http
88

9-
###
10-
#
11-
# Runtime extension of the HTTP clients that connect to the server.
12-
#
13-
###
14-
module ServerClient
15-
16-
#
17-
# Initialize a new request instance.
18-
#
19-
def init_cli(server)
20-
self.request = Request.new
21-
self.server = server
22-
self.keepalive = false
23-
end
24-
25-
#
26-
# Resets the parsing state.
27-
#
28-
def reset_cli
29-
self.request.reset
30-
end
31-
32-
#
33-
# Transmits a response and adds the appropriate headers.
34-
#
35-
def send_response(response)
36-
# Set the connection to close or keep-alive depending on what the client
37-
# can support.
38-
response['Connection'] = (keepalive) ? 'Keep-Alive' : 'close'
39-
40-
# Add any other standard response headers.
41-
server.add_response_headers(response)
42-
43-
# Send it off.
44-
put(response.to_s)
45-
end
46-
47-
#
48-
# The current request context.
49-
#
50-
attr_accessor :request
51-
#
52-
# Boolean that indicates whether or not the connection supports keep-alive.
53-
#
54-
attr_accessor :keepalive
55-
#
56-
# A reference to the server the client is associated with.
57-
#
58-
attr_accessor :server
59-
60-
end
61-
629
###
6310
#
6411
# Acts as an HTTP server, processing requests and dispatching them to
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# -*- coding: binary -*-
2+
require 'rex/socket'
3+
4+
5+
module Rex
6+
module Proto
7+
module Http
8+
9+
###
10+
#
11+
# Runtime extension of the HTTP clients that connect to the server.
12+
#
13+
###
14+
module ServerClient
15+
16+
#
17+
# Initialize a new request instance.
18+
#
19+
def init_cli(server)
20+
self.request = Request.new
21+
self.server = server
22+
self.keepalive = false
23+
end
24+
25+
#
26+
# Resets the parsing state.
27+
#
28+
def reset_cli
29+
self.request.reset
30+
end
31+
32+
#
33+
# Transmits a response and adds the appropriate headers.
34+
#
35+
def send_response(response)
36+
# Set the connection to close or keep-alive depending on what the client
37+
# can support.
38+
response['Connection'] = (keepalive) ? 'Keep-Alive' : 'close'
39+
40+
# Add any other standard response headers.
41+
server.add_response_headers(response)
42+
43+
# Send it off.
44+
put(response.to_s)
45+
end
46+
47+
#
48+
# The current request context.
49+
#
50+
attr_accessor :request
51+
#
52+
# Boolean that indicates whether or not the connection supports keep-alive.
53+
#
54+
attr_accessor :keepalive
55+
#
56+
# A reference to the server the client is associated with.
57+
#
58+
attr_accessor :server
59+
60+
end
61+
62+
end
63+
end
64+
end

0 commit comments

Comments
 (0)