Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7005543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:21:52+00:00 2026-05-27T21:21:52+00:00

I am trying to understand a particular web architecture. There is a cgi web

  • 0

I am trying to understand a particular web architecture.
There is a cgi web application which works this way.

The request from web browser comes to the apache web server which is then routed to an application dispatcher.

Application dispatcher has a config file which has all the possibles commands and its corresponding handler methods.

Say, if there is a cmd=_login request from the browser, dispatcher looks for config file which may have this entry.

Command: _login

Handler: handle_login()

Header: login.h

Binary: Exe_name

So, what are the ways by which, application dispatcher can fork the cgi binary (Exe_name) and directly invoke handle_login() function?

Can a particular method be directly invoked?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:21:52+00:00Added an answer on May 27, 2026 at 9:21 pm

    There are basically two approaches to doing symbol resolution.

    Built-in symbol resolution.

    Depending on your system, you may be able to look up regular functions by name in a hidden symbol table used at run-time. For example, the dlopen() and dlsym() on UNIX-like systems allow you to load a shared object library and resolve functions in that library by name. Windows has similarly behaving functions LoadLibrary() and GetProcAddress() for dynamically linked libraries (DLLs). You have to pay attention to the concept of visibility. Functions must be exported by the library in order to be resolved using this mechanism. I believe GCC creates exports all functions by default (visibility is public) and Windows compilers export nothing by default. Also note that on Windows, you can resolve functions in the host program without loading an external library because the null library handle designates the host process’s executable image.

    In general, this is full of subtleties and not portable. I don’t recomment you build a system based on this mechanism.

    Manual symbol resolution: routes

    The modern way of mapping URLs (or parts of URLs) to functions is to build URL routes. This approached is adopted by most modern web frameworks based on the MVC paradigm (Ruby on Rails, Django and ASP.NET MVC to name a few — there are many others).

    This basically consists in building a map of names (or regular expressions) to callbacks (in C++, this would be a pointer to function or a std::function<> object). If your compiler supports the up and coming standard, you should be able to populate a std::map< std::regex,std::function<void()>> object to implement the look-up.

    Here is a simple (untested) example:

    // GET request for login.
    void handle_login_page ()
    {
         // CGI handler: read from `std::cin` and write to `std::cout`...
    }
    
    // POST request for login.
    void handle_login_form ()
    {
         // CGI handler: read from `std::cin` and write to `std::cout`...
    }
    
    typedef std::function<void()> Handler;
    typedef std::map<std::string, Handler> Routes;
    
    void handle_request ( const Routes& routes, const std::string& command )
    {
         // locate handler.
         Routes::const_iterator match = routes.find(command);
         if (match == routes.end()) {
             // exit with 404 status.
         }
         const Handler handler = match->second;
    
         // log access or other pre-processing.
         // ...
    
         // invoke handler.
         handler();
    }
    
    int main ()
    {
        Routes routes;
        routes["get_login"] = &handle_login_page;
        routes["post_login"] = &handle_login_form;
        // ...
    
        // accept a connection.
        // fork.
        // get command name.
        const std::string command = ...;
        handle_request(routes, command);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to fix a particular laboratory web application (written in ASP.NET). There is
I'm trying to understand a particular Perl code from vcake . Usually I find
I am trying to understand this particular difference between the direct and delegated event
I'm trying to understand the way a particular package fits into a project I'm
I'm trying to understand the unification algorithm described in SICP here In particular, in
I've been trying to understand Python's handling of class and instance variables. In particular,
Trying to understand Ruby a bit better, I ran into this code surfing the
I am trying to understand why the following statement works: putchar( 1 + '0'
Is there any way to force a C# application to use a specific version
I'm trying to understand how to use Type Converters after reading this answer to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.