Commit Graph

43 Commits

Author SHA1 Message Date
Mikael Nordfeldth fb492d4bb2 Remove debug call and change how connect_timeout is set 2017-07-09 20:34:44 +02:00
Mikael Nordfeldth f0480c34d7 Configure a default timeout for HTTP connections at 60s
No requests we do externally should ever take more than 60 seconds. This
could probably be changed for downloading video or whatever for any cache
plugins that want to store data locally, but in general I think even 60s
is way longer than I expect any outgoing requests should take.

This affects everything using HTTPClient, our helper class, and thus all
hub pings, subscription requests, etc. etc.

The value, afaik, includes connect_timeout and if it takes 10 seconds to
establish a connection only 50 seconds is available to transfer data.
2017-07-09 20:28:22 +02:00
Mikael Nordfeldth 0adb7af9a0 Allow a quickHead request, will only return headers 2016-06-24 15:43:20 +02:00
Mikael Nordfeldth 9fa18fa366 HTTPClient::quickGet now supports headers as argument
They should be in a numeric array, already formatted as headers,
ready to go. (Header-Name: Content of the header)
2016-03-24 02:44:11 +01:00
Mikael Nordfeldth 098c8b1df4 NoHttpResponseException extends HTTP_Request2_ConnectionException 2016-02-07 01:52:20 +01:00
Mikael Nordfeldth 367fc054dc Merge branch 'master' into mmn_fixes 2016-01-30 00:03:25 +01:00
hannes e447964639 remove my ugly debug info 2016-01-25 19:10:35 +00:00
hannes b1b6a0a69c config['follow_redirects'] is the extlib's config! if max_redirs is set we want to do our own redirection following in this function 2016-01-25 19:03:26 +00:00
Mikael Nordfeldth 89dd44bf3e default connect_timeout to 5 instead of extlib 10 2016-01-22 12:20:03 +01:00
Mikael Nordfeldth f768de4b46 default connect_timeout to 5 instead of extlib 10 2016-01-18 22:01:45 +01:00
Mikael Nordfeldth 99da1ebe41 Catch NoHttpResponseException when using HTTPClient 2016-01-13 14:17:49 +01:00
Mikael Nordfeldth 3ed632decf NoHttpResponseException needed instead of HTTP_Request2_Exception
HTTP_Request2_Exception assumed an HTTP response status code/line
2016-01-13 14:08:48 +01:00
Mikael Nordfeldth e75472f460 Use the upstream function to get effectiveUrl 2016-01-13 14:00:05 +01:00
Mikael Nordfeldth b13f8df79b HTTPClient would return null instead of exception
This caused $response->isOK() tests to call a function on a non-existing object, causing all hell to break loose.
2016-01-11 02:36:59 +01:00
Mikael Nordfeldth 1f02dc639e shortenLinks _after_ media upload to be consistent with api 2016-01-07 18:14:45 +01:00
hannes 64f2f3d976 effectiveUrl seems to contain the url we want 2016-01-05 22:44:06 +00:00
Mikael Nordfeldth 8bab642cc7 quickGetJson for HTTP requests to return json objects 2015-11-30 02:05:06 +01:00
Mikael Nordfeldth b7edac2610 HTTPClient get $params array and oEmbedHelper uses it 2015-11-30 01:28:18 +01:00
Mikael Nordfeldth a2ddcc124f No redirect follow on HEAD request (bump to PHP5.5 minimum requirement)
We're using the try-catch-finally clause where "finally" wasn't introduced
until PHP 5.5, so our minimum requirement for GNU social is bumped to that.
2015-06-02 11:07:11 +02:00
Mikael Nordfeldth cc996f58db Test in Ostatus_profile if avatar is an image before writing to filesystem
This clears one FIXME...

We also fix HTTPClient::quickGet() (and a related call in OStatus testfeed.php).
2015-01-27 14:00:39 +01:00
Mikael Nordfeldth 964d13792b ssl_verify_host option in config (default is true) 2015-01-22 12:21:57 +01:00
Mikael Nordfeldth 5c7ad2e031 Added a quickGet in HTTPClient 2015-01-22 12:16:01 +01:00
Mikael Nordfeldth 255943d78f User agents and generators changed to GNU social 2013-11-01 13:46:05 +01:00
Mikael Nordfeldth 2ef9beb4b1 defines changed to GNU social names instead of StatusNet 2013-10-27 11:27:12 +01:00
Mikael Nordfeldth f46d675a20 GNU social is with a minor s. 2013-10-15 00:20:36 +02:00
Mikael Nordfeldth a0e107f17f Implemented WebFinger and replaced our XRD with PEAR XML_XRD
New plugins:
* LRDD
    LRDD implements client-side RFC6415 and RFC7033 resource descriptor
    discovery procedures. I.e. LRDD, host-meta and WebFinger stuff.

    OStatus and OpenID now depend on the LRDD plugin (XML_XRD).

* WebFinger
    This plugin implements the server-side of RFC6415 and RFC7033. Note:
    WebFinger technically doesn't handle XRD, but we serve both that and
    JRD (JSON Resource Descriptor), depending on Accept header and one
    ugly hack to check for old StatusNet installations.

    WebFinger depends on LRDD.

We might make this even prettier by using Net_WebFinger, but it is not
currently RFC7033 compliant (no /.well-known/webfinger resource GETs).

Disabling the WebFinger plugin would effectively render your site non-
federated (which might be desired on a private site).

