The canonical port of the server serving the request. (%p)
512619
public static function getPort(ServerRequestInterface $request, string $format): string
    {
        switch ($format) {
            case 'canonical':
            case 'local':
                return (string) ($request->getUri()->getPort()
                    ?: ('https' === $request->getUri()->getScheme() ? 443 : 80));
            default:
                return '-';
        }
    }
766939
public static function current()
    {
        if (defined('PHPUNIT_RUNNING')) {
            return 'http://localhost';
        }

        $protocol = (!empty($_SERVER['HTTPS'])
            && $_SERVER['HTTPS'] !== 'off'
            || (int) $_SERVER['SERVER_PORT'] === 443) ? 'https://' : 'http://';

        return $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
8689
function(url) {
		var ports = { // we ignore default ports
			http: 80,
			https: 443
		}
		, urlp = parseUrl(url)
		;

		return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
	}
435625
public static function getProtocolInformation()
    {
        if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
            return 'SERVER_PORT=443';
        }

        if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') {
            return 'X-Forwarded-Proto';
        }

        if (isset($_SERVER['HTTP_X_FORWARDED_SCHEME']) && strtolower($_SERVER['HTTP_X_FORWARDED_SCHEME']) == 'https') {
            return 'X-Forwarded-Scheme';
        }

        if (isset($_SERVER['HTTP_X_URL_SCHEME']) && strtolower($_SERVER['HTTP_X_URL_SCHEME']) == 'https') {
            return 'X-Url-Scheme';
        }

        return null;
    }
689887
def start(self, tcpport=102):
        
        if tcpport != 102:
            logger.info("setting server TCP port to %s" % tcpport)
            self.set_param(snap7.snap7types.LocalPort, tcpport)
        logger.info("starting server on 0.0.0.0:%s" % tcpport)
        return self.library.Srv_Start(self.pointer)
512171
public static function port(HTTPRequest $request = null)
    {
        $host = static::host($request);
        return (int)parse_url($host, PHP_URL_PORT) ?: null;
    }
395225
private static byte[] canonicalRequestDigest(URIish uri)
			throws NoSuchAlgorithmException {
		StringBuilder canonicalRequest = new StringBuilder();
		canonicalRequest.append("GIT\n") // codecommit uses GIT as the request method
				.append(uri.getPath()).append("\n") // URI request path
				.append("\n") // Query string, always empty for codecommit
				// Next is canonical headers, codecommit only requires the host header
				.append("host:").append(uri.getHost()).append("\n").append("\n") // canonical
																					// headers
																					// are
																					// always
																					// terminated
																					// by
																					// newline
				.append("host\n"); // The list of canonical headers, only one for
									// codecommit

		MessageDigest digest = MessageDigest.getInstance(SHA_256);

		return digest.digest(canonicalRequest.toString().getBytes());
	}
696627
public static String getServerPort() {
        String ret = getLatkeProperty("serverPort");
        if (null == ret) {
            final RequestContext requestContext = REQUEST_CONTEXT.get();
            if (null != requestContext) {
                ret = requestContext.getRequest().getServerPort() + "";
            }
        }

        return ret;
    }
