Virtual Hosts and Host Names in FTP7

I received the following question from Mickey Binder in response to my blog entries about the new FTP service for IIS7:

"When using virtual hosts will it always be necessary to provide DOMAIN|Username or is it me doing something wrong. I can see in your documentation how it should be setup, I just wonder why it still needs the DOMAIN in the user login as this should already be specified by the host I connect to (Like with the http virtual hosts)."

I thought that was a great question, and I think that it deserves a detailed response. The short answer is that you need to provide the host name somehow when connecting to an FTP site, and FTP simply does not work the way that HTTP does. I'll explain why in detail with this blog post.

FTP and HTTP Host Names

HTTP provides a way to pass the host name in the headers that are passed between the client and server, but FTP currently does not provide this same functionality. Looking at one of my older blog posts, I pointed out that there are three ways that you can create unique bindings for a Web/HTTP site: IP address, port, or host header. Based on its current design, FTP can create unique bindings by IP address or port, but the FTP protocol currently does not allow for something like host headers.

Here's why - I'm sure most everyone is aware that HTTP packets consist of a set of headers and possibly a block of data. Here's an example of a simple GET request:

GET /default.aspx HTTP/1.0 [crlf]
Accept: */* [crlf]
[crlf]

When HTTP 1.1 was published in RFC 2068 and RFC 2616 it defined a header for specifying a "host" name in a separate name/value pair:

GET /default.aspx HTTP/1.1 [crlf]
Host: example.com [crlf]
Accept: */* [crlf]
[crlf]

This allows multiple virtual servers ("hosts") on the same IP address and port that are differentiated by host name. While this works great for the HTTP protocol, the FTP protocol currently has no comparable functionality. As such, the FTP protocol would have to be updated to allow multiple hosts on the same IP address and port, then IIS and all FTP clients would need to be updated to accommodate the changes to FTP.

I realize that most everyone is aware that when you attempt to connect to an HTTP or FTP server from a client, the client looks up the IP address using a name server and then creates a connection to the server by IP address. What many people may not realize is that the server is basically unaware of the host name that the client used - at connection time the server is really only concerned with inbound data on the IP address.

That being said, the connection protocol could provide a mechanism for specifying the host name. For example, as I mentioned above the HTTP/1.1 protocol provides a mechanism for specifying host names using a host header and FTP does not. In fact, if you were to open Network Monitor or similar tool and capture an FTP connection between a client and a server, you would be able to see that the host name is not passed as part of the FTP conversation between the client and server.

Host Names in FTP for IIS7

For the new FTP service for IIS7 we wanted to find a way to have host names in FTP, so we approached the situation with two possible ideas:

  1. Find a backwards-compatible method for specifying host names for FTP
  2. See if we could get the FTP protocol updated for host names

In the end, we chose to do both.

FTP Virtual Host Name Support

