File tree Expand file tree Collapse file tree 2 files changed +64
-53
lines changed Expand file tree Collapse file tree 2 files changed +64
-53
lines changed Original file line number Diff line number Diff line change @@ -6,59 +6,6 @@ module Rex
66module Proto
77module 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments