Long ago I started some "web applications" using Delphi 2007 and WebBroker (TWebModule). At the time I assumed you needed a webserver such as Apache or Microsoft IIS in order to create any sort of website. Additionally I don't use most of the Apache features (except for Virtual Server so I can have multiple domains on a single ip address and SSL). So to me Apache is just an extra layer and makes makes debugging difficult.
Now enter Indy (TIdHTTPServer). If I understand correctly, Indy IS a webserver. So by using Indy I am no longer bound to use Apache or some other webserver. Is this correct?
Will I have any issues supporting the Virtual Servers in an Indy environment? And what about SSL. I have searched the literature and from what I can see it fully supports SSL certificates.
I am now in the process of porting some of my application from WebBroker to Indy. This mostly entails replacing within my code references of Request: TWebRequest with ARequestInfo: TIdHTTPRequestInfo and references to Response: TWebResponse with AResponseInfo: TIdHTTPResponseInfo.
Is there anyway to use the TWebModule architecture within Indy so that I don't need to do all of this rewriting?
Lastly is there anything else I need to be concerned with? My goal is to take Apache out of the loop.
Yes, you can use Indy's TidHTTPServer as a webserver, but it's much lower-level than IIS or Apache. There is no concept of virtual servers - this you would have to implement yourself.
Indy does support SSL as well via the OpenSSL dll's.
I imagine the biggest concerns you will have will be security related...there are millions and millions of sites running Apache or IIS and there are a ton of people devoted to finding flaws in those platforms, with a bunch of people fixing some of those flaws as they come up. Not so with Indy... there's one or two guys that respond on newsgroups to bugs that you discover. (One guy in particular, who will probably respond to your question here as well.)
Now, I use Indy HTTP server (along with SecureBlackBox SSL support) and I find it to be great for my purposes.
Indy HTTP server calls the WinSock API, and is able to implement:
A full HTTP/1.1 server;
A full HTTPS server (using either OpenSSL libraries or other third parties, like SecureBlackBox).
AFAIK you can use Indy to publish web modules.
See http://www.2p.cz/files/2p.cz/downloads/howto/indy_soap_web_services_in_delphi.pdf
You can also use other servers, for instance directly the kernel-mode http.sys server, which is used by ISS and .Net WCF for instance, and known to be very stable and efficient (it bypasses the WinSock APIs). Of course, it will serve HTTPS conent, if needed. It is available in standard since Windows XP SP2, and therefore in Vista and Seven. Using this component will let Microsoft will do all the debugging work for you, and it will be updated with the host OS. I use it for instance in our Client-Server ORM, or directly to replace a deprecated DCOM connection, with very good speed and stability on customer side.
Regarding virtual servers - the HTTP 1.1 spec requires clients to send a Host request header so virtual servers know which domain is being used specifically to handle the case when multiple domains have the same IP. TIdHTTPRequestInfo has a Host property for that value. In fact, TIdHTTPServer internally validates to makes sure that an HTTP 1.1 request has the Host header before firing any of its OnCommand... events.
Related
I created a DataSnap web server in Delphi that works as ISAPI in a IIS server. Some parts are not thread-safe and I would like to move FASTCGI. Is it possible?
When you create the DataSnap server from the Wizard, the allowed kind of servers are displayed:
There is no direct FastCgi possibility.
The Stand-Alone server has stability issues, and Apache is not so well supported under Windows, so installing it as an ISAPI module is the best known solution...
From a Web Server running in Windows 2012, I would need to send messages to specific clients. These clients are Delphi applications, over 2000. Each message is for a specific client, no broadcast.
Which technology can I use? I am totally new on this issue.
I am seeing Websockets, SignalR (that is based in Websockets), MSMQ, RabbitMQ, ...
MSMQ: Seems a good solution. Cons: It only works in Windows. Maybe in a future, I need to add other platforms as clients.
RabbitMQ: It is also good,but I think that it provides too features for my scenario. Basically I only need to send messages from server to specific clients.
SignalR: I am confused. It seems basically for web browsers, not for client applications. It seems a simple solution.
Basically, I am looking a simple and basic solution that I can implement in Delphi to receive messages from a web server.
WebSocket (a HTTP upgrade) is a light-weight option and also available for Delphi clients:
WebSocket is designed to be implemented in web browsers and web
servers, but it can be used by any client or server application. The
WebSocket Protocol is an independent TCP-based protocol.
See WebSocket client implementations for Delphi
RabbitMQ and other solutions are useful for example if the client could be offline while the server wants to send the message. The message broker provides a store where the message will be waiting for the client, even if the server restarts. Also a message broker will reduce load on the HTTP server.
I need to do some simple comms between two sites, including the case where the same website acts as both the client and server.
The client needs to call a server function with signature something like:
complexObject GetData( int, string)
I'm on c#, .Net MVC 4.5 and running on Windows 7 for dev and & Server 2008 for hosting. I'm looking at both Websockets and SignalR, but can't decide on suitability (I don't need javsacript support, it's purely client/server). There also seems to be limitations running Websockets below Windows server 2012, and on combining client & server in the same app/website ( I could remove that requirement if its a serious issue).
Any advice on the right way to go would be great.
You cannot use WebSocket in ASP.NET unless you are using Internet Information Server 8, so you would need Windows 8 or Windows 2012 server.
SignalR will fallback to SSE, ForeverFrame or LongPolling if you are not using IIS8. SSE is unidirectional from server to client, and does not work in IE.
You can host a WebSocket component in a worker role, that runs in the same domain but in different port. Running in the same domain, the WS connection will send the cookie during the HTTP negotiation, but you would have to work out how to associate the user identity.
You can use for example:
XSocket.NET: http://xsockets.net/
SuperSocket: http://superwebsocket.codeplex.com/
That said, you can still use other technologies for communicating from server to server, like a duplex WCF channel.
A Beginner's Guide to Duplex WCF
Duplex Service in WCF
Cheers.
I've got a custom HTTP Server created using Delphi 7 and Ararat Synapse which receives HTTP GET from another application with a simple set of variables.
For example: http://myserver.com/get?Variable1=adsds&Variable2=asdasdasdsa&Variable3=aasdsadasdsad
The application source is similar to this - http://searchco.de/codesearch/view/13374072
Now, my customer needs me provide a SOAP interface. Completely new to SOAP, I did some research and found it to be very complicated. I would like to know what's the easier way to incorporate this interface to my HTTP server. Or should I find ready made SOAP To HTTP Conversion app if there is such a software. Thank you.
Note: I'm not the original developer of the HTTP Server.
There is a Web Service Toolkit for Free Pascal and Delphi which can be used to write SOAP servers.
I have not yet used it myself but it is in active development and might be compatible with Synapse.
Update: the current version seems to include support for Internet Direct (Indy) and Synapse (HTTP server and TCP server).
You need to write a SOAP server, which not only generates SOAP responses from SOAP requests, but which also provides a WSDL document telling the users what requests they can make.
Since your completely new to SOAP here are some 'starter' links:
General:
SOAP, WDSL, HTTP, XSD? What the?
List of publicly available web services (I would start writring a small testapp that consumes SOAP)
With Delphi:
Developing Web Services with Delphi
Web Services Made Easy With Delphi
Web services with Delphi
The fact that you are using Delphi 7 makes things more difficult, since later versions have better support:
Debugging/Testing Win32 SOAP Web Services (D2007). Bob has more SOAP articles
For testing both serving and consuming SOAP you should use SoapUI, a great free tool (What is SOAPUI?).
Once you are up to the WDSL you should know what types of WSDL exist and the whole namespaces mess...
We recently started using a Squid HTTP proxy server which provides squid-2.5-ntlmssp authentification.
Does somebody know if NTLMSSP is supported by one of the popular HTTP client libraries for Delphi (Indy, Synapse, ICS, nsoftware ...)?
Update: I just read in Wikipedia that
The Windows Service offering the acceptor side of NTLMSSP has been
removed from Windows Vista and Windows Server 2008 in favor of the
newer Kerberos authentication protocol.
So I guess that this auth method will be replaced by Kerberos soon - anyway I'll leave this question - for 'historic studies', or companies which always are a little behind current rocket-science etc. ;)
Related question: How can I get a Kerberos ticket with Delphi?
It seems Wininet should support it when enabled in the registry.
Indy includes a unit named IdAuthenticationNTLM.pas so it probably supports it, too.