First of all we have "Virtual Host" names; this is the "ftp.example.com|username" syntax that led to the original question. Here's the way that this can be used in a hosting environment. Let's say that a web hoster has a customer with several Web/FTP sites that he needs to update. The web hoster gives all of his customers the same ftp address, like "ftp.example.com". When setting up the bindings for the Web/FTP sites the web hoster configures each site for the appropriate HTTP/FTP bindings, using host names like "www.contoso.com" & "www.fabrikam.com" for the HTTP bindings and "ftp.contoso.com" & "ftp.fabrikam.com" for FTP bindings. (All of the Web names would be set up in DNS, of course, but the FTP names are somewhat optional as I'll explain later.)

Since HTTP provides host headers to pass the host name, the Web client & Web server will both know which site they're working with. Since FTP doesn't have a built-in way to pass a host name, the customer will connect to the "ftp.example.com" name that his web hoster gave him and log in using the appropriate "ftp.contoso.com|customer" or "ftp.fabrikam.com|customer" syntax. The FTP service for IIS7 will then internally route the FTP activity to the correct site based on the FTP bindings. If the FTP names "ftp.contoso.com" & "ftp.fabrikam.com" were registered in DNS, the client would still need to specify the appropriate "ftp.contoso.com|customer" or "ftp.fabrikam.com|customer" syntax when logging in because the FTP activity did not actually pass the host name in any way.

The great thing about the "Virtual Host" names solution is that it is backwards-compatible because any client should be able to send the "ftp.example.com|username" syntax.

FTP True Host Name Support

We also wanted to see if the FTP protocol could be updated to allow sending a host name as part of the FTP session like HTTP does. After some research I discovered that Robert Elz and Paul Hethmon had provided a detailed discussion of a "HOST" command for FTP in their Internet draft titled "Extensions to FTP" during their work with the FTPEXT Working Group at the IETF. I contacted the two of them and with their approval Paul and I submitted a new IETF draft detailing a HOST command for FTP, which is posted at the following URL:

http://www.ietf.org/internet-drafts/draft-hethmon-mcmurray-ftp-hosts-00.txt

Here's the way that the HOST command works: the FTP server and FTP client both need to know that the HOST command is supported. The FTP client connects to an FTP server using either a DNS name or IP address and sends a FEAT command and sees that HOST is supported, so the client sends "HOST ftp.example.com" before sending USER and PASS, which allows the FTP server to route the request to the correct FTP site based on the bindings. (An FTP client could skip the FEAT command completely and simply attempt a HOST command and process the FTP reply, but that's not the best approach.)

The FTP HOST command solution is not backwards-compatible, however, because an FTP client needs to be able to send the "HOST ftp.example.com" syntax. Some FTP clients allow sending custom commands, which enables this functionality. For example, if you are using the FTP.EXE command-line tool that comes in Windows, you can type "quote HOST ftp.example.com" when connecting to the new FTP server for IIS7 and it will route the request to the appropriate site. In an ideal world, FTP clients will start negotiating the HOST feature behind the scenes and you should never know that this is occurring, which is how almost all Web browsers currently work. (e.g. When you enter "www.example.com" in the address bar of a Web browser it will automatically add the host header to the HTTP request.)

The Final Word

So the long answer to the original question is that you have two ways of specifying a host with the new FTP service for IIS7:

  • FTP "Virtual Host" names are supported using "ftp.example.com|username" syntax
  • True FTP host names are supported using the "HOST ftp.example.com" syntax

So my thanks to Mickey Binder for his great question, and I hope this helps other people understand this concept a little better.

FrontPage 2002 Server Extensions Beta for Longhorn and Vista

Following up on my FrontPage Server Extensions on Vista and Longhorn blog post from last February, I'm happy to announce that Microsoft and Ready to Run Software have released the first beta version of the Microsoft FrontPage 2002 Server Extensions (FPSE 2002) for Windows Server Code Name "Longhorn" and Windows Vista.

The beta version of FPSE 2002 can be downloaded from the following URL:

http://go.microsoft.com/fwlink/?LinkId=86544

Additional documentation about installing and using this version of FPSE 2002 can be found at the following URL:

http://go.microsoft.com/fwlink/?LinkId=88546

It should be noted that this version of FPSE 2002 is a beta release and is therefore unsupported. Also, this version of FPSE 2002 introduces no new functionality; it is essentially the same version of FPSE 2002 that was created for Windows Server 2003 that has been updated to work on Windows Server Code Name "Longhorn" and Windows Vista. That being said, this version of FPSE 2002 will enable web hosters and developers to author their web content on servers or workstations that are running IIS 7.0 on Windows Server Code Name "Longhorn" and Windows Vista.

Feedback about this release can be sent to fpbeta@rtr.com.

FTP 7 Beta is released!

It's been a long time in development, but Microsoft has released a beta version of a new FTP service that we have completely rewritten for Windows Server code name "Longhorn". This new FTP service contains many great new features, such as:

  • Integration of Web sites and FTP sites, allowing you to optionally host Web content and Web authoring on the same site by adding FTP settings.
  • Adoption of the IIS 7.0 administration and configuration files, allowing .NET-style configuration of your FTP sites and using the new IIS 7.0 administration tool to manage your FTP settings.
  • Data security through Secure Sockets Layer (SSL) and FTPS
  • Support for additional Internet FTP standards such as UTF8 and IPv6.
  • Hosting multiple FTP sites on the same IP address through the use of FTP virtual host names.
  • Enhanced user isolation that allows you to create complex heirarchies of virtual directories to lock users into specific content locations.
  • Improved supportability through improved W3C logging, detailed local error messages, and ETW tracing.

