eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPConnection':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: HTTPConnection


Inheritance:

   Object
   |
   +--HTTPConnection
      |
      +--FCGIConnection
      |
      +--HTTPSConnection

Package:
stx:goodies/webServer
Category:
Net-Communication-HTTP-Server
Version:
rev: 1.63 date: 2024/03/26 13:06:26
user: cg
file: HTTPConnection.st directory: goodies/webServer
module: stx stc-classLibrary: webServer

Description:


I represent a still active http connection and will serve requests from this
until closed.

copyright

COPYRIGHT (c) 2003 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

accessing
o  defaultConnectionProcessStackSize

o  defaultConnectionProcessStackSize: something
HTTPConnection defaultConnectionProcessStackSize:2*1024*1024

defaults
o  idleTimeoutToCloseConnection
the number of idle seconds, after which a kept connection is closed

o  maxRequestHeaderSize
return the maximum size of a requests header

o  maxUploadSizeWithoutWriteToFile
above that, uploads are written to a file

o  maxUploadSizeWithoutWriteToFile: anInteger
above that, uploads are written to a file

Usage example(s):

    self maxUploadSizeWithoutWriteToFile:100*1024
    self maxUploadSizeWithoutWriteToFile:500*1024*1024

o  requestTimeOut
return the maximum time in secs until a request times out

o  requestTransmitTimeOut
return the maximum time in secs until a request must be transmitted


Instance protocol:

accessing
o  httpServer

o  httpServer: something

o  isWebSocketConnection

o  keepConnection: aBoolean
can be set to false during request handling to tell the requestor
to not expect me to keep the socket open.
By default, the httpServer decides and usually keeps a few connections
open

o  lastRequestTime

o  lastRequestTime: something

o  serveProcess

o  socket

o  socket: aSocket

o  startReadRequestTime

o  verbose
return the verbose messages flag from the server

o  verboseData
return the verbose-data flag from the server

o  verboseErrors
return the verbose errors flag from the server

closing
o  close
force an immediate close and terminate the process

o  closeSocket
close down the connection

o  scheduleForClose
remember to close the connection after processing

converting
o  becomeWebSocketConnection

logging
o  debugError: msg
debug-report some error condition to the Transcript

o  debugInfo: msg
debug-report some trace information to the Log

o  flushLog
flush our buffered log

o  logAccess: request
MessageTally spyDetailedOn:[

o  logError: aString
Add to the log.

o  logReply: aString
Add to the log.

o  logStream

o  logStream: aStream
set the log stream

o  logString: aString
Add to the log.

o  logWarning: aString
Add to the log.

printing
o  printOn: aStream
aStream nextPutAll:' n='.

Usage example(s):

requestCount printOn:aStream.

queries
o  overallNumberOfRequests
the number of served requests in this connection

o  requestTimeToPerform
what a stupid name

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  timeInRequest
the time we have spent in the current request
Or the last one, if finished.
In milliseconds or nil

o  timeToPerformRequest
the time it took to perform the previous request.
In milliseconds or nil

serving-processing
o  getContentLengthFrom: requestString

o  process
serve the connection (as a new process)

o  readQueryDataForPostMessageFrom: header
returns either the data or a stream on it (for huge post data as with an upload)

o  readUpToEndOrSize: nMax into: aStream
returns nil on error; nonNil if OK

o  readUpToEndOrSize: nMax into: buffer startingAt: startIndex
returns nil on error; nonNil if OK

o  serve
main loop on a connection:
- read request
- generate reply

when leaving the loop, the connection will be closed by our sender

o  setKeepConnectionForRequest: aRequest
handle keepConnection as specified in aRequest.
Notice: this is invoked BEFORE the request is actually handled - if a service
detects a bad guy or intruder, it may still choose to invoke keepConnection:false

o  waitForAndFetchRequest
Read the request and return an HTTPRequest instance,
or nil on any error.

startup & release
o  initializeFor: anHTTPServer socket: aSocket
initialize a connection served by aHTTPServer on aSocket

o  initializeFor: anHTTPServer socket: aSocket tlsCertificateStore: tlsCertificateStore
initialize a connection served by aHTTPServer on aSocket.
Serve a TLS connection if tlsCertificateStore is non-nil.

test support
o  quickSendTestResponse
used only for tests

testing
o  isKeepAlive

o  isOpen

o  shouldTimeout
answer true, if the currently pending request should timeout



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 21 Nov 2024 12:56:46 GMT