906539
public static function initRequest()
    {
        global $PPHP;

        $parsedURL = parse_url($_SERVER['REQUEST_URI']);
        self::$_PATH = dejoin('/', trim($parsedURL['path'], '/'));
        while (count(self::$_PATH) > 0 && self::$_PATH[0] === '') {
            array_shift(self::$_PATH);
        };

        // Eat up initial directory as language if it's 2 characters
        $lang = $PPHP['config']['global']['default_lang'];
        if (isset(self::$_PATH[0]) && strlen(self::$_PATH[0]) === 2) {
            $lang = strtolower(array_shift(self::$_PATH));
        };
        self::$_req['lang'] = $lang;
        self::$_req['default_lang'] = $PPHP['config']['global']['default_lang'];
        self::$_req['base'] = ($lang === $PPHP['config']['global']['default_lang'] ? '' : "/{$lang}");

        // Eat up initial directories as long as they contain request flags
        self::$_req['binary'] = false;
        while (count(self::$_PATH) > 0 && self::$_PATH[0][0] === '=') {
            $flag = strtolower(array_shift(self::$_PATH));
            if ($flag === '=bin') {
                self::$_req['binary'] = true;
            };
        };

        self::$_req['path'] = implode('/', self::$_PATH);
        self::$_req['query'] = (isset($parsedURL['query']) ? '?' . $parsedURL['query'] : '');
        self::$_req['host'] = $_SERVER['HTTP_HOST'];
        self::$_req['remote_addr'] = self::_remoteIP();
        self::$_req['ssl']
            = (
                (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
                ||
                (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)
                ||
                (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
                ||
                (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on')
            );
        self::$_req['get'] = $_GET;
        self::$_req['post'] = $_POST;

        foreach (array('get', 'post') as $method) {
            if (isset(self::$_req[$method]['__arrays'])) {
                foreach (self::$_req[$method]['__arrays'] as $key) {
                    if (!isset(self::$_req[$method][$key])) {
                        self::$_req[$method][$key] = array();
                    } elseif (!is_array(self::$_req[$method][$key])) {
                        self::$_req[$method][$key] = array(self::$_req[$method][$key]);
                    };
                };
            };
        };

        // Process file uploads
        self::$_req['files'] = array();
        if (isset($_FILES) && count($_FILES) > 0) {
            $finfo = finfo_open(FILEINFO_MIME_TYPE);
            foreach ($_FILES as $key => $info) {
                if (is_uploaded_file($info['tmp_name'])) {
                    self::$_req['files'][$key] = $info;
                    // Overwrite client's MIME Type with server's determination
                    self::$_req['files'][$key]['type'] = finfo_file($finfo, $info['tmp_name']);
                    foreach (pathinfo($info['name']) as $pik => $piv) {
                        self::$_req['files'][$key][$pik] = $piv;
                    };
                };
            };
            finfo_close($finfo);
        };

        self::_initCommon();
    }
496838
def do_serve(argdict):
    ''''''
    site = make_site_obj(argdict)
    os.chdir(site.dirs['www'])

    HandlerClass = SimpleHTTPRequestHandler
    ServerClass  = BaseHTTPServer.HTTPServer
    Protocol     = "HTTP/1.0"
    server_address = (argdict['ip'], argdict['port'])
    HandlerClass.protocol_version = Protocol
    httpd = ServerClass(server_address, HandlerClass)

    sa = httpd.socket.getsockname()
    print "Serving HTTP on", sa[0], "port", sa[1], "..."
    httpd.serve_forever()
22980
function server() {
  // TODO: Show require express error
  var express = require('express')
    , app = express();

  app.configure(function() {
    app.use(express.static(siteBuilder.outputRoot));
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
  });

  // Map missing trailing slashes for posts
  app.get('*', function(req, res) {
    var postPath = siteBuilder.outputRoot + req.url + '/';
    // TODO: Security
    if (req.url.match(/[^/]$/) && existsSync(postPath)) {
      res.redirect(req.url + '/');
    } else {
      res.send('404');
    }
  });

  app.listen(siteBuilder.config.port);
  log.info('Listening on port', siteBuilder.config.port);
}
894502
def process_request(self, req, resp):
        

        key = req.env['REMOTE_PORT'] + req.env['REMOTE_ADDR']
        val = self.cache.get(key, 0)

        if val == self.count:
            abort(exceptions.TooManyRequests(headers=self._error_headers))
        else:
            self.cache[key] = val + 1
1128885
def cmd_pasv(param)
      send_unauthorised and return unless logged_in?

      host, port = start_passive_socket

      p1, p2 = *port.divmod(256)

      send_response "227 Entering Passive Mode (" + host.split(".").join(",") + ",#{p1},#{p2})"
    end
1226314
def canonical
      c = self.local.canonical
      c += "@" + self.host.canonical if self.host.canonical && self.host.canonical > " "
      c
    end
1215858
def is_http_running_on(port):
  
  try:
    conn = httplib.HTTPConnection('127.0.0.1:' + str(port))
    conn.connect()
    conn.close()
    return True
  except Exception:
    return False
1343503
public function serve($host = '127.0.0.1', $port = '8000', $public_html = 'public')
    {
        print Colors::LIGHT_CYAN."Built-in development server started [/public]: ".Colors::YELLOW."<http://$host:$port>".Colors::WHITE.PHP_EOL.
        "You can exit with `CTRL+C`".PHP_EOL.
        Colors::BG_BLACK.Colors::WHITE;
        exec("php -S $host:$port -t $public_html");
    }
872947
def available_tcp_port(reactor):
    

    endpoint = serverFromString(reactor, 'tcp:0:interface=127.0.0.1')
    port = yield endpoint.listen(NoOpProtocolFactory())
    address = port.getHost()
    yield port.stopListening()
    defer.returnValue(address.port)