GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
HTTP_CONNECTION
+
Point of view
All features
ANY
JOB
LOOP_ITEM
SERVER
RECYCLING_POOL
HTTP_SERVER
All features
deferred class HTTP_CONNECTION
Summary
top
Handle one connection to the
HTTP_SERVER
. The real HTTP protocol is defined here.
Direct parents
Inherit list:
CONNECTION
Insert list:
DISPOSABLE
,
RECYCLABLE
Class invariant
top
request_line
/= Void
priority /= Minimum_integer
Overview
top
Features
Loop Implementation
{
LOOP_ITEM
}
prepare
(a_events:
EVENTS_SET
)
Premare the request to be processed by
a_events
and
method_handler
.
is_ready
(a_events:
EVENTS_SET
):
BOOLEAN
True
when the management of the request in
a_events
can be use
done
:
BOOLEAN
True
when the request management has been completed.
continue
Manage the next step of the request.
continue_read
Read and manage the last character of the request
continue_prepare
Manage the answer preparation
continue_write
Manage writing the answer
Implementation
{}
answer_state
:
INTEGER_32
The state of a single answer
answer_state_read
:
INTEGER_32
The state of the answer is in the
read
state
answer_state_prepare
:
INTEGER_32
The state of the answer is in the
read
state
answer_state_write
:
INTEGER_32
The state of the answer is in the
write
state
read_buffer
:
STRING
The buffer that has been read
content_length
:
INTEGER_32
The length of the body content of the request
content_count
:
INTEGER_32
The number of bytes that has already been read.
HTTP Server implementation
{
HTTP_SERVER
}
set_server
(a_server:
HTTP_SERVER
)
Assing
server
with the value of
a_server
Server implementation
{
SERVER
}
set_io
(a_io:
SOCKET_INPUT_OUTPUT_STREAM
)
Assing
ios
with the value of
a_io
Implementation
{}
server
:
HTTP_SERVER
The server used to manage http connections
handle_disconnect
(a_io:
SOCKET_INPUT_OUTPUT_STREAM
)
Disconnect
a_io
get_method_handler
(a_method:
STRING
, a_uri:
STRING
, a_version:
STRING
):
HTTP_METHOD_HANDLER
Retreive the method handeler of used to manage a request of type
a_method
addressed with
a_uri
using http
a_version
disconnected
:
BOOLEAN
Current
is disconnected.
The HTTP protocol (see RFC 2616)
{}
state
:
INTEGER_32
The present connection state.
state_request_line
:
INTEGER_32
The present
state
is in the manage request line connection state.
state_header
:
INTEGER_32
The present
state
is in the manage header connection state.
state_body
:
INTEGER_32
The present
state
is in the manage body connection state.
method_handler
:
HTTP_METHOD_HANDLER
The handler used to manage the requests.
request_line
:
STRING
A single line of the request.
call_state
Manage
read_buffer
depending the present
state
a_request_line
(a_line:
STRING
)
Manage the resquest
a_line
a_header
(a_line:
STRING
)
Manage the header
a_line
and add it to the
method_handler
headers.
header_key
:
STRING
An header key generated by
parse_value
header_value
:
STRING
An header value generated by
parse_value
parse_header
(a_line:
STRING
)
Split the header
a_line
as key/value.
a_body
(a_line:
STRING
)
Add the
a_line
in the
method_handler
Recycler Implementation
{
RECYCLING_POOL
}
recycle
At collection, recycle
ios
Collection Implementation
{}
dispose
At collection, disconnect
ios
Loop implementation
{
LOOP_ITEM
}
restart
Restart the connection.
Implementation
{}
ios
:
SOCKET_INPUT_OUTPUT_STREAM
Used to read (request) and write (answer)
{
JOB
,
LOOP_ITEM
}
priority
:
INTEGER_32
never change a job's priority after inserting it in loop_item.
{
LOOP_ITEM
}
infix "<"
(other:
JOB
):
BOOLEAN
Maximum:
{}
Maximum_character_code
:
INTEGER_16
Largest supported code for
CHARACTER
values.
Maximum_integer_8
:
INTEGER_8
Largest supported value of type
INTEGER_8
.
Maximum_integer_16
:
INTEGER_16
Largest supported value of type
INTEGER_16
.
Maximum_integer
:
INTEGER_32
Largest supported value of type INTEGER/
INTEGER_32
.
Maximum_integer_32
:
INTEGER_32
Largest supported value of type INTEGER/
INTEGER_32
.
Maximum_integer_64
:
INTEGER_64
Largest supported value of type
INTEGER_64
.
Maximum_real_32
:
REAL_32
Largest non-special (no NaNs nor infinity) supported value of type
REAL_32
.
Maximum_real
:
REAL_64
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_64
:
REAL_64
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_80
:
REAL_EXTENDED
Largest supported value of type
REAL_80
.
Minimum:
{}
Minimum_character_code
:
INTEGER_16
Smallest supported code for
CHARACTER
values.
Minimum_integer_8
:
INTEGER_8
Smallest supported value of type
INTEGER_8
.
Minimum_integer_16
:
INTEGER_16
Smallest supported value of type
INTEGER_16
.
Minimum_integer
:
INTEGER_32
Smallest supported value of type INTEGER/
INTEGER_32
.
Minimum_integer_32
:
INTEGER_32
Smallest supported value of type INTEGER/
INTEGER_32
.
Minimum_integer_64
:
INTEGER_64
Smallest supported value of type
INTEGER_64
.
Minimum_real_32
:
REAL_32
Smallest non-special (no NaNs nor infinity) supported value of type
REAL_32
.
Minimum_real
:
REAL_64
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_64
:
REAL_64
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_80
:
REAL_64
Smallest supported value of type
REAL_80
.
Bits:
{}
Boolean_bits
:
INTEGER_32
Number of bits in a value of type
BOOLEAN
.
Character_bits
:
INTEGER_32
Number of bits in a value of type
CHARACTER
.
Integer_bits
:
INTEGER_32
Number of bits in a value of type INTEGER.
Real_bits
:
INTEGER_32
Number of bits in a value of type REAL.
Pointer_bits
:
INTEGER_32
Number of bits in a value of type
POINTER
.
prepare
(a_events:
EVENTS_SET
)
effective procedure
{
LOOP_ITEM
}
top
Premare the request to be processed by
a_events
and
method_handler
.
require
a_events /= Void
not a_events.queryable
not done
is_ready
(a_events:
EVENTS_SET
):
BOOLEAN
effective function
{
LOOP_ITEM
}
top
True
when the management of the request in
a_events
can be use
require
a_events /= Void
a_events.queryable
not done
done
:
BOOLEAN
effective function
{
LOOP_ITEM
}
top
True
when the request management has been completed.
continue
effective procedure
{
LOOP_ITEM
}
top
Manage the next step of the request.
require
not done
continue_read
effective procedure
{
LOOP_ITEM
}
top
Read and manage the last character of the request
continue_prepare
effective procedure
{
LOOP_ITEM
}
top
Manage the answer preparation
continue_write
effective procedure
{
LOOP_ITEM
}
top
Manage writing the answer
answer_state
:
INTEGER_32
writable attribute
{}
top
The state of a single answer
answer_state_read
:
INTEGER_32
is 0
constant attribute
{}
top
The state of the answer is in the
read
state
answer_state_prepare
:
INTEGER_32
is 1
constant attribute
{}
top
The state of the answer is in the
read
state
answer_state_write
:
INTEGER_32
is 2
constant attribute
{}
top
The state of the answer is in the
write
state
read_buffer
:
STRING
writable attribute
{}
top
The buffer that has been read
content_length
:
INTEGER_32
writable attribute
{}
top
The length of the body content of the request
content_count
:
INTEGER_32
writable attribute
{}
top
The number of bytes that has already been read.
set_server
(a_server:
HTTP_SERVER
)
effective procedure
{
HTTP_SERVER
}
top
Assing
server
with the value of
a_server
set_io
(a_io:
SOCKET_INPUT_OUTPUT_STREAM
)
effective procedure
{
SERVER
}
top
Assing
ios
with the value of
a_io
require
a_io.is_connected
ensure
ios = a_io
server
:
HTTP_SERVER
writable attribute
{}
top
The server used to manage http connections
handle_disconnect
(a_io:
SOCKET_INPUT_OUTPUT_STREAM
)
effective procedure
{}
top
Disconnect
a_io
require
a_io =
ios
done
get_method_handler
(a_method:
STRING
, a_uri:
STRING
, a_version:
STRING
):
HTTP_METHOD_HANDLER
deferred function
{}
top
Retreive the method handeler of used to manage a request of type
a_method
addressed with
a_uri
using http
a_version
require
a_method.as_upper.is_equal(a_method)
ensure
Result.method.is_equal(a_method) or else Result
disconnected
:
BOOLEAN
writable attribute
{}
top
Current
is disconnected.
state
:
INTEGER_32
writable attribute
{}
top
The present connection state.
state_request_line
:
INTEGER_32
is 0
constant attribute
{}
top
The present
state
is in the manage request line connection state.
state_header
:
INTEGER_32
is 1
constant attribute
{}
top
The present
state
is in the manage header connection state.
state_body
:
INTEGER_32
is 2
constant attribute
{}
top
The present
state
is in the manage body connection state.
method_handler
:
HTTP_METHOD_HANDLER
writable attribute
{}
top
The handler used to manage the requests.
request_line
:
STRING
writable attribute
{}
top
A single line of the request.
call_state
effective procedure
{}
top
Manage
read_buffer
depending the present
state
require
answer_state
=
answer_state_read
a_request_line
(a_line:
STRING
)
effective procedure
{}
top
Manage the resquest
a_line
require
answer_state
=
answer_state_read
a_header
(a_line:
STRING
)
effective procedure
{}
top
Manage the header
a_line
and add it to the
method_handler
headers.
header_key
:
STRING
writable attribute
{}
top
An header key generated by
parse_value
header_value
:
STRING
writable attribute
{}
top
An header value generated by
parse_value
parse_header
(a_line:
STRING
)
effective procedure
{}
top
Split the header
a_line
as key/value.
Assing
header_key
and
header_value
a_body
(a_line:
STRING
)
effective procedure
{}
top
Add the
a_line
in the
method_handler
recycle
effective procedure
{
RECYCLING_POOL
}
top
At collection, recycle
ios
dispose
effective procedure
{}
top
At collection, disconnect
ios
restart
effective procedure
{
LOOP_ITEM
}
top
Restart the connection.
Require by Job. Should not be used.
require
done
ensure
not done
ios
:
SOCKET_INPUT_OUTPUT_STREAM
writable attribute
{}
top
Used to read (request) and write (answer)
priority
:
INTEGER_32
writable attribute
{
JOB
,
LOOP_ITEM
}
top
never change a job's priority after inserting it in loop_item.
Priority should only be set at creation time.
infix "<"
(other:
JOB
):
BOOLEAN
effective function
{
LOOP_ITEM
}
top
Maximum_character_code
:
INTEGER_16
{}
top
Largest supported code for
CHARACTER
values.
ensure
meaningful:
Result >= 127
Maximum_integer_8
:
INTEGER_8
is 127
constant attribute
{}
top
Largest supported value of type
INTEGER_8
.
Maximum_integer_16
:
INTEGER_16
is 32767
constant attribute
{}
top
Largest supported value of type
INTEGER_16
.
Maximum_integer
:
INTEGER_32
is 2147483647
constant attribute
{}
top
Largest supported value of type INTEGER/
INTEGER_32
.
Maximum_integer_32
:
INTEGER_32
is 2147483647
constant attribute
{}
top
Largest supported value of type INTEGER/
INTEGER_32
.
Maximum_integer_64
:
INTEGER_64
is 9223372036854775807
constant attribute
{}
top
Largest supported value of type
INTEGER_64
.
Maximum_real_32
:
REAL_32
is {REAL_32 3.4028234663852885981170418348451692544e+38}
constant attribute
{}
top
Largest non-special (no NaNs nor infinity) supported value of type
REAL_32
.
Maximum_real
:
REAL_64
{}
top
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: 1.79769313486231570....e+308
Maximum_real_64
:
REAL_64
{}
top
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: 1.79769313486231570....e+308
Maximum_real_80
:
REAL_EXTENDED
{}
top
Largest supported value of type
REAL_80
.
ensure
meaningful:
Result >=
Maximum_real
Minimum_character_code
:
INTEGER_16
{}
top
Smallest supported code for
CHARACTER
values.
ensure
meaningful:
Result <= 0
Minimum_integer_8
:
INTEGER_8
is -128
constant attribute
{}
top
Smallest supported value of type
INTEGER_8
.
Minimum_integer_16
:
INTEGER_16
is -32768
constant attribute
{}
top
Smallest supported value of type
INTEGER_16
.
Minimum_integer
:
INTEGER_32
is -2147483648
constant attribute
{}
top
Smallest supported value of type INTEGER/
INTEGER_32
.
Minimum_integer_32
:
INTEGER_32
is -2147483648
constant attribute
{}
top
Smallest supported value of type INTEGER/
INTEGER_32
.
Minimum_integer_64
:
INTEGER_64
is -9223372036854775808
constant attribute
{}
top
Smallest supported value of type
INTEGER_64
.
Minimum_real_32
:
REAL_32
is {REAL_32 -3.40282346638528859811704183484516925440e+38}
constant attribute
{}
top
Smallest non-special (no NaNs nor infinity) supported value of type
REAL_32
.
Minimum_real
:
REAL_64
{}
top
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: -1.79769313486231570....e+308
Minimum_real_64
:
REAL_64
{}
top
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: -1.79769313486231570....e+308
Minimum_real_80
:
REAL_64
{}
top
Smallest supported value of type
REAL_80
.
ensure
meaningful:
Result <= 0.0
Boolean_bits
:
INTEGER_32
{}
top
Number of bits in a value of type
BOOLEAN
.
ensure
meaningful:
Result >= 1
Character_bits
:
INTEGER_32
{}
top
Number of bits in a value of type
CHARACTER
.
ensure
meaningful:
Result >= 1
large_enough:
{INTEGER_32 2} ^ Result >=
Maximum_character_code
Integer_bits
:
INTEGER_32
{}
top
Number of bits in a value of type INTEGER.
ensure
integer_definition:
Result = 32
Real_bits
:
INTEGER_32
is 64
constant attribute
{}
top
Number of bits in a value of type REAL.
Pointer_bits
:
INTEGER_32
{}
top
Number of bits in a value of type
POINTER
.