Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In mirror lists, all links are hardcoded to 'http' and can't use #131

Open
poeml opened this issue Jun 5, 2015 · 0 comments
Open

In mirror lists, all links are hardcoded to 'http' and can't use #131

poeml opened this issue Jun 5, 2015 · 0 comments
Labels

Comments

@poeml
Copy link
Owner

poeml commented Jun 5, 2015

                                                                                       [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue131

Title    In mirror lists, all links are hardcoded to 'http' and can't use
             'https'
 Priority  urgent         Status     testing
Superseder              Nosy List    dagobert, poeml, stephan48
 Assigned  poeml         Keywords    mod_mirrorbrain
      To

msg449 (view) Author: poeml Date: 2014-01-12.22:25:55

In mirror lists, all links are hardcoded to 'http' and can't use 'https'. That should
be easy to fix.

msg521 (view) Author: poeml Date: 2014-02-04.22:35:48

Same might apply for port number != 80. Needs to be checked.

msg524 (view) Author: poeml Date: 2014-02-05.22:45:33

There's also the case where a HTTP URL to the redirector is included into torrents
(when no other mirror is available as webseed), and zsync files (when no mirror is
available), yum lists.

The port that the connection came in via (r->connection->local_addr->port) is not
necessarily the right one for a client to use, because there might be a proxy in front
of mod_mirrorbrain.

The Host: headers's value might do the job, but I'm not sure yet.

msg525 (view) Author: poeml Date: 2014-02-05.23:01:20

We probably need to do it like this (cf. mod_rewrite):

 /* add the canonical URI of this URL */
  thisserver = ap_get_server_name(r);
  port = ap_get_server_port(r);
  if (ap_is_default_port(port, r)) {
      thisport = "";
  }
  else {
      thisport = apr_psprintf(r->pool, ":%u", port);
  }

  url = apr_pstrcat(r->pool, ap_http_scheme(r), "://", thisserver, thisport,
                    thisurl, NULL);

In Apache 2.4, there's ap_get_server_name_for_url() instead. This new function handles
the odd case where the server name is an IPv6 literal address (enclosing it in [ ]).

msg527 (view) Author: poeml Date: 2014-02-06.23:44:13

note to self; usage along these lines:
ap_rprintf(r, "%s://%s%s%s\n", ap_http_scheme(r), thisserver, thisport, r->uri);

msg528 (view) Author: poeml Date: 2014-02-06.23:48:03

I committed r8387, which should fix the issue (concerning both http/https and port).
I'm not sure wether all kinds of setups are covered, where MirrorBrain runs behind a
proxying frontend server...

http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8385
http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8387

msg535 (view) Author: dagobert Date: 2014-02-09.11:43:30

It looks like there are more occurrences to be adjusted. I am testing with
the preliminary mod_mirrorbrain 2.19.0 and apache 2.2.26 with a server on http
and on a non-standard port (8080). The following links do not carry the necessary :8080:

  • The links to the hash sums
  • The link to the preferred mirror
  • The links to meta4 and metalink

From your commit messages I read that exactly these should have been fixed. I verified
that your code is actually used to compile my package, so maybe it is an issue between
apache 2.2 and 2.4?

msg537 (view) Author: poeml Date: 2014-02-09.13:18:44

That's indeed strange, because I fixed all those, and used 2.4 for testing!

Looking up the port in Apache involves ap_get_server_port(r) and
ap_is_default_port(port, r) which is supposed to work both under 2.2 and 2.4.

You could add this at line 2527:

ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
              "[mod_mirrorbrain] ap_get_server_port(r): %d",
              ap_get_server_port(r));

and run

apxs2 -ci -Wc,"-Wall -g" -lm mod_mirrorbrain.c && /etc/init.d/httpd restart

It should write something different than 80 to the error log of the virtual host.

msg540 (view) Author: dagobert Date: 2014-02-10.14:12:30

I am ashamed to say that I failed to restart the httpd properly and the new
module wasn't loaded. The port propagation looks good now. Next I will try https.

Best regards and sorry for the noise -- Dago

History
         Date           User   Action              Args
2014-02-10 14:12:30 dagobert set    messages: + msg540
2014-02-09 13:18:44 poeml    set    messages: + msg537
2014-02-09 11:43:30 dagobert set    nosy: + dagobert
                                      messages: + msg535
2014-02-06 23:48:03 poeml    set    status: in-progress -> testing
                                      messages: + msg528
2014-02-06 23:44:13 poeml    set    messages: + msg527
2014-02-05 23:01:50 poeml    set    priority: bug -> urgent
2014-02-05 23:01:20 poeml    set    messages: + msg525
2014-02-05 22:45:34 poeml    set    priority: feature -> bug
                                      messages: + msg524
2014-02-04 22:35:48 poeml    set    messages: + msg521
2014-02-03 17:10:25 dagobert link   issue143 superseder
2014-01-12 22:25:55 poeml    create

(end of migrated issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant