Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set protocol version on request creation #49

Merged
merged 1 commit into from
Sep 24, 2015
Merged

Conversation

WyriHaximus
Copy link
Member

Follow up for #43 and fixes #47. This way a user can present it self as a HTTP1.1 client.

@WyriHaximus
Copy link
Member Author

Ping @clue @cboden

@WyriHaximus WyriHaximus added this to the v0.4.7 milestone Sep 23, 2015
@mbonneau
Copy link
Contributor

Thanks @WyriHaximus - this works for my purposes.

@clue
Copy link
Member

clue commented Sep 23, 2015

👍 After all #43 is pretty much useless without this changeset IMHO :-)

I'm not a huge fan of the current API, but for now this makes sense. This will likely be resolved once we look into #41 anyway.

@WyriHaximus
Copy link
Member Author

@clue yeah this is a good intermediate step, not very excited about this API but it's effective. #41 will be a huge change API wise and it something for 0.5 IMHO

cboden added a commit that referenced this pull request Sep 24, 2015
Set protocol version on request creation
@cboden cboden merged commit cf8ca08 into master Sep 24, 2015
@cboden cboden deleted the set-http-version branch September 24, 2015 19:29
@deathmood
Copy link

Please tell me where I am wrong, `cause it does not work for me - I can not get response body with HTTP 1.1:

$request = $client->request('GET', 'http://facebook.com', [], '1.1');
$request->on('response', function ($res) {
    $res->on('data', function ($data, $res) {
        var_dump($data);
    });
});

it does not work for http://vk.com, http://facebook.com
why?

@WyriHaximus
Copy link
Member Author

@deathmood It doesn't work that way for a) the HTTP version comes back with the response headers, not with the body and b) there is no guarantee that the server will response with a HTTP/1.1 response

@deathmood
Copy link

@WyriHaximus actually it does response with HTTP/1.1:

$req = $client->request('GET', 'https://vk.com');
$req->on('response', function ($res) {
    $res->on('data', function ($data, $r) {
        var_dump($r);
        var_dump($data);
    });
});
$req->end();

var_dump($r)

image

var_dump($data)

image

both on http://vk.com and http://facebook.com. But I can not get $data - so I can not use these social APIs. What is the problem? How should I use it to get $data from these social networks?

P.S. it works normally (at least I can get all $data) with https://github.com and https://twitter.com but not with vk/facebook. Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do I explicitly use HTTP/1.1?
5 participants