HTTPSserver/X

HTTPSERVER/X™ - HTTP Server ActiveX Control and COM Object
Download

HTTPSserver/X Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Demo
  • Price:
  • USD 199.00
  • Publisher Name:
  • HTTPSserver/X
  • Publisher web site:
  • http://www.mabry.com/httpserverx/index.htm
  • Operating Systems:
  • Windows All
  • File Size:
  • 1.3 MB

HTTPSserver/X Tags


HTTPSserver/X Description

HTTPServer/X allows you to easily implement a custom web service without the overhead or complications of the Internet Information Services. By using HTTPServer/X, you have a complete set of objects which represent the individual client connection, requests, and responses. With HTTPServer/X you can write a complete web server using Visual Basic 5.0/6.0 - with all the power and flexibility it provides. HTTPServer/X also handles Secure Socket Layer (HTTPS) connections transparently.HTTPServer/X has a complete set of events which inform you when any significant event occurs. There are events which notify you when clients have connected and disconnected, when request headers and body have been received, and more. The entire set of events gives you complete control over user validation, and exactly what data to provide in response to a given request.HTTPServer/X also provides a complete Object Model to make your programming easier. The incoming HTTP request is parsed, providing you with easy access to request headers through a Request's Headers collection, and of course the rest of the request is available through the Request Object's BodyStream property. As with other Mabry Software controls, HTTPServer/X uses our unique and powerful Stream Objects which make it easy for you to flexibly handle large or small amounts of data as required by the size of the incoming requests.Although HTTPServer/X is implemented to be a standalone server that handles WEB requests, you can use it together with IIS, Apache, or any other WEBserver which you are currently using. Just by running HTTPServer/X on a different port, you can make it handle specific requests which are hard to examine and evaluate on your primary server. These difficult requests include items such as form submissions, web based emails, database connections, etc.HTTPServer/X provides an easy way for you to receive HTTP requests and provide responses that are static web pages, dynamically created pages, or a combination of these. HTTPServer/X can be used in applications where the overhead and expense of IIS are not desirable, or where you would like to program using Visual Basic instead of a scripting language.HTTPServer/X includes a number of objects which make handling HTTP easy. For instance, incoming requests are parsed and wrapped in easy-to-use Request objects, and you return results using similarly simple Response objects. There are also User, Header, and other objects that provide a powerful and simple object model.The following sections of the HTTPServer/X Overview describe the HTTPServer/X objects and their relationship to each other.HTTPServer/X Object:HTTPServer/X - like Mabry's other Internet components - comes in both OCX and DLL versions. Regardless of which version you use, HTTPServer/X is the root object in the object model. Before your program can begin receiving and processing HTTP requests, you must first assign a port number to the Port property - this is typically 80 but can be any port you choose. Then use the Start method to start the HTTP service running on the specified port. When a client connects to HTTPServer/X, a User Object is instantiated to represent the new client connection. The new User Object is passed as one of the parameters to the UserConnected Event - and a reference to that object is placed in HTTPServer/X's Users Collection. As requests from the client are received and replies sent, other objects are created by HTTPServer/X as required. In addition to its primary functionality, HTTPServer/X also provides some FormatText and FormatDate methods that will make your programming job easier.For example, the FormatText method can be used to create HTML text having various tags. HttpSrvX1.FormatText(TagTITLE,"HTTPServer/X Test Page")produces the following: HTTPServer/X Test PageHttpUsers Collection:HTTPServer/X's Users Property provides a collection of User objects, one for each currently connected user. User objects are created by HTTPServer/X. They are added and removed from the collection by HTTPServer/X. You do not need to - nor can you - modify the contents of the collection programmatically.User Objects in the collection may be accessed either by Index or Key. However, keep in mind that Index is a numeric value that can change at any time so you should exercise caution when using the Index for a collection. For instance, if one user is connected and another connects, the index of the second user's User Object will be 1. However, if the first user then disconnects the index of the second user's User Object will be zero. User Objects have a Key property that will be some string that uniquely identifies a given User Object. If you need to access User Objects through the Users Collection then you should typically use the Key property as an index for the collection and not the numeric value. You may use an index directly if you ensure that no events occur which might lead to the removal of a User Object from the collection. HttpUser Object:The User Object contains various pieces of information about specific connected users. It has methods for sending replies to the user and terminating the user's connection. The User Object has several properties which provide information such as the user's Hostname, total bytes transmitted during this connection, state of the connection, and more.The User Object also has Request and Response Collection objects that are used to keep track of all requests and responses sent by that specific user. The Requests and Responses properties actually point you to appropriate collections. HttpRequests Collection:Each User Object has a Requests Property which is a collection of Request Objects, one for each current request for that user. Request objects are automatically created by HTTPServer/X as requests arrive from a user. A Response object is also created in the User's Responses collection at the time the request is received. For any given Request, you must use the Response object created by HTTPServer/X for that request. See the Request Object and Responses Collection sections of the Overview for further important details.This collection may have more than one member Request Object. Most of the time, clients connect to the server, send one request, receive one response, and disconnect. In such cases the Requests Collection will have only one object (you will access it with Index=0). However, in the HTTP/1.1 version, clients are allowed to use pipelined requests. Pipelined requests are used when a number of items are known by the client to be required, such as some number of graphical images embedded in a page. In such a case, the client program may pipeline a number of requests for all of the images.HttpRequest Object:HTTPServer/X creates a Request Object for a given user - in the User Requests Collection - each time a request is received from the user. The Request Object has several properties, such as a reference to a Headers Collection, the HTTP Method used (GET, POST...), and the full RequestLine.For each Request object a corresponding Response object is created for you, and placed in the User.Responses Collection so you can set its properties prior to ending the response to the requesting user.It is important to bear in mind that there is a direct relationship between the indices of the Request and Response objects in a given User's Request and Response collections. If you are setting properties for a Response to a Request having index 1 in the Requests collection then you must reference the Response object indexed by the same value, 1.Also important is to be aware of the timing of the removal of Request and Response objects from their respective collections. When HttpSever/X fires the ResponseDone event both the Request and Response objects for the response that has just been sent are valid. They are removed when the control returns from the event, and all other Response/Request pairs - if any - are shifted down in the collection.HttpResponses Collection:When HTTPServer/X receives a request from some user it creates a pair of objects, a Request Object and a Response Object, which are placed in the Requests and Responses collections for that User. Responses to specific Requests must be sent in the order the Requests were received. HTTP does not provide any correlation information, such as a sequence number, and so the order of Responses is critical.If there are multiple requests being serviced for a given User at any one time, you may find it convenient to set properties for the various Response objects in some order other than the Request order, but you still must send the Responses in the order they exist in the Responses Collection. For instance, a User might request two pictures as pipelined requests. Imagine that the first picture is very large, and the second one is very small. Most probably, you will be able to fill the second response more quickly than the first one - but this still doesn't mean you can send it to the user because it would be out of order.HttpResponse ObjectA Response Object is automatically generated for each User Request Object. Response Objects are initially blank - since HTTPServer/X has no way to know what you might want them initialized to - and so you need to set properties appropriate for the Response before using the User.SendResponse method to send the response to the user.When you process a received Request, you must set at least the StatusCodeText and StatusCodeNumber properties. The values of other properties will depend upon the type of request and whether it can be accommodated or not. The Body property can be used to send an HTML formatted message to the user, or you can assign a FileStream object to the BodyStream property to send a predefined page. HTTPServer/X will automatically add a 'Content-Length' header, but does not add a 'Content-Type' header since it has no way of knowing what type of content you're sending. You must be sure to set that header to an appropriate value. HttpHeaders Collection:Both Request and Response Objects have a Headers Property - which references a collection of Header Objects. When the user sends a Request - the received Headers are put in the Headers Collection for that Request object. If you want to send headers back in your response, you add them to the Response Object's Headers Collection.HttpHeader Object:Each Header Object has two string properties, Name and Value. A typical request received from a User would be something like the following headers:GET / HTTP/1.0Host: www.mabry.comUser-Agent: some_agentIn the above sample, 'Host' and 'User-Agent' are Names, and 'www.mabry.com' and 'some_agent' are Values. Headers can be added to a Response object using code similar to the following:Responses(0).Headers("Content-Type")="text/html"MultiPartRequest Object:Most HTTP requests are simple, consisting of little more than a few headers and perhaps some text. However there are situations where a Request will be more complex containing, for instance, one or more files in addition to headers and text. When such complex Requests are received, the Request object's MultiPart Property will contain a reference to a MultiPartRequest Object. If the MultiPart Property is not Empty (Null) then a multipart request has been received. The MultiPartRequest object provides properties and methods that allow you to access the various parts of a multipart request.


HTTPSserver/X Related Software