Xml/Xslt - XMLHTTP - error occurred: 411 - Length Required ?

Asked By andy stre on 18-Dec-01 11:40 AM
I'm getting the above error on a simple xmlhttp script to test 
getting a webpage from the internet. My code is copied from http://www.4guysfromrolla.com/webtech/110100-1.shtml

The code works internally but when i try and use it externally it falls foul of the 2nd proxy we have to get thru to get to the internet. Strangely it gets thru the first proxy.

What is this length required and how do I implement it in the script?

I am completely stumped by this. so any help would be much appreciated.

my code is :

  Response.Buffer = True
  Dim objXMLHTTP, xml

  ' Create an xmlhttp object:
   Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

  ' Opens the connection to the remote server.
  xml.Open "GET", "http://www.planetarion.com/", false

  ' Actually Sends the request and returns the data:

If xml.Status >= 400 And xml.Status <= 599 Then
  response.write ("Error Occurred : " & xml.Status & " - " & xml.statusText)
  Response.write (xml.ResponseText)
End If

  'Display the HTML both as HTML and as text
  Response.Write "<h1>The HTML text</h1><xmp>"
  Response.Write xml.responseText
  Response.Write "</xmp><p><hr><p><h1>The HTML Output</h1>"

  Response.Write xml.responseText
  Set xml = Nothing

the whole page i get back can be seen here:

Try using ServerXMLHTTP - Asked By Peter Bromberg on 18-Dec-01 12:32 PM

This allows proxy ports and authentication to be transmitted. See the SDK  CHM help file for details.
MSXML 4.0 is best for this.

PS - Asked By Peter Bromberg on 18-Dec-01 12:34 PM

I see where you are using ServerXMLHttp.
I think you need to look at proxycfg.exe to set the appropriate proxy permissions and configuration.
Sorry about that.

proxycfg - Asked By andy stre on 18-Dec-01 06:23 PM

i have used proxycfg to set the proxy which is immediately infront. it gets thru that one. As far as I know there arent any permissions on the next one. It's completely transparent to us with web browsing. we cant see it. the only other times i have ever seen the type of error pages i get from it is when trying to get to strange FTP directories with irregular names/characters.

I'm trying to figure out what this "length" thing is, something to do with http headers. is it thinking it's the length of the page i'm trying to get or the length of my http header or something else?
"length" could only mean Content-Length - Asked By Peter Bromberg on 18-Dec-01 06:42 PM
But that's a Response, not a Request header. So I am just as lost as you are.
i have found the reason - Asked By andy stre on 20-Jul-14 02:27 PM
i just thought to look groups.google.com, the only place i'd hadnt looked, and i've looked *everywhere* :)
From: Kris Dierckens (kris.dierckens@tectrade.be)
Subject: Re: ServerXMLHTTP and status 411
Newsgroups: microsoft.public.xml.msxml-webrelease
View: Complete Thread (7 articles) | Original Format
Date: 2000-11-03 02:13:03 PST
> When you make a GET request with the ServerXMLHTTP component, it sends a
> Content-Length=0 header. Any parameter to the send method is ignored when
> you make a GET request.
> So perhaps the target server, or the proxy server in between, does not like
> a Content-Length=0 header.
Yes, that's the point.
This 'Squid thing' doesn't like "Content-Length=0" in a HTTP GET request.
But the question is:
1) Can I resolve this by NOT sending "Content-Length=0" in a GET request?
Probably not, since I don't have control over the whole request header.
2) Who is not implementing the HTTP protocol correctly?
- The ServerXMLHTTP component, for sending  "Content-Length=0" in a GET
- The Squid/2.3.STABLE1 proxy, for returning this as a 411 status error.
OK , so here's what you do - Asked By Peter Bromberg on 18-Dec-01 07:31 PM
add ANOTHER header: objXMLHTTP.setRequestHeader("Content-Length", "youractualbyteslength")
  You have "nothing to lose".
I seem to remember somewhere reading in the newsgroups that this fooled it into working. Also, check some of the newgroups at msnews.microsoft.com and the Microsoft PRBS from the MSDN KnowlegeBase search.
thanks - Asked By andy stre on 20-Jul-14 02:27 PM
i will try those things