user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/4] t/httpd-corner: additional callback test
  2016-03-05  6:07  5% [PATCH 0/4] daemon-related cleanups Eric Wong
@ 2016-03-05  6:07  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-03-05  6:07 UTC (permalink / raw)
  To: meta

Just to ensure we hit the code path independently of
WWW code.
---
 t/httpd-corner.psgi | 9 +++++++++
 t/httpd-corner.t    | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/t/httpd-corner.psgi b/t/httpd-corner.psgi
index 349b35d..da8a2ee 100644
--- a/t/httpd-corner.psgi
+++ b/t/httpd-corner.psgi
@@ -47,6 +47,15 @@ my $app = sub {
 	} elsif ($path eq '/host-port') {
 		$code = 200;
 		push @$body, "$env->{REMOTE_ADDR}:$env->{REMOTE_PORT}";
+	} elsif ($path eq '/callback') {
+		return sub {
+			my ($res) = @_;
+			my $buf = "hello world\n";
+			push @$h, 'Content-Length', length($buf);
+			my $fh = $res->([200, $h]);
+			$fh->write($buf);
+			$fh->close;
+		}
 	}
 
 	[ $code, $h, $body ]
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index 1956407..a6238e4 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -76,6 +76,15 @@ my $spawn_httpd = sub {
 	$spawn_httpd->('-W0');
 }
 
+{
+	my $conn = conn_for($sock, 'streaming callback');
+	$conn->write("GET /callback HTTP/1.0\r\n\r\n");
+	ok($conn->read(my $buf, 8192), 'read response');
+	my ($head, $body) = split(/\r\n\r\n/, $buf);
+	is($body, "hello world\n", 'callback body matches expected');
+}
+
+
 # Unix domain sockets
 {
 	my $u = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => $upath);
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] daemon-related cleanups
@ 2016-03-05  6:07  5% Eric Wong
  2016-03-05  6:07  7% ` [PATCH 1/4] t/httpd-corner: additional callback test Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-03-05  6:07 UTC (permalink / raw)
  To: meta

Nothing earth-shattering, but we need to start documenting
this for users if we expect people to start using it :p.

Eric Wong (4):
      t/httpd-corner: additional callback test
      daemon: drop listener sockets ASAP on termination
      daemon: avoid cyclic references for once-used callbacks
      daemon: simplify parent death handling

 lib/PublicInbox/Daemon.pm | 9 +++++++--
 t/httpd-corner.psgi       | 9 +++++++++
 t/httpd-corner.t          | 9 +++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-03-05  6:07  5% [PATCH 0/4] daemon-related cleanups Eric Wong
2016-03-05  6:07  7% ` [PATCH 1/4] t/httpd-corner: additional callback test Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).