It'd be nice to provide the ability to mangle the headers provided by UC file. I provided a simple patch that provides the basics of the functionality that I need but it could be split up additionally into a keyed array if needed.

Warning: I was a bit lazy with the patch and made it in the uc_file instead of the base ubercart directory.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neclimdul’s picture

Still applies. Any feedback?

A little more background for people interested in "why?" this is necessary to allow in browser viewing of purchased files without a custom callback. Its the simplest solution I came up with anyways.

longwave’s picture

Component: Code » File downloads
Status: Active » Needs review

Changing component.

longwave’s picture

Seems reasonable. I agree that keying the array would let the alter hook can make changes more easily. We can handle the special case of the 206 Partial Content header with the key "Status", as used by drupal_add_http_header() in D7.

neclimdul’s picture

Status: Needs review » Needs work

Sounds good, I'll re-roll with the keyed approach.

neclimdul’s picture

Status: Needs work » Needs review
FileSize
2.1 KB

Long promised re-roll. Was mostly done for months just needed to stip the pressflow only drupal_set_header signature we where using.

Status: Needs review » Needs work

The last submitted patch, uc_file_alter_headers.patch, failed testing.

neclimdul’s picture

Status: Needs work » Needs review
FileSize
2.1 KB

um... lets try this again?

TR’s picture

Give it a while, testbot is currently stalled for everything. Testbot log shows "fatal: cannot create directory at 'themes/stark': No space left on device".

neclimdul’s picture

it actually tested the original patch and not #5 the last time it went to NR. That's why I changed the name. Automatic test queueing is a bit wonky sometimes.

TR’s picture

Testbot first tests the branch, and if the branch has failed then individual patches will be postponed. When the branch is restarted and succeeds, then *all* patches in the queue get retested.

Currently, #5 and #7 are waiting to be tested because the branch failed due to the out of space error on the testbot server. Once that issue gets cleared up, the branch will be restarted and the patches in #0, #5 and #7 will be retested.

longwave’s picture

Not sure this header should be alterable, as the alter hook doesn't let you change whether the caller sends partial content or not:

   if ($seek_start > 0 || $seek_end < ($size - 1)) {
-    drupal_set_header('HTTP/1.1 206 Partial Content');
+    $headers['HTTP/1.1 206 Partial Content'] = NULL;
   }

...and if that's removed, the following code can be changed, which will currently fail if $value is 0:

+    $header = $name;
+    if ($value) {
+      $header .= ": $value";
+    }
TR’s picture

Version: 6.x-2.x-dev » 8.x-4.x-dev
Issue summary: View changes