Disabling the LRDD plugin would make your site unable to do modern web
URI lookups (making life just a little bit harder).
2013-09-30 22:04:52 +02:00
Mikael Nordfeldth 792e1aeb47 StatusNet_HTTPResponse now prefixed with GNUSocial_ 2013-09-19 16:11:04 +02:00
Evan Prodromou 98a0d7f538 Configuration options for using an HTTP proxy
We can make a lot of HTTP requests from the server side. This change
adds some configuration options for using an HTTP proxy, which can
cache hits from multiple sites (good for status.net-like services, for example).
2011-01-03 10:38:32 -08:00
Brion Vibber ebd2fc2f7c Partial fix for ticket #2489 -- problems with SNI SSL virtual host certificate validation.
Two prongs here:
* We attempt to enable SNI on the SSL stream context with the appropriate hostname... This requires PHP 5.3.2 and OpenSSL that supports the TLS extensions. Unfortunately this doesn't seem to be working in my testing.
* If set $config['http']['curl'] = true, we'll use the CURL backend if available. In my testing on Ubuntu 10.04, this works. No guarantees on other systems.

I'm not enabling CURL mode by default just yet; want to make sure there's no other surprises.
2010-08-06 10:14:07 -07:00
Brion Vibber 2c12d837c6 Disable SSL peer/hostname verification for HTTPClient unless we've configured a trusted CA bundle like this: $config['http']['ssl_cafile'] = '/usr/lib/ssl/certs/ca-certificates.crt';
The previous state was failing on all HTTPS hits due to HTTP_Request2 library turning on the validation check but not specifying a CA file.
2010-05-21 10:12:39 -07:00
Brion Vibber a8d92dad5e Renamed HTTPResponse class to StatusNet_HTTPResponse to avoid conflict with PECL HTTP extension.
The class isn't referenced by name by any other code I can see so this should have no side effects.
2010-03-29 15:07:15 -07:00
Brion Vibber 5cd020bf29 Workaround intermittent bugs with HEAD requests by disabling keepalive in HTTPClient.
I think this is a bug in Youtube's web server (sending chunked encoding of an empty body with a HEAD response, leaving the connection out of sync when it doesn't attempt to read a body) but the HTTP_Request2 library may need to be adjusted to watch out for that.
2010-03-10 15:13:16 -08:00
Brion Vibber dc09453a77 First steps on converting FeedSub into the pub/sub basis for OStatus communications:
* renamed FeedSub plugin to OStatus
* now setting avatar on subscriptions
* general fixes for subscription
* integrated PuSH hub to handle only user timelines on canonical ID url; sends updates directly
* set $config['feedsub']['nohub'] = true to test w/ foreign feeds that don't have hubs (won't actually receive updates though)
* a few bits of code documentation
* HMAC support for verified distributions (safest if sub setup is on HTTPS)

And a couple core changes:
* minimizing HTML output for exceptions in API requests to aid in debugging
* fix for rel=self link in apitimelineuser when id given

This does not not yet include any of the individual subscription management (Salmon notifications for sub/unsub, etc) nor a nice UI for user subscriptions.
Needs some further cleanup to treat posts as status updates instead of link references.
2010-02-08 11:15:29 -08:00
Brion Vibber 5581143bee Rebuilt HTTPClient class as an extension of PEAR HTTP_Request2 package, adding redirect handling and convenience functions.
Caching support will be added in future work after unit tests have been added.

* extlib: add PEAR HTTP_Request2 0.4.1 alpha
* extlib: update PEAR Net_URL2 to 0.3.0 beta for HTTP_Request2 compatibility
* moved direct usage of CURL and file_get_contents to HTTPClient class, excluding external-sourced libraries
* adapted GeonamesPlugin for new HTTPResponse interface

Note some plugins haven't been fully tested yet.
2009-11-02 09:14:15 -08:00
Brion Vibber b22fc5b74a Revert "Rebuilt HTTPClient class as an extension of PEAR HTTP_Request2 package, adding redirect handling and convenience functions."
Going to restructure a little more before finalizing this...

This reverts commit fa37967858.
2009-11-02 07:51:29 -08:00
Brion Vibber fa37967858 Rebuilt HTTPClient class as an extension of PEAR HTTP_Request2 package, adding redirect handling and convenience functions.
Caching support will be added in future work after unit tests have been added.

* extlib: add PEAR HTTP_Request2 0.4.1 alpha
* extlib: update PEAR Net_URL2 to 0.3.0 beta for HTTP_Request2 compatibility
* moved direct usage of CURL and file_get_contents to HTTPClient class, excluding external-sourced libraries

Note some plugins haven't been tested yet.
2009-11-02 06:31:28 -08:00
Evan Prodromou 65c45986c6 HTTPResponse has default empty headers 2009-10-22 16:20:56 -04:00
Evan Prodromou 15a2b69777 statusize new HTTP classes 2009-09-15 22:31:52 -04:00
Evan Prodromou 6f531745ca change all evans to evan@status.net 2009-09-15 22:28:59 -04:00
Evan Prodromou 9a9a0ae56f add cURL client with HEAD method 2009-09-15 21:50:19 -04:00
Evan Prodromou 8ceb4196f3 add user agent and correct version check to httpclient 2009-09-15 21:22:47 -04:00
Evan Prodromou ae20d073ce update httpclient class 2009-09-15 21:12:59 -04:00
Evan Prodromou 20dd0db704 move httputil to httpclient 2009-09-15 21:12:59 -04:00