Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

xport direct - connecting with a hostname
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

xport direct - connecting with a hostname

by ih8gates on Sat Mar 08, 2008 10:57 pm

I've been looking over the Xport docs and can't seem to figure this out. Is there a way to have the Xport direct declare the host name it's looking for when it connects?

I'm connecting to a server that serves different sites based on the hostname, so IP alone won't work.

I tried the syntax:
Code: Select all | TOGGLE FULL SIZE
GET /path/file.ext
Host: www.host.com


to no avail.

has anyone tackled a similar case?
ih8gates
 
Posts: 33
Joined: Mon Jan 28, 2008 7:56 pm
Location: Raleigh, NC

by adafruit on Sat Mar 08, 2008 11:39 pm

http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html

" The absoluteURI form is REQUIRED when the request is being made to a proxy. The proxy is requested to forward the request or service it from a valid cache, and return the response. Note that the proxy MAY forward the request on to another proxy or directly to the server

specified by the absoluteURI. In order to avoid request loops, a proxy MUST be able to recognize all of its server names, including any aliases, local variations, and the numeric IP address. An example Request-Line would be:

GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1

To allow for transition to absoluteURIs in all requests in future versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies.

The authority form is only used by the CONNECT method (section 9.9).

The most common form of Request-URI is that used to identify a resource on an origin server or gateway. In this case the absolute path of the URI MUST be transmitted (see section 3.2.1, abs_path) as the Request-URI, and the network location of the URI (authority) MUST be transmitted in a Host header field. For example, a client wishing to retrieve the resource above directly from the origin server would create a TCP connection to port 80 of the host "www.w3.org" and send the lines:

GET /pub/WWW/TheProject.html HTTP/1.1
Host: www.w3.org"

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by ih8gates on Sun Mar 09, 2008 1:20 pm

thanks yet again.

that did, of course, do the trick.
ih8gates
 
Posts: 33
Joined: Mon Jan 28, 2008 7:56 pm
Location: Raleigh, NC

Re: xport direct - connecting with a hostname

by mungbean on Sat May 03, 2008 6:57 pm

ih8gates wrote:I'm connecting to a server that serves different sites based on the hostname, so IP alone won't work.

I tried the syntax:
Code: Select all | TOGGLE FULL SIZE
GET /path/file.ext
Host: www.host.com


to no avail.

has anyone tackled a similar case?


For the Host line to work you need to specify the HTTP request as HTTP 1.1, whereas the server may be assuming no version specified means HTTP 1.0. The version spec goes on the end of the GET.

So the request should read:

Code: Select all | TOGGLE FULL SIZE
GET /path/file.ext HTTP/1.1
Host: www.host.com


This worked for me in a recent projecting using a WiPort, which is almost the same as Xport (except even more frustrating to set up...!)

mungbean
 
Posts: 1
Joined: Sat May 03, 2008 6:53 pm

Please be positive and constructive with your questions and comments.