{"id":17306499,"url":"https://github.com/jhthorsen/mojo-useragent-secureserver","last_synced_at":"2025-03-26T23:43:44.196Z","repository":{"id":56838083,"uuid":"328862540","full_name":"jhthorsen/mojo-useragent-secureserver","owner":"jhthorsen","description":"Secure application server for Mojo::UserAgent","archived":false,"fork":false,"pushed_at":"2022-02-13T01:54:30.000Z","size":50,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T05:26:01.655Z","etag":null,"topics":["cpan","perl"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Mojo::UserAgent::SecureServer","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhthorsen.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-12T03:36:44.000Z","updated_at":"2022-02-13T01:53:19.000Z","dependencies_parsed_at":"2022-09-12T11:51:40.547Z","dependency_job_id":null,"html_url":"https://github.com/jhthorsen/mojo-useragent-secureserver","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhthorsen%2Fmojo-useragent-secureserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhthorsen%2Fmojo-useragent-secureserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhthorsen%2Fmojo-useragent-secureserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhthorsen%2Fmojo-useragent-secureserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhthorsen","download_url":"https://codeload.github.com/jhthorsen/mojo-useragent-secureserver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245755605,"owners_count":20667027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpan","perl"],"created_at":"2024-10-15T11:58:37.242Z","updated_at":"2025-03-26T23:43:44.178Z","avatar_url":"https://github.com/jhthorsen.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nMojo::UserAgent::SecureServer - Secure application server for Mojo::UserAgent\n\n# SYNOPSIS\n\n    # Construct from Mojo::UserAgent\n    my $ua = Mojo::UserAgent-\u003enew;\n    $ua-\u003eca('ca.pem')-\u003ecert('cert.pem')-\u003ekey('key.pem');\n    $ua-\u003eserver(Mojo::UserAgent::SecureServer-\u003efrom_ua($ua));\n\n    # Construct manually\n    my $ua     = Mojo::UserAgent-\u003enew;\n    my $server = Mojo::UserAgent::SecureServer-\u003enew;\n    $server-\u003elisten(Mojo::URL-\u003enew('https://127.0.0.1?cert=/x/server.crt\u0026key=/y/server.key\u0026ca=/z/ca.crt'));\n    $ua-\u003eserver($server);\n\n    # Test::Mojo\n    my $app = Mojolicious-\u003enew;\n    $app-\u003eroutes-\u003eget('/' =\u003e sub {\n      my $c      = shift;\n      my $handle = Mojo::IOLoop-\u003estream($c-\u003etx-\u003econnection)-\u003ehandle;\n      $c-\u003erender(json =\u003e {cn =\u003e $handle-\u003epeer_certificate('cn')});\n    });\n\n    my $t = Test::Mojo-\u003enew($app);\n    $t-\u003eua-\u003einsecure(0);\n    $t-\u003eua-\u003eca('t/pki/certs/ca-chain.cert.pem')\n      -\u003ecert('t/pki/mojo.example.com.cert.pem')\n      -\u003ekey('t/pki/mojo.example.com.key.pem');\n    $t-\u003eua-\u003eserver(Mojo::UserAgent::SecureServer-\u003efrom_ua($t-\u003eua));\n\n    $t-\u003eget_ok('/')-\u003estatus_is(200)-\u003ejson_is('/cn', 'mojo.example.com');\n\n# DESCRIPTION\n\n[Mojo::UserAgent::SecureServer](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3ASecureServer) allows you to test your [Mojolicious](https://metacpan.org/pod/Mojolicious) web\napplication with custom SSL/TLS key/cert/ca.\n\n# ATTRIBUTES\n\n[Mojo::UserAgent::SecureServer](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3ASecureServer) inherits all attributes from\n[Mojo::UserAgent::Server](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3AServer) and implements the following new ones.\n\n## listen\n\n    $url = $server-\u003elisten;\n    $server = $server-\u003elisten(Mojo::URL-\u003enew('https://127.0.0.1'));\n\nThe base listen URL for [Mojo::Server::Daemon](https://metacpan.org/pod/Mojo%3A%3AServer%3A%3ADaemon) created by [\"nb\\_url\"](#nb_url) and\n[\"url\"](#url). The \"port\" will be discarded, while other\n[\"listen\" in Mojo::Server::Daemon](https://metacpan.org/pod/Mojo%3A%3AServer%3A%3ADaemon#listen) parameters are kept.\n\n# METHODS\n\n[Mojo::UserAgent::SecureServer](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3ASecureServer) inherits all methods from\n[Mojo::UserAgent::Server](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3AServer) and implements the following new ones.\n\n## from\\_ua\n\n    $server = Mojo::UserAgent::SecureServer-\u003efrom_ua($ua);\n    $server = $server-\u003efrom_ua($ua);\n\nUsed to construct a new object and/or copy attributes from a [Mojo::UserAgent](https://metacpan.org/pod/Mojo%3A%3AUserAgent)\nobject. Here is the long version:\n\n    $server-\u003eapp($ua-\u003eserver-\u003eapp);\n    $server-\u003eioloop($ua-\u003eserver-\u003eioloop);\n    $server-\u003elisten-\u003equery-\u003eparam(ca     =\u003e $ua-\u003eca);\n    $server-\u003elisten-\u003equery-\u003eparam(cert   =\u003e $ua-\u003ecert);\n    $server-\u003elisten-\u003equery-\u003eparam(key    =\u003e $ua-\u003ekey);\n    $server-\u003elisten-\u003equery-\u003eparam(verify =\u003e Net::SSLeay::VERIFY_PEER()) unless $ua-\u003einsecure\n\n## nb\\_url\n\n    $url = $server-\u003enb_url;\n\nGet absolute [Mojo::URL](https://metacpan.org/pod/Mojo%3A%3AURL) object for server processing non-blocking requests\nwith [\"app\" in Mojo::UserAgent::Server](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3AServer#app).\n\n## url\n\n    $url = $server-\u003eurl;\n\nGet absolute [Mojo::URL](https://metacpan.org/pod/Mojo%3A%3AURL) object for server processing non-blocking requests\nwith [\"app\" in Mojo::UserAgent::Server](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3AServer#app).\n\n# AUTHOR\n\nJan Henning Thorsen\n\n# COPYRIGHT AND LICENSE\n\nCopyright (C) Jan Henning Thorsen.\n\nThis program is free software, you can redistribute it and/or modify it under\nthe terms of the Artistic License version 2.0.\n\n# SEE ALSO\n\n[Mojo::UserAgent](https://metacpan.org/pod/Mojo%3A%3AUserAgent), [Mojo::UserAgent::Server](https://metacpan.org/pod/Mojo%3A%3AUserAgent%3A%3AServer) and [Test::Mojo](https://metacpan.org/pod/Test%3A%3AMojo).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhthorsen%2Fmojo-useragent-secureserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhthorsen%2Fmojo-useragent-secureserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhthorsen%2Fmojo-useragent-secureserver/lists"}