There are way too many features to list in such a short space, so a good place for addtional information is the "What’s New for Microsoft and FTP?" article. I encourage you to download the beta version of the new FTP service today, and listed below are the links for the download pages for each of the individual installation packages:

After installing the new FTP server, the following walkthroughs on the www.iis.net web site should help get you started:

In closing, the beta version of this new FTP service has a lot to offer, and we've put a lot of time and effort into making what we think is a great start for the future of FTP for IIS. About the only piece of bad news that I have for anyone is that this new FTP service will not work on Windows Server 2003 with IIS 6.0.

All in all, our team is excited to see people start testing with this beta version. And lest I forget, my special thanks go to:

  • Jaro, Emily, Daniel – for building it
  • Suditi, Cip, Jeong – for testing it
  • Janani, Andrew, Reagan – for making it look pretty

Thanks everyone!

FrontPage Server Extensions on Vista and Longhorn

As most people that have installed IIS 7 on Windows Vista or Windows codenamed "Longhorn" have realized, there are no options to install the FrontPage Server Extensions, leaving the only possibly way to edit your web site that is hosted on a Vista/Longhorn computer is to edit the web site locally using the file system, or to use FTP to upload your files to a remote Vista/Longhorn computer.

The FrontPage Server Extensions (FPSE) 2002 are part of the Office XP system of products. The Office XP system, including FPSE 2002, left mainstream support on July 11th, 2005, according to the Office lifecycle policy. At that time, the FrontPage Server Extensions were removed from the Microsoft Download Center. Office policy is to remove software from the Download Center that is no longer supported. This policy allows us to focus our support efforts on the latest technologies. FPSE 2002 continues to be available on Windows Server 2003 in the Add Windows Components section of the Add/Remove Programs control panel.

FPSE 2002 will continue to be supported by security updates through the end of the extended support period, and all existing security content will remain available. For more information on the support lifecycle policy, see the Microsoft Lifecycle web page at the following URL:

http://support.microsoft.com/?pr=lifecycle

Because Microsoft realizes that the FrontPage Server Extensions are essential to many web hosting companies, the Internet Information Services product team is researching the development of an updated version of FPSE 2002 that will work with Microsoft Windows codenamed "Longhorn" and Microsoft Windows Vista.

Day 4 of IIS at TechEd IT Forum in Barcelona

Well, today was the last day, and the Microsoft Tech∙Ed: IT Forum 2006 in Barcelona has come to an end. I started off the day doing a presentation about using LogParser 2.2 with IIS. Matthew Boettcher took the following photo during the presentation:

Following that presentation, Matthew and I hosted a Chalk & Talk session with Paul Wright and Chad Kraykovic from microsoft.com and Sergei Anatov from the IIS product team. Matthew started off by giving a small recap of the topics that had been covered in the Connected Systems Infrastructure track at Tech∙Ed, then we opened the floor for the next hour and a half to answer any questions. We had around 20 or so people, and between the various attendees we had a great discussion.

A new question that's cropped up with customers over the past few days is whether there will be a web version for the Longhorn Core SKU. I don't have an answer on that, but I wanted to mention that it seems like a lot of customers are interested.

Here's a shot of the exhibition hall around the lunch break:

I worked at the IIS booth for the next three hours after the Chalk & Talk session, then I said my goodbyes to Matthew, Ivan, and Sergei, and my part of this conference was over.

My thanks to all the customers that dropped by and gave us such great feedback!

Day 3 of IIS at TechEd IT Forum in Barcelona

