Archive of UserLand's first discussion group, started October 5, 1998.
Tip: Calling a UserLand server via HTTP
Author: Dave Winer Posted: 2/15/1999; 6:15:56 AM Topic: Tip: Calling a UserLand server via HTTP Msg #: 2897 Prev/Next: 2896 / 2898
Over the weekend Chuck Shotton tripped over a little potential glitch that people working in environments other than Frontier might trip over, so I thought it was a good idea to post a little tip and an explanation.This tip is important for people making XML requests of a Frontier server from another scripting environment, such as Perl, Tcl, Python or Java, for example.
The HOST header
As a server environment Frontier sometimes depends on the HOST header in the HTTP request. That's how we implement virtual domains, we keep a table that maps hosts onto serving addresses. If you don't specify a host, you'll get a top level directory of the www folder on the server, which isn't what you're looking for, probably.
The only time you don't have to worry about this is for XML-RPC requests. They don't follow the virtual domain scheme, for historic reasons. So you can just send the message to 206.204.24.20 if you're doing XML-RPC, or you can use any of the aliases, like discuss.userland.com or www.xmlrpc.com or www.mailtothefuture.com.
Example
POST /mostRecentScriptingNews.xml HTTP/1.0 User-Agent: MyScriptingEnvironment/4.2.3 (Solaris) Host: news.userland.com Content-Type: text/html Content-length: 181Virtual domains
Here's a page that shows all the virtual domains on this one machine. You may find it surprising how far we've gone with this idea. It's a very modular way to develop a server and a very easy way to organize your work. And it's nice for the user too.
Chuck's trip
How did Chuck trip over this? He sent an HTTP request for /mostRecentScriptingNews.xml. He got back HTML, the directory listing. Once he set the HOST to news.userland.com, the problem was fixed, he got the XML-formatted response he wanted.
A software decision
I know some people feel it's not cool to require the HOST header, but we've made a decision. It's like deciding not to support 512K Macs or Windows 3.1. It's how software moves forward, and it's no different with the Internet. It's just software.
Frontier scripts
As long as you use the built-in verb tcp.httpClient you have nothing to worry about, it automatically adds the HOST header.
There are responses to this message:
- Re: Tip: Calling a UserLand server via HTTP, Wesley Felter, 2/15/1999; 9:36:14 AM
This page was archived on 6/13/2001; 4:47:53 PM.
© Copyright 1998-2001 UserLand Software, Inc.