Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jul 2014 at 18:50 UTC
Updated:
21 Oct 2014 at 23:04 UTC
Jump to comment: Most recent
Comments
Comment #1
dawehnerYou should rather try to refactor your code and change it not in the middle of nowhere.
Comment #2
dawehnerI would argue that this is the design of Drupal 8.
Comment #3
shivanshuag commented@dawehner Let me describe my use case. I am porting the module securesite - (http://drupal.org/projects/securesite) to d8. The module provides HTTP Digest Authentication to enter the site. For this, I need to catch a request thorugh event subscriber and ask for credentials. When the user has sent the credentials and they are correct, I need to send a header - Authentication Info - to the client containing some details for the authentication. In the event subscriber, the response object has yet not been created (and I cannot create a new response object as the response content is yet to be prepared).
Please help me if there is another way to provide this functionality. I am still a noob in drupal but from what I have researched, I could not find a way to do this.
Comment #4
shivanshuag commentedComment #5
berdirAnother example for adding HTML headers from anywhere are things like og: and other metatags which can happen through a rendered entity or a block. We need a way to specify this through #attached or something.
Comment #6
ianthomas_ukThere's lots of good discussion about this on #2184907: Remove uses of drupal_add_http_header and related functions, particularly #10-19.
Comment #7
dawehnerEither you can use #attachment['http_header'] or better manipulate the HTTP response directly.