Today was the third day at Microsoft Tech∙Ed: IT Forum 2006 in Barcelona, and customers are still asking some great questions about IIS. Today more customers mostly asked about their current IIS deployments and ways that they could make things better, but occasionally someone would ask, "So what's different about IIS 7?" That's such a great question, because there's so many new features to demo and talk about.

Isaac Roybal from Microsoft was in the booth again today, and we shared the booth with Eric Lawrence and the team representing Internet Explorer 7:

Tomorrow I'm giving a presentation on LogParser, which is one of my favorite IIS utilities.

Day 2 of IIS at TechEd IT Forum in Barcelona

Today was the second day of Microsoft Tech∙Ed: IT Forum 2006 in Barcelona. So far everything seems to be going well, and I've had the chance to talk with some great customers. Once again, the customers that visited our booth are most concerned with Clustering/Load Balancing/Replication and IIS/PHP integration. But that being said, I had the chance to demo some great functionality for customers that dropped by.

Today I was joined by Isaac Roybal from Microsoft, who is a Product Manager in Windows Server Marketing, and we shared the booth with Eric Lawrence, who is a Program Manager for Internet Explorer:

I delivered the first of my presentations today to a crowd of 175, and my feedback scores for the presentation were about the average for the connected systems infrastructure track. The main points that attendees wanted me to do better was to not go so deep in my topics and to slow down a little. (Sigh.)

After we had finished up for the day, Sergei, Isaac, several members of the PowerShell team and I met for dinner with a couple of the guys from MySpace. Here's a shot of Sergei talking with Michael Coates, who is an evangelist on the Platform Evangelism team.

Tomorrow I don't have any presentations, so I should be hanging around the booth most of the day.

Day 1 of IIS at TechEd IT Forum in Barcelona

Today was the first official day of the 2006 Microsoft Tech∙Ed: IT Forum in Barcelona. I caught Bob Muglia's opening keynote address, and there were some great demos: Vista, Office 2007, SharePoint 2007, etc., but the best demo from an IIS perspective was when they managed a web farm of IIS 7 servers using PowerShell. They also discussed the new FastCGI technology in IIS and how it can be used for faster PHP or other CGI technologies.

Sergei Anatov and I were joined at the IIS "Ask The Experts" booth today by Ivan Gonzalez Vilaboa, who is an IIS MVP from spain. (Thanks, Ivan!)

Based on the customers that visited our booth, here are the pressing questions that seemed to be on most everyone's mind regarding the future of IIS:

  • Clustering/Load Balancing/Replication - People want to know what IIS is going to do about these technologies.
    I discussed replication in Vista/Longhorn and using distributed configuration files with IIS 7, but it was still the #1 subject for customers.
  • IIS and PHP - Is IIS going to have a PHP engine built-in?
    There was a bit of confusion on the information that was presented in the keynote address, because several people got the impression that IIS was going to ship with a PHP script engine. I had the misfortune of communicating that this is not the case, and showed people the annoucement on www.iis.net that discusses the technical preview of FastCGI.

That's all for today. See you tomorrow!

Day 0 of IIS at TechEd IT Forum in Barcelona

Today is the main registration day for the 2006 Microsoft Tech∙Ed: IT Forum in Barcelona. The show was sold out weeks ago, so there are 4,750 people scheduled to attend, and another 400 people on the waiting list. There were a few pre-conference sessions today, but the main bulk of the show starts tomorrow.

Sergei Anatov and I will be demonstrating IIS 7 and answering questions for any version of IIS at the IIS/IE booth in the "Ask The Experts" lounge, then later in the week I'll be delivering two presentations on IIS:

  • 17 November at 09:00 - Building a Custom Log Analysis Solution with Log Parser 2.2 for Internet Information Services (IIS) 6 (CSI303)
  • 15 November at 17:00 - An Administrator's Guide to Internet Information Services (IIS) 7.0 (CSI201)

If you're at Tech∙Ed, feel free to drop by and say "Hi!"

Converting W3C log files to NCSA format

