Last Comment Bug 484027 - Add "escape hatch" functionality to httpd.js
: Add "escape hatch" functionality to httpd.js
Status: RESOLVED FIXED
: fixed1.9.1
Product: Testing
Classification: Components
Component: httpd.js (show other bugs)
: unspecified
: All All
: -- enhancement (vote)
: mozilla1.9.1
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
:
Mentors:
Depends on: 396226
Blocks: 475444
  Show dependency treegraph
 
Reported: 2009-03-18 10:56 PDT by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2009-05-30 21:34 PDT (History)
2 users (show)
jwalden+bmo: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch (27.15 KB, patch)
2009-04-23 12:29 PDT, Jeff Walden [:Waldo] (remove +bmo to email)
sayrer: review+
Details | Diff | Splinter Review

Description Jeff Walden [:Waldo] (remove +bmo to email) 2009-03-18 10:56:27 PDT
Once bug 396226 lands, it shouldn't be difficult to add a way for a request handler be given semi-raw (mediated) access to the output stream for the connection, to allow writing arbitrary data through that connection.  This would allow for fun like a request handler that abruptly closes the connection without writing any data, writing malformed HTTP responses, and the like.  This isn't the full extent of what might be wanted -- in particular, for a request handler to be invoked the incoming request's head (and body, if any) must have been fully received -- but it's most of it, and it's not especially far afield of what a pluggable HTTP server might reasonably expose.
Comment 1 Jeff Walden [:Waldo] (remove +bmo to email) 2009-04-23 12:29:24 PDT
Created attachment 374314 [details] [diff] [review]
Patch

Getting all the corner cases correct was trickier than I expected but still relatively easy with bug 396226 fixed.
Comment 2 Robert Sayre 2009-05-28 22:25:00 PDT
Comment on attachment 374314 [details] [diff] [review]
Patch

looks ok. I would think about making some named functions that test for these booleans rather repeating them.
Comment 3 Jeff Walden [:Waldo] (remove +bmo to email) 2009-05-29 00:00:59 PDT
The conditions aren't quite repeated enough, or in the same semantic manner, for me to be willing to add functions for them -- not to mention that I too had problems coming up with good names for them when I tried to do so.

http://hg.mozilla.org/mozilla-central/rev/fe9cc55b8db7

Will port to 191 (should be trivial, the two are fully synced since bug 396226 was ported) once it's clear this went fine (no problems actually expected), in the interests of keeping the APIs the same for backports and security fix patches...
Comment 4 Jeff Walden [:Waldo] (remove +bmo to email) 2009-05-30 18:26:02 PDT
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/615cb0a7c787
Comment 5 Jeff Walden [:Waldo] (remove +bmo to email) 2009-05-30 21:34:46 PDT
http://hg.mozilla.org/mozilla-central/rev/8a555b5e4f47
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/537a0ea689ab

Bad me, I forgot to bump the interface ID in the patch; did so now.  I also documented this functionality on this MDC page:

https://developer.mozilla.org/En/Httpd.js/HTTP_server_for_unit_tests

Note You need to log in before you can comment on or make changes to this bug.