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/5] www: stricter regexp for 405 errors
  2020-02-04  4:44  6% [PATCH 0/5] a few more minor fixups Eric Wong
@ 2020-02-04  4:44  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-02-04  4:44 UTC (permalink / raw)
  To: meta

We want to match "GET" and "HEAD" exactly, not requests which
start with "GET" or end with "HEAD".  This doesn't seem like
a real problem for public-inboxes which are actually public
data anyways.
---
 lib/PublicInbox/WWW.pm | 2 +-
 t/httpd.t              | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index efe7c8ca..3ce7cc2a 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -70,7 +70,7 @@ sub call {
 			return invalid_inbox($ctx, $1) || mbox_results($ctx);
 		}
 	}
-	elsif ($method !~ /\AGET|HEAD\z/) {
+	elsif ($method !~ /\A(?:GET|HEAD)\z/) {
 		return r(405);
 	}
 
diff --git a/t/httpd.t b/t/httpd.t
index 2972afb2..c9756a70 100644
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -49,6 +49,11 @@ EOF
 	$td = start_script($cmd, undef, { 3 => $sock });
 	my $host = $sock->sockhost;
 	my $port = $sock->sockport;
+	{
+		my $bad = tcp_connect($sock);
+		print $bad "GETT / HTTP/1.0\r\n\r\n" or die;
+		like(<$bad>, qr!\AHTTP/1\.[01] 405\b!, 'got 405 on bad req');
+	}
 	my $conn = tcp_connect($sock);
 	ok($conn, 'connected');
 	ok($conn->write("GET / HTTP/1.0\r\n\r\n"), 'wrote data to socket');

^ permalink raw reply	[relevance 7%]

* [PATCH 0/5] a few more minor fixups
@ 2020-02-04  4:44  6% Eric Wong
  2020-02-04  4:44  7% ` [PATCH 1/5] www: stricter regexp for 405 errors Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-02-04  4:44 UTC (permalink / raw)
  To: meta

Nothing earth shattering, serving $INBOX_URL/description
properly for v2 inboxes should make it easier to mirror
while preserving descriptions (only per-epoch descriptions
are propagated in manifest.js.gz).

Eric Wong (5):
  www: stricter regexp for 405 errors
  www: serve $INBOX_DIR/description as $INBOX_URL/description
  inbox: simplify ->description and ->cloneurl
  inbox: remove TODO item for msg_by_path
  over: simplify read-only vs read-write checking

 lib/PublicInbox/Inbox.pm   | 26 ++++++++++----------------
 lib/PublicInbox/Over.pm    |  7 +++----
 lib/PublicInbox/OverIdx.pm |  2 +-
 lib/PublicInbox/WWW.pm     | 13 ++++++++++++-
 t/httpd.t                  |  5 +++++
 t/over.t                   |  7 ++++++-
 t/plack.t                  |  2 ++
 t/psgi_v2.t                |  3 +++
 8 files changed, 42 insertions(+), 23 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2020-02-04  4:44  6% [PATCH 0/5] a few more minor fixups Eric Wong
2020-02-04  4:44  7% ` [PATCH 1/5] www: stricter regexp for 405 errors Eric Wong

Code repositories for project(s) associated with this 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).