yaoming
asked on
about http protocol and web server
hi,i am making a simple web server and has several questions:
1)As requested by the problem,the web server need to process head method,which is somewhat similar to get method except the entity body.But if i use the internet explorer as a client testing tool.how it can send head method to test this function?
2)how the server can get and return the last modified time of a file using C/C++ since the server need to return this as a return header to the client,i thought there is no such method in their library?
3)how the server determine whether the client has the "cache" locally?as it appears in the return header: cache:no/yes
4)what's the meaning of "Connection:close;" defined in the return header?And when a server need to return this header?
Your Help is greatly Appreciated!
1)As requested by the problem,the web server need to process head method,which is somewhat similar to get method except the entity body.But if i use the internet explorer as a client testing tool.how it can send head method to test this function?
2)how the server can get and return the last modified time of a file using C/C++ since the server need to return this as a return header to the client,i thought there is no such method in their library?
3)how the server determine whether the client has the "cache" locally?as it appears in the return header: cache:no/yes
4)what's the meaning of "Connection:close;" defined in the return header?And when a server need to return this header?
Your Help is greatly Appreciated!
Addition to section 2: What C/C++ libraries do you mean?
ASKER
I just want to know whether there exists any method in C/C++ library that can get the last modified time of a file in a web server root.
ASKER
hi,the circumtance when "Connection:close" and "cache:no"
are used seems clear to me. But can you tell me how the server got to know that circumtance happens?
for example, how the server/client know a connection is no longer persistent after the current request/response is complete?
Your help is greatly appreciated!
are used seems clear to me. But can you tell me how the server got to know that circumtance happens?
for example, how the server/client know a connection is no longer persistent after the current request/response is complete?
Your help is greatly appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanx ,i know what should be done with my server now.
2) HTTP protocol operates with entities rather that FTP, which operates with files. As described in RFC-1945, there could be "Last-Modified" parameter in Entity-Header (likely after "Content-Type" parameter) as follows:
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
3) HTTP server could not determine if the client has a local cache because of the structure of HTTP protocol. Instead, server may provide cache-control directives. Note that this is not a rule that all clients will support them. HTTP 1.0 server could provide
Pragma: no-cache
directive to deny the client or proxy cache this page (see RFC-2068, section 14.32). HTTP 1.1 in addition to this defines a set of cache-control directives (see RFC-2068, section 14.9).
4) (Refer to the RFC-2068) HTTP/1.1 defines the "close" connection option for the sender to signal that the connection will be closed after completion of the response. For example,
Connection: close
in either the request or the response header fields indicates that the connection should not be considered `persistent' (section 8.1) after the current request/response is complete.
If you wish to learn more about HTTP protocol, you must obtain RFC-2068 (and RFC-1945) document which may be found (like another RFC's) at http://www.internic.net .
Good luck!