silverstripe / silverstripe-ckan-registry

BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

CKAN not working with guzzle #270

Open emteknetnz opened 2 years ago

emteknetnz commented 2 years ago

https://github.com/silverstripe/silverstripe-ckan-registry/runs/7419517559?check_suite_focus=true

Failing behat test (also fails manual testing) where the server will send a guzzle request to https://catalogue.data.govt.nz/dataset/directory-of-educational-institutions

This website has imperva in-front of it which intentionally sends back an invalid __utmv header https://stackoverflow.com/a/62407633

Guzzle psr(used by guzzle) throws an exception because of this header https://github.com/guzzle/psr7/blob/1.x/src/MessageTrait.php#L267

        if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) {
            throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value));
        }

We could also update ckan to use something other than guzzle

emteknetnz commented 2 years ago

Issue is not resolved with 4.11 / guzzle 7 - still getting the same failure - https://github.com/silverstripe/silverstripe-ckan-registry/runs/7509511643?check_suite_focus=true#step:12:151

andrewandante commented 2 years ago

Ticket currently open with Imperva to disable the cookie that is causing this issue - will update once ticket is closed.

andrewandante commented 2 years ago

Ticket has been resolved, can you re-test?

GuySartorelli commented 2 years ago

Still failed: https://github.com/silverstripe/silverstripe-ckan-registry/actions/runs/2772250337

andrewandante commented 2 years ago

😢 have asked Imperva to check themselves.

andrewandante commented 2 years ago

It might be worth adding a config option to force HTTP2 as that seems to be a way around the problem - it would at least get the test to pass. Should be able to pass in like this: https://github.com/guzzle/guzzle/issues/1249#issuecomment-138636488

andrewandante commented 2 years ago

I've purged the cache at their request, and it's now working for me locally - once more round the block?

GuySartorelli commented 2 years ago

Still failing in CI https://github.com/silverstripe/silverstripe-ckan-registry/actions/runs/2772250337

"___utmvaEPBuoiEYB=mPnGQzA; path=/; Max-Age=900; Secure; SameSite=None" is not valid header value

emteknetnz commented 2 years ago

I've noticed this seems to fail sporadically, though more failures than non-failures - seems that Imperva does not consistently send the malformed header?

andrewandante commented 2 years ago

Update: Imperva fix needs to be applied to a different site, not under our control - have engaged the third party responsible, hopefully to be resolved soon 😬