1 Can't appear to get 'wiki' functions (i.e. editing) running when ikiwiki is running on a port other than the default (port 80). Somewhere in the processing it considers the base URL to exclude the port number and the websever throws back an error finding the page.
3 For example if you run on 'http://my.gear.xxx:8080/' then after clicking login (using default password auth) it will process and try to redirect you to 'http://my.gear.xxx/cgi-bin/ikiwiki.cgi'. I'm assuming that somewhere we've used the 'path' and the 'host' and dropped the remainder. I can figure out where this is yet but I'll post back if I get lucky.
7 NB: both the 'url' and the 'cgiurl' include the port and removing the port element provides the expected functionality.
11 > I tried to reproduce this by making my laptop's web server use port
12 > 8080. Set up ikiwiki to use that in cgiurl and url, and had
13 > no problem with either openid or password auth login.
15 > Ikiwiki has had some changes in this area in the past year; you don't say
16 > what version you were using. It could also be a problem with your web
17 > server, conceviably, if didn't correctly communicate the port to the cgi
22 >> I did think of that so threw a 'printenv' script to check the port was arriving
26 >>> HTTP_HOST=zippy0.ie0.cobbled.net
30 >>>> In apache, `HTTP_HOST` includes the port. This is not part of the CGI
31 >>>> spec it seems, but perl's `CGI` module seems to rely on it,
32 >>>> in `virtual_port`:
34 >>>>> my $vh = $self->http('x_forwarded_host') || $self->http('host');
35 >>>>> my $protocol = $self->protocol;
37 >>>>> return ($vh =~ /:(\d+)$/)[0] || ($protocol eq 'https' ? 443 : 80);
39 >>>> The `CGI` module only looks at `SERVER_PORT` when there's no
40 >>>> `HTTP_HOST`. So this is either a bug in perl's CGI or thttpd.
47 >>>>> This is interesting. If HTTP_HOST is wrong then
49 >>>>> 0. the client header must be wrong (i.e. not including the PORT)
50 >>>>> 0. `perl`'s doing something bad[tm] (or at least lazy)
51 >>>>> 0. `apache` is adding it
52 >>>>> 0. `thttpd` is stripping it
54 >>>>> Quick hack shows that `thttpd` must be stripping the port
55 number from the `Host:` header. That can be fixed.
57 >>>>> Thanks for the assist. -- fergus
61 Patch for `thttpd-2.25b` for posterity and completeness
65 diff --git a/libhttpd.c b/libhttpd.c
66 index 73689be..039b7e3 100644
69 @@ -2074,9 +2074,6 @@ httpd_parse_request( httpd_conn* hc )
71 cp += strspn( cp, " \t" );
73 - cp = strchr( hc->hdrhost, ':' );
74 - if ( cp != (char*) 0 )
76 if ( strchr( hc->hdrhost, '/' ) != (char*) 0 || hc->hdrhost[0] == '.' )
78 httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" );