phergie / phergie-irc-plugin-react-url

Phergie plugin for displaying information about URLs
MIT License
0 stars 4 forks source link

301 and 302 responses not being handled #4

Closed svpernova09 closed 8 years ago

svpernova09 commented 8 years ago

Looks like 301 Moved Permanently and 302 Found responses are not being handled.

From #phpc on Freenode:

3:48 terratoma: http://www.rawstory.com/2015/04/texas-gop-lawmaker-what-is-going-on-in-baltimore-is-because-of-too-many-gay-marriages
3:48 Phergie: [http://gsc.io/u/57]

Note the lack of a title in the output.

When I hit the URL as it's given above, I get this:

04:09:24 ~ $ curl -v "http://www.rawstory.com/2015/04/texas-gop-lawmaker-what-is-going-on-in-baltimore-is-because-of-too-many-gay-marriage"
* Adding handle: conn: 0x7f91b380aa00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f91b380aa00) send_pipe: 1, recv_pipe: 0
* About to connect() to www.rawstory.com port 80 (#0)
*   Trying 104.239.182.155...
* Connected to www.rawstory.com (104.239.182.155) port 80 (#0)
> GET /2015/04/texas-gop-lawmaker-what-is-going-on-in-baltimore-is-because-of-too-many-gay-marriage HTTP/1.1
> User-Agent: curl/7.30.0
> Host: www.rawstory.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
* Server nginx is not blacklisted
< Server: nginx
< Content-Type: text/html
< Date: Fri, 01 May 2015 21:10:42 GMT
< Keep-Alive: timeout=20
< Location: http://www.rawstory.com/2015/04/texas-gop-lawmaker-what-is-going-on-in-baltimore-is-because-of-too-many-gay-marriage/
< X-Type: default
< Connection: keep-alive
< Set-Cookie: X-Mapping-fjhppofk=8D623D1BB3EE0A25628811CAA06CFFB8; path=/
< Content-Length: 178
<
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host www.rawstory.com left intact

But if I append a /, to make the URL consistent with what's shown in the Location response header above, I get a 200 OK response and the body contains a title:

04:10:43 ~ $ curl -v "http://www.rawstory.com/2015/04/texas-gop-lawmaker-what-is-going-on-in-baltimore-is-because-of-too-many-gay-marriages/" 2>&1 | grep '<title>'
<title>  Texas GOP lawmaker: &#8216;What is going on in Baltimore&#8217; is because of too many gay marriages</title>

(Originally opened by @elazar on a different repo, moving issue to this rep)

svpernova09 commented 8 years ago

Comments from previous repo:

screenshot 2015-11-14 09 18 44
sitedyno commented 8 years ago

I believe this bug is now fixed. The first URL (which still redirects) works on the version of phergie-freenode that I'm using.

svpernova09 commented 8 years ago

:+1: