Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I'm writing my own WebGIS integration module (using a custom client made on top of OL 2.8) and I had some bad surprises with your proxy.php implementation.
I started from your code and rewrote it, I think it should be useful to you. Here is my modified proxy.php file.
Comment | File | Size | Author |
---|---|---|---|
#8 | proxy2.php_.txt | 7.17 KB | jpulles |
#6 | proxy.php_.txt | 8.58 KB | pounard |
#1 | proxy.php_.txt | 7.98 KB | pounard |
Comments
Comment #1
pounardComment #2
jpulles CreditAttribution: jpulles commentedThank you pounard,
The dev version already supports post request, see http://drupalcode.org/viewvc/drupal/contributions/modules/mappingkit/pro....
I'll try to fit this in.
Regards,
John
Comment #3
pounardit seems that your implementation do not write the full correct headers or I misread your code, what about content type and stuff like that?
I did some more rewriting lately I'll share some code if it I see it fits to your needs. I did a small working implementation of a capturing proxy which expose http streams to modules via hooks to parse WFS content, it's a performance killer but it's useful to do feature automatic feeding into some drupal database.
I'll release my module in the next weeks I'll be glad to export some features to independant modules if you wan't it!
Comment #4
jpulles CreditAttribution: jpulles commentedI just committed an adjusted proxy script to the dev version, see http://drupal.org/cvs?commit=318972.
It's true that not all headers were written to the target; this has now been corrected except for the 'Connection' header.
What should still be changed is that the proxy should stream the response instead of presenting it as one piece.
Comment #5
pounardThat's right, I think drupal_http_request() should be discarded for this.
Comment #6
pounardTry this for streamed output, this is a first implementation, this needs to be tested and optimized, it works with me (could not test the redirect feature).
Comment #7
jpulles CreditAttribution: jpulles commentedI was working myself a bit differently by only keeping the necessary drupal_http_request code. Not completely similar yet to the previous version (e.g. no redirect feature), but it should be this week.
Comment #8
jpulles CreditAttribution: jpulles commentedComment #9
pounardIt seems that your code is nicer than mine :)
An idea to improve configuration would be to bootstrap a minimal Drupal (i.e. just enough to get configuration) so site administrators could do their settings in the UI. But I think the impact on performance would too high.
Maybe using a custom variable in settings.php and include this file into the proxy.php file would be more consistent for accepted host configurations (and would not have a big performance impact, maybe almost zero impact when using opcode caches).
Comment #10
jpulles CreditAttribution: jpulles commentedNote that the version I attached has a problem with files smaller than the chunk size, and doesn't redirect on Location headers. A version which corrects this has just been committed to dev (http://drupal.org/cvs?commit=319818), but the changes do make it less nice ;-)
I like your suggestion to configure the proxy using the settings file, even if it's not configurable through the UI. Would you prefer adding variables to the $conf array or a separate array?
Comment #11
pounardI don't really know, the $conf array has a specific usage which is the override of some rows of Drupal variables table. May be it worth asking on development@drupal.org mailing list for some external opinions.
Comment #13
jpulles CreditAttribution: jpulles commentedClosing this issue.
By the way, a coming version of the proxy shows a warning message on the status page if the settings are not secured. And the settings may be read from a proxy.settings.inc file when desired, to prevent overwriting the settings when upgrading.
Comment #14
pounardNice, that's sounds really good (for the status message I did that in my own module).
Comment #15
Steve Jobs CreditAttribution: Steve Jobs commentedgood post. Google.