Add "escape hatch" functionality to httpd.js

RESOLVED FIXED in mozilla1.9.1

Status

Testing
httpd.js
--
enhancement
RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: Waldo, Assigned: Waldo)

Tracking

({fixed1.9.1})

unspecified
mozilla1.9.1
fixed1.9.1
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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.
Blocks: 475444
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.
Assignee: nobody → jwalden+bmo
Status: NEW → ASSIGNED
Attachment #374314 - Flags: review?(sayrer)

Updated

8 years ago
Attachment #374314 - Flags: review?(sayrer) → review+

Comment 2

8 years ago
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.
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...
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/615cb0a7c787
Keywords: fixed1.9.1
Target Milestone: mozilla1.9.2 → mozilla1.9.1
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
You need to log in before you can comment on or make changes to this bug.