[darcs-devel] [issue1275] roundup: Python backtraces return HTTP 200

Trent Buck bugs at darcs.net
Mon Dec 22 01:01:04 UTC 2008


New submission from Trent Buck <trentbuck at gmail.com>:

[Just skip to the last paragraph for the actual error.]

I have a script to modify roundup bugs by sending email formatted in
the way Roundup's mail gateway expects.  It performs basic input
validation before sending the email, because waiting for roundup to
reply with an error message (via email) is tedious.

For example, it validates status and priority changes:

  $ ru status 1203 wontfix
  Unrecognized status `wontfix'.
  Valid choices are: unread deferred chatting need-info in-progress testing
  resolved-in-unstable resolved wont-fix resolved-in-stable duplicate
  presumed-dead need-volunteer

I want to add validation of ticket numbers, so for example

  $ ru status 9999 wont-fix
  Unrecognized bug `9999'.
  Valid choices are 1 through 1287, inclusive.

The approach I take for status values is to HTTP GET the whole table,
but this is undesirable for the issue list because there are literally
thousands of issues, so it will burden the network unnecessarily.

  $ curl -sL 'http://bugs.darcs.net/issue?@action=export_csv&@columns=id' | wc -c
  6529
  $ curl -sL 'http://bugs.darcs.net/status?@action=export_csv&@columns=name' | wc -c
  172

I thought that a better way to do this was to just check the HTTP
status of doing a HTTP HEAD request on the appropriate URL:

  $ curl -sLI http://bugs.darcs.net/issue1 |
    head -1 | grep -q '200 OK'; echo $?
  0

But this always succeeds -- even when the server crashes!

  $ curl -sLI http://bugs.darcs.net/issue9999 |
    head -1 | grep -q '200 OK'; echo $?
  0

  $ w3m -dump http://bugs.darcs.net/issue9999 | head -1
  Mod_python error: "PythonHandler roundup.cgi.apache"

If this returned a more appropriate code (e.g. 500, internal server
error), I could use HEAD in this way.  Instead, I will have to GET a
full page, and parse it.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

----------
messages: 6859
nosy: dmitry.kurochkin, kowey, simon, thorkilnaur, twb
status: unread
title: roundup: Python backtraces return HTTP 200

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1275>
__________________________________


More information about the darcs-devel mailing list