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.

CommentFileSizeAuthor
#8 proxy2.php_.txt7.17 KBjpulles
#6 proxy.php_.txt8.58 KBpounard
#1 proxy.php_.txt7.98 KBpounard
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pounard’s picture

FileSize
7.98 KB
jpulles’s picture

Assigned: Unassigned » jpulles

Thank 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

pounard’s picture

it 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!

jpulles’s picture

I 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.

pounard’s picture

That's right, I think drupal_http_request() should be discarded for this.

pounard’s picture

FileSize
8.58 KB

Try 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).

jpulles’s picture

I 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.

jpulles’s picture

FileSize
7.17 KB
pounard’s picture

It 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).

jpulles’s picture

Note 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?

pounard’s picture

I 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.

jpulles’s picture

Status: Needs review » Fixed

Closing 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.

pounard’s picture

Nice, that's sounds really good (for the status message I did that in my own module).

Steve Jobs’s picture

good post. Google.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.