In HTTP 1.1, all connections between the browser and the server are considered persistent unless declared otherwise. Persistence, in this context, means to use a single TCP connection to send. The original model of HTTP, and the default one in HTTP/1.0, is short-lived connections. Each HTTP request is completed on its own connection; this means a TCP handshake happens before each HTTP request, and these are serialized.
It's actually very simple using Telnet to connect to a webserver and download HTML or other files.
First you need to connect to the server using an IP address or hostname:
Http11inputbuffer.java:418
$ telnet XXX.XX.XX.XXX 80
Then request the page you want. HEAD and GET are the most common options. HEAD will return information about the requested file/page, but not the content. GET will retrieve both the Header information as well as the content, terminated with 0.
Following the HEAD/GET command you need to specify HTTP/1.1. Then on the next line specify the Host domain name. HTTP/1.1 allows formultiple domains to be hosted at a single IP address so this isimportant. The User-Agent and other options can be specified onsubsequent lines.
GET / HTTP/1.1Host: www.example.comUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
The command is executed after a blank line is entered (press Enter twice).
Working Example
Enter an IP address, Hostname and Request URI in the form below andit will make a HEAD request to the server in question and display theresults:
Note: For security we've limited the inputs to this script. Only valid IPv4 IP addresses are accepted for the Server IP. TheHostname field accepts letters, numbers, hyphens and periods. TheRequest field also accepts the forward slash, and must (obviously) startwith one. Turtle sketch on a notebooks.
If no output appears below then the server didn't respond (after 5 seconds).
Requesting a secure (HTTPS) address
To request a page from a secure (SSL) server on port 443 you can use openssl instead of telnet. Other than that the method is the same:
$ openssl s_client -connect XXX.XX.XX.XXX:443.. connection information will be displayed ..GET / HTTP/1.1Host: www.example.com
This is useful for testing whether a web server certificate has been installed properly without having to update the DNS before you can check.
To open an SSL connection to a live website you should always connect using the domain name and not the ip address.
References
Send a message to The Art of Web:
press <Esc> or click outside this box to close
User Comments
Post your comment or questionAbstract the protocol implementation, including threading, etc. Processor is single threaded and specific to stream-based protocols, will not fit Jk protocols like JNI.
- Author:
- Remy Maucherat, Costin Manolache
Nested Class Summary | |
---|---|
protected static class | Http11Protocol.Http11ConnectionHandler |
Field Summary | |
---|---|
protected Adapter | adapter The adapter, used to call the connector. |
protected java.util.HashMap<java.lang.String,java.lang.Object> | attributes |
protected Http11Protocol.Http11ConnectionHandler | cHandler |
protected java.lang.String | clientCertProvider When client certificate information is presented in a form other than instances of X509Certificate it needs to be converted before it can be used and this property controls which JSSE provider is used to perform the conversion. |
protected java.lang.String | compressableMimeTypes |
protected java.lang.String | compression Integrated compression support. |
protected int | compressionMinSize |
protected boolean | disableUploadTimeout If true, the regular socket timeout will be used for the full duration of the connection. |
protected java.lang.String | domain |
protected JIoEndpoint | endpoint |
protected int | keepAliveTimeout The number of seconds Tomcat will wait for a subsequent request before closing the connection. |
protected static Log | log |
protected int | maxHttpHeaderSize Maximum size of the HTTP message header. |
protected int | maxKeepAliveRequests Maximum number of requests which can be performed over a keepalive connection. |
protected int | maxSavePostSize Maximum size of the post which will be saved when processing certain requests, such as a POST. |
protected javax.management.MBeanServer | mserver |
protected java.lang.String | noCompressionUserAgents |
protected javax.management.ObjectName | oname |
protected int | processorCache Processor cache. |
protected java.lang.String | restrictedUserAgents User agents regular expressions which should be restricted to HTTP/1.0 support. |
protected javax.management.ObjectName | rgOname |
protected boolean | secure This field indicates if the protocol is secure from the perspective of the client (= https is used). |
protected java.lang.String | server Server header. |
protected static StringManager | sm The string manager for this package. |
protected int | socketBuffer |
protected ServerSocketFactory | socketFactory |
protected java.lang.String | socketFactoryName Name of the socket factory. |
protected boolean | SSLEnabled |
protected SSLImplementation | sslImplementation |
protected java.lang.String | sslImplementationName Name of the SSL implementation. |
protected int | timeout This timeout represents the socket timeout which will be used while the adapter execution is in progress, unless disableUploadTimeout is set to true. |
protected javax.management.ObjectName | tpOname |
Constructor Summary |
---|
Http11Protocol() |
Method Summary | |
---|---|
void | destroy() |
Adapter | getAdapter() |
java.net.InetAddress | getAddress() |
java.lang.String | getAlgorithm() |
java.lang.Object | getAttribute(java.lang.String key) |
java.util.Iterator<java.lang.String> | getAttributeNames() |
int | getBacklog() |
java.lang.String | getCiphers() |
java.lang.String | getClientauth() |
java.lang.String | getClientCertProvider() |
java.lang.String | getCompressableMimeType() |
java.lang.String | getCompression() |
int | getCompressionMinSize() |
boolean | getDisableUploadTimeout() |
java.lang.String | getDomain() |
protected AbstractEndpoint | getEndpoint() |
java.util.concurrent.Executor | getExecutor() |
boolean | getKeepAlive() Return the Keep-Alive policy for the connection. |
int | getKeepAliveTimeout() |
java.lang.String | getKeyAlias() |
java.lang.String | getKeypass() |
java.lang.String | getKeystore() |
java.lang.String | getKeytype() |
int | getMaxHttpHeaderSize() |
int | getMaxKeepAliveRequests() |
int | getMaxSavePostSize() |
int | getMaxThreads() |
java.lang.String | getName() |
java.lang.String | getNoCompressionUserAgents() |
javax.management.ObjectName | getObjectName() |
int | getPort() |
int | getProcessorCache() |
java.lang.String | getProperty(java.lang.String name) Get a property |
java.lang.String | getProtocols() |
java.lang.String | getRestrictedUserAgents() |
boolean | getSecure() |
java.lang.String | getServer() |
int | getSocketBuffer() |
java.lang.String | getSocketFactory() |
int | getSoLinger() |
int | getSoTimeout() |
java.lang.String | getSslEnabledProtocols() |
java.lang.String | getSSLImplementation() |
boolean | getTcpNoDelay() |
int | getThreadPriority() |
int | getTimeout() |
int | getUnlockTimeout() |
void | init() Init the protocol. |
boolean | isSSLEnabled() |
void | pause() Pause the protocol (optional). |
void | postDeregister() |
void | postRegister(java.lang.Boolean registrationDone) |
void | preDeregister() |
javax.management.ObjectName | preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) |
void | resume() Resume the protocol (optional). |
void | setAdapter(Adapter adapter) The adapter, used to call the connector. |
void | setAddress(java.net.InetAddress ia) |
void | setAlgorithm(java.lang.String k) |
void | setAttribute(java.lang.String name, java.lang.Object value) Pass config info |
void | setBacklog(int backlog) |
void | setCiphers(java.lang.String ciphers) |
void | setClientauth(java.lang.String k) |
void | setClientCertProvider(java.lang.String s) |
void | setCompressableMimeType(java.lang.String valueS) |
void | setCompression(java.lang.String valueS) |
void | setCompressionMinSize(int valueI) |
void | setDisableUploadTimeout(boolean isDisabled) |
void | setExecutor(java.util.concurrent.Executor executor) |
void | setKeepAlive(boolean keepAlive) Set the keep-alive policy for this connection. |
void | setKeepAliveTimeout(int timeout) |
void | setKeyAlias(java.lang.String keyAlias) |
void | setKeypass(java.lang.String k) |
void | setKeystore(java.lang.String k) |
void | setKeytype(java.lang.String k) |
void | setMaxHttpHeaderSize(int valueI) |
void | setMaxKeepAliveRequests(int mkar) |
void | setMaxSavePostSize(int valueI) |
void | setMaxThreads(int maxThreads) |
void | setNoCompressionUserAgents(java.lang.String valueS) |
void | setPort(int port) |
void | setProcessorCache(int processorCache) |
void | setProperty(java.lang.String name, java.lang.String value) Set a property. |
void | setProtocols(java.lang.String k) |
void | setRestrictedUserAgents(java.lang.String valueS) |
void | setSecure(boolean b) |
void | setServer(java.lang.String server) |
void | setSocketBuffer(int socketBuffer) |
void | setSocketFactory(java.lang.String valueS) |
void | setSoLinger(int soLinger) |
void | setSoTimeout(int soTimeout) |
void | setSSLEnabled(boolean SSLEnabled) |
void | setSslEnabledProtocols(java.lang.String k) |
void | setSSLImplementation(java.lang.String valueS) |
void | setTcpNoDelay(boolean tcpNoDelay) |
void | setThreadPriority(int threadPriority) |
void | setTimeout(int timeout) |
void | setUnlockTimeout(int unlockTimeout) |
void | start() Start the protocol. |
Methods inherited from class org.apache.coyote.AbstractProtocol |
---|
createName, getLocalPort, getMaxCookieCount, getMaxHeaderCount, getNameIndex, nextNameIndex, setMaxCookieCount, setMaxHeaderCount |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
log
sm
- The string manager for this package.
cHandler
endpoint
tpOname
rgOname
socketFactory
sslImplementation
attributes
adapter
- The adapter, used to call the connector.
processorCache
- Processor cache.
socketBuffer
secure
- This field indicates if the protocol is secure from the perspective of the client (= https is used).
SSLEnabled
socketFactoryName
- Name of the socket factory.
sslImplementationName
- Name of the SSL implementation.
maxKeepAliveRequests
- Maximum number of requests which can be performed over a keepalive connection. The default is the same as for Apache HTTP Server.
keepAliveTimeout
- The number of seconds Tomcat will wait for a subsequent request before closing the connection. The default is the same as for Apache HTTP Server (15 000 milliseconds).
timeout
- This timeout represents the socket timeout which will be used while the adapter execution is in progress, unless disableUploadTimeout is set to true. The default is the same as for Apache HTTP Server (300 000 milliseconds).
maxSavePostSize
- Maximum size of the post which will be saved when processing certain requests, such as a POST.
maxHttpHeaderSize
- Maximum size of the HTTP message header.
disableUploadTimeout
- If true, the regular socket timeout will be used for the full duration of the connection.
compression
- Integrated compression support.
noCompressionUserAgents
compressableMimeTypes
compressionMinSize
restrictedUserAgents
- User agents regular expressions which should be restricted to HTTP/1.0 support.
server
- Server header.
clientCertProvider
- When client certificate information is presented in a form other than instances of
X509Certificate
it needs to be converted before it can be used and this property controls which JSSE provider is used to perform the conversion. For example it is used with the AJP connectors, the HTTP APR connector and with theSSLValve
. If not specified, the default provider will be used.
domain
oname
mserver
Constructor Detail |
---|
Http11Protocol
Method Detail |
---|
getEndpoint
- Specified by:
getEndpoint
in classAbstractProtocol
setAttribute
- Pass config info
- Specified by:
setAttribute
in interfaceProtocolHandler
getAttribute
- Specified by:
getAttribute
in interfaceProtocolHandler
getAttributeNames
- Specified by:
getAttributeNames
in interfaceProtocolHandler
setProperty
- Set a property.
getProperty
- Get a property
setAdapter
- Description copied from interface:
ProtocolHandler
- The adapter, used to call the connector.
- Specified by:
setAdapter
in interfaceProtocolHandler
getAdapter
- Specified by:
getAdapter
in interfaceProtocolHandler
init
- Description copied from interface:
ProtocolHandler
- Init the protocol.
- Specified by:
init
in interfaceProtocolHandler
- Throws:
java.lang.Exception
start
- Description copied from interface:
ProtocolHandler
- Start the protocol.
- Specified by:
start
in interfaceProtocolHandler
- Throws:
java.lang.Exception
pause
- Description copied from interface:
ProtocolHandler
- Pause the protocol (optional).
- Specified by:
pause
in interfaceProtocolHandler
- Throws:
java.lang.Exception
resume
- Description copied from interface:
ProtocolHandler
- Resume the protocol (optional).
- Specified by:
resume
in interfaceProtocolHandler
- Throws:
java.lang.Exception
destroy
- Specified by:
destroy
in interfaceProtocolHandler
- Throws:
java.lang.Exception
getName
getProcessorCache
setProcessorCache
getSocketBuffer
setSocketBuffer
getSecure
setSecure
isSSLEnabled
setSSLEnabled
getSocketFactory
setSocketFactory
getSSLImplementation
setSSLImplementation
getMaxKeepAliveRequests
setMaxKeepAliveRequests
getKeepAliveTimeout
setKeepAliveTimeout
getTimeout
setTimeout
getMaxSavePostSize
setMaxSavePostSize
getMaxHttpHeaderSize
setMaxHttpHeaderSize
getDisableUploadTimeout
setDisableUploadTimeout
getCompression
setCompression
getNoCompressionUserAgents
setNoCompressionUserAgents
getCompressableMimeType
setCompressableMimeType
getCompressionMinSize
setCompressionMinSize
getRestrictedUserAgents
setRestrictedUserAgents
setServer
getServer
getExecutor
setExecutor
getMaxThreads
setMaxThreads
getThreadPriority
setThreadPriority
getBacklog
setBacklog
getPort
setPort
getAddress
setAddress
Http1.1 403 Forbidden
getTcpNoDelay
setTcpNoDelay
getSoLinger
setSoLinger
getSoTimeout
setSoTimeout
getUnlockTimeout
setUnlockTimeout
getKeepAlive
- Return the Keep-Alive policy for the connection.
setKeepAlive
- Set the keep-alive policy for this connection.
getKeystore
setKeystore
getKeypass
setKeypass
getKeytype
Rfc2616
setKeytype
getClientauth
setClientauth
getProtocols
setProtocols
getSslEnabledProtocols
setSslEnabledProtocols
getAlgorithm
setAlgorithm
getCiphers
setCiphers
getKeyAlias
setKeyAlias
getClientCertProvider
setClientCertProvider
getObjectName
getDomain
Http2 Vs Http1
preRegister
Http11aprprotocol
- Specified by:
preRegister
in interfacejavax.management.MBeanRegistration
- Throws:
java.lang.Exception
postRegister
- Specified by:
postRegister
in interfacejavax.management.MBeanRegistration
preDeregister
- Specified by:
preDeregister
in interfacejavax.management.MBeanRegistration
- Throws:
java.lang.Exception
postDeregister
- Specified by:
postDeregister
in interfacejavax.management.MBeanRegistration
Overview | Package | Class | Tree | Deprecated | Index | Help |