Around a year ago I wrote a blog entry titled "Converting NCSA log files to W3C format", which showed how to use the MSWC.IISLog object to convert log files in the NCSA format back to W3C format. I wrote that blog entry to make up for the fact that the CONVLOG.EXE utility only converts log files to NCSA format, which some older log analysis software packages require. So what happens if you have a bunch of log files in W3C format and you don't have a copy of CONVLOG.EXE on your computer?

This blog entry is something of a reverse direction on my previous post, and shows you how to use the MSUtil.LogQuery object to convert W3C log files to NCSA format. The MSUtil.LogQuery object is shipped with LogParser, which you can download from one of the following URLs:

Once you've downloaded and installed the LogParser package, you will need to manually register the LogParser.dll file in order to use the MSUtil.LogQuery object. Having done so, you can use the Windows Script Host (WSH) code in this blog article to convert a folder filled with W3C log files to NCSA format. 

To use this code, just copy the code into notepad, and save it with a ".vbs" file extension on your system. To run it, copy the script to a folder that contains your W3C log files, (named "ex*.log"), then double-click it.

Option Explicit
Dim objFSO
Dim objFolder
Dim objInputFile
Dim objOutputFile
Dim objLogQuery
Dim objLogRecordSet
Dim objLogRecord
Dim strInputPath
Dim strOutputPath
Dim strLogRecord
Dim strLogTemp

Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(".")

For Each objInputFile In objFolder.Files
 strInputPath = LCase(objInputFile.Name)
 If Left(strInputPath,2) = "ex" And Right(strInputPath,4) = ".log" Then
  strOutputPath = objFolder.Path & "\" & "nc" & Mid(strInputPath,3)
  strInputPath = objFolder.Path & "\" & strInputPath
  Set objLogQuery = CreateObject("MSUtil.LogQuery")
  Set objLogRecordSet = objLogQuery.Execute("SELECT * FROM " & strInputPath)
  Set objOutputFile = objFSO.CreateTextFile(strOutputPath)
  Do While Not objLogRecordSet.atEnd
  
   Set objLogRecord = objLogRecordSet.getRecord
   strLogRecord = FormatField(objLogRecord.getValue("c-ip"))
   strLogRecord = strLogRecord & " " & FormatField("")
   strLogRecord = strLogRecord & " " & FormatField(objLogRecord.getValue("cs-username"))
   strLogTemp = BuildDateTime(objLogRecord.getValue("date"),objLogRecord.getValue("time"))
   strLogRecord = strLogRecord & " " & FormatField(strLogTemp)
   strLogRecord = strLogRecord & " """ & FormatField(objLogRecord.getValue("cs-method"))
   strLogRecord = strLogRecord & " " & FormatField(objLogRecord.getValue("cs-uri-stem"))
   strLogTemp = FormatField(objLogRecord.getValue("cs-version"))
   If strLogTemp = "-" Then
    strLogRecord = strLogRecord & " HTTP/1.0"""
   Else
    strLogRecord = strLogRecord & " " & strLogTemp & """"
   End If   
   strLogRecord = strLogRecord & " " & FormatField(objLogRecord.getValue("sc-status"))
   strLogRecord = strLogRecord & " " & FormatField(objLogRecord.getValue("sc-bytes"))
    objOutputFile.WriteLine strLogRecord
   objLogRecordSet.moveNext
  Loop
  
  Set objLogQuery = Nothing
  objOutputFile.Close
 
 End If
Next

Function FormatField(tmpField)
 On Error Resume Next
 FormatField = "-"
 If Len(tmpField) > 0 Then FormatField = Trim(tmpField)
End Function

Function BuildDateTime(tmpDate,tmpTime)
 On Error Resume Next
 BuildDateTime = "[" & _
  Right("0" & Day(tmpDate),2) & "/" & _
  Left(MonthName(Month(tmpDate)),3) & "/" & _
  Year(tmpDate) & ":" & _
  Right("0" & Hour(tmpTime),2) & ":" & _
  Right("0" & Minute(tmpTime),2) & ":" & _
  Right("0" & Second(tmpTime),2) & _
  " +0000]"
End Function

I hope this helps!