GithubHelp home page GithubHelp logo

Comments (5)

yaoweibin avatar yaoweibin commented on May 6, 2024

Smart compile! It seems the problem is in ngx_http_find_virtual_server, could you help us to fix this bug?

from tengine.

magicbear avatar magicbear commented on May 6, 2024

I had reviews the code for ngx_http_find_virtual_server, it seems works fine. But I dont know why it will cause fail.
The most easy way to fix it is

--- a/src/http/ngx_http_request.c 2014-01-08 20:24:46.000000000 +0800
+++ b/src/http/ngx_http_request.c 2014-01-12 02:49:03.757373929 +0800
@@ -2106,7 +2106,7 @@ ngx_http_set_virtual_server(ngx_http_req
ngx_int_t rc;
ngx_http_connection_t *hc;
ngx_http_core_loc_conf_t *clcf;

  • ngx_http_core_srv_conf_t *cscf;
  • ngx_http_core_srv_conf_t *cscf = NULL;

hc = r->http_connection;

But I think this fix way is incorrent, so I haven't commit it.

from tengine.

yaoweibin avatar yaoweibin commented on May 6, 2024

In the function ngx_http_find_virtual_server, it will return NGX_DECLINDE when virtual_names is NULL. At that time, cscf is unintialized.

from tengine.

magicbear avatar magicbear commented on May 6, 2024

Here is the code after preprocess
after ngx_http_find_virtual_server the only possible value for rc: -1, -5, 0, when -1 direct exit. 0 is normal. only -5 need continue to check. Then when rc == -5 and next need cscf is sscf, but before this, cscf will set to hc->addr_conf->default_server, otherwise if no ssl_servername, will return 0, it seems works normally. I think that may be gcc bug.

rc = ngx_http_find_virtual_server(r->connection,
                                  hc->addr_conf->virtual_names,
                                  host, r, &cscf);

if (rc == -1) {
    ngx_http_close_request(r, 500);
    return -1;
}



if (hc->ssl_servername) {
    ngx_http_ssl_srv_conf_t *sscf;

    if (rc == -5) {
        cscf = hc->addr_conf->default_server;
        rc = 0;
    }

    sscf = (cscf->ctx)->srv_conf[ngx_http_ssl_module.ctx_index];

    if (sscf->verify) {
        if ((r->connection->log)->log_level >= 7) ngx_log_error_core(7, r->connection->log, 0, "client attempted to request the server name " "different from that one was negotiated")

                                                               ;
        ngx_http_finalize_request(r, 400);
        return -1;
    }
}



if (rc == -5) {
    return 0;
}

from tengine.

yaoweibin avatar yaoweibin commented on May 6, 2024

OK, I saw the code path below, it should be OK. It seems a negative warning. Should I close this issue. It should be the compile's problem.

from tengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.