[hobbit] HTTP Red

Henrik Stoerner henrik at hswn.dk
Tue Nov 7 22:53:11 CET 2006


On Tue, Nov 07, 2006 at 01:50:07PM -0600, Hubbard, Greg L wrote:

> a) Hobbit is getting a 404 from the Web server, which means that the URL
> was not right, or for some reason the Web server didn't want to serve up
> the file.

Right. One possible explanation - especially when dynamic webpages are
involved - is that the JSP checks for the "User-Agent" header it gets
from the browser, or in this case from Hobbit's network tester. E.g.
this is often done to accomodate incompatibilities between Internet
Explorer and the rest of the world in how they interpret HTML.

BB sends a HEAD request like this:

  HEAD /SELoginAccess.jsp HTTP/1.0
  User-Agent: BigBrother/1.9c
  Host: myhost.mydomain.com:8068

Hobbit sends a GET request like this:

  GET /SELoginAccess.jsp HTTP/1.1
  Connection: close
  Host: myhost.mydomain.com
  User-Agent: Hobbit bbtest-net/4.2.0
  Accept: */*
  Pragma: no-cache

which should be much more like a "normal" browser request. I dont think
the HTTP 1.0/1.1 difference matters, but you *can* ask Hobbit to use
HTTP 1.0 by defining the URL with "http10" as in

  1.2.3.4 myhost # http10://myhost/SELoginAccess.jsp

The only other difference is that BB includes the port number in the
"Host:" header. I haven't noticed that before. I've just checked the
HTTP 1.1 RFC, and it's true that the "Host" header must include the port
number if it is not the default (80 for http, 443 for https). You may
want to try the attached patch to see if it makes a difference.


It would also be interesting to see what the webserver logs as the 
reason for generating a 404 status.


> b) The file being requested is a jsp -- not sure that this would throw a
> wrench in anything.  I believe Henrik has probably been asked to support
> jsp retrievals by now.

This is handled entirely by the webserver. As long as it's an HTTP
request, Hobbit doesn't care what kind of data is being requested.


Regards,
Henrik

-------------- next part --------------
--- bbnet/httptest.c	2006/07/20 16:06:41	1.87
+++ bbnet/httptest.c	2006/11/07 21:51:00
@@ -581,6 +581,12 @@
 
 	addtobuffer(httprequest, "Host: ");
 	addtobuffer(httprequest, httptest->bburl.desturl->host);
+	if ((httptest->bburl.desturl->port != 80) && (httptest->bburl.desturl->port != 443)) {
+		char hostporthdr[20];
+
+		sprintf(hostporthdr, ":%d", httptest->bburl.desturl->port);
+		addtobuffer(httprequest, hostporthdr);
+	}
 	addtobuffer(httprequest, "\r\n");
 
 	if (httptest->bburl.postdata) {


More information about the Xymon mailing list