Re: unexpected 302 response status on update by some user-agent

24 views
Skip to first unread message
Message has been deleted

e.p.c.

unread,
Apr 7, 2008, 9:04:04 AM4/7/08
to Twitter Development Talk
What user-agent did you specify?

I found that a user-agent of "Nokia E70-2/3.0 (2.0618.07.10) SymbianOS/
9.1 Series60/3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1" worked fine,
but if I shorten that to simply "Nokia" I also get the 302.

--
-ed costello

e.p.c.

unread,
Apr 7, 2008, 9:13:26 AM4/7/08
to Twitter Development Talk
Just to clarify my response, my tweet posted but instead of a 200 I
got a 302 with:

curl -A Nokia --user USER --data source=curl&status=Seems+like+UA=Nokia
+upsets+twitter\? --url http://twitter.com/statuses/update.json

Also get a 302 if the UA is 'xNokia'. Suspect there's a pattern match
on some subset of MIDP browsers (though I didn't get the 302 when
posting with the longer UA string noted in my post).
--
-ed costello

sugree

unread,
Apr 7, 2008, 9:47:06 AM4/7/08
to Twitter Development Talk
Below are my user-agent.

SonyEricssonW810i/R4EA Browser/NetFront/3.3 Profile/MIDP-2.0
Configuration/CLDC-1.1

I guess the problem is the missing of "(...)".

sugree

unread,
Apr 7, 2008, 9:58:37 AM4/7/08
to Twitter Development Talk
There are something weird happened in update api. http://twitter.com/statuses/update.format
will response with 302 if user-agent is not curl. For example

curl -v -u username -d status=test302 http://twitter.com/statuses/update.json

> POST /statuses/update.json HTTP/1.1
> Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> User-Agent: curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1
> Host: twitter.com
> Accept: */*
> Content-Length: 14
> Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 200 OK
< Date: Mon, 07 Apr 2008 06:42:47 GMT
< Server: hi
< Status: 200 OK
< P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
< X-Runtime: 0.02310
< ETag: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
< Cache-Control: private, max-age=0, must-revalidate, max-age=300
< Content-Type: application/json; charset=utf-8
< Content-Length: 464
< Set-Cookie:
_twitter_sess=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
domain=.twitter.com; path=/
< Via: 1.1 twitter-web008.twitter.com
< Expires: Mon, 07 Apr 2008 06:47:47 GMT
< Connection: close

Anyway, it returns 302 if user-agent is midp.

> POST /statuses/update.json HTTP/1.1
> Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Host: twitter.com
> Accept: */*
> Content-Length: 14
> Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 302 Moved Temporarily
< Date: Mon, 07 Apr 2008 07:13:00 GMT
< Server: hi
< Status: 302 Found
< Last-Modified: Mon, 07 Apr 2008 07:13:00 GMT
< P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
< Location: http://twitter.com/home
< X-Runtime: 0.01321
< Pragma: no-cache
< Cache-Control: no-cache, must-revalidate
< Content-Type: application/xhtml+xml; charaset=UTF8
< Content-Length: 89
< Expires: Sat, 26 Jul 1997 05:00:00 GMT
< Set-Cookie:
_twitter_sess=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
domain=.twitter.com; path=/
< Via: 1.1 twitter-web046.twitter.com
< Vary: Accept-Encoding
< Connection: close

The api works correctly if follow the redirection to http://twitter.com/home
but the problem is I have to read response about 4 KB HTML instead of
400 B JSON. I just don't want to waste 10 times bandwidth for nothing.
Note that J2ME applications are not allowed to change user-agent
unless they are signed.

Moreover, most J2ME clients now doesn't work correctly because of this
302 response.

sugree

unread,
Apr 7, 2008, 1:32:42 PM4/7/08
to Twitter Development Talk
One more thing, J2ME will automatically add "UNTRUSTED/1.0" the user-
agent.

UNTRUSTED/1.0 SonyEricssonW810i/R4CF SonyEricssonW810i/R4EA Browser/
NetFront/3.3 Profile/MIDP-2.0
Configuration/CLDC-1.1

sugree

unread,
Apr 8, 2008, 4:05:40 AM4/8/08
to Twitter Development Talk
I get 302 when using your user-agent.

curl -A "Nokia E70-2/3.0 (2.0618.07.10) SymbianOS/9.1 Series60/3.0
Profile/MIDP-2.0 Configuration/CLDC-1.1" -u USER -d
'source=curl&status=test+302' --url http://twitter.com/statuses/update.json

curl -A "NokiaE70-2/3.0 (2.0618.07.10) SymbianOS/9.1 Series60/3.0
Profile/MIDP-2.0 Configuration/CLDC-1.1" -u USER -d
'source=curl&status=test+302' --url http://twitter.com/statuses/update.json

Would you please try again?

Andy Bilodeau

unread,
Apr 8, 2008, 7:43:42 AM4/8/08
to twitter-deve...@googlegroups.com
Have you tried moving the -d to be the first switch in the curl
statement. That shouldn't matter but it's what was causing me grief.

Good luck.


--
Andy Bilodeau (andycaster)
http://andycast.net

sugree

unread,
Apr 8, 2008, 11:04:22 PM4/8/08
to Twitter Development Talk
I tried to move "-d" as you suggested with no luck.

curl -d 'source=curl&status=test+302' -A "NokiaE70-2/3.0
(2.0618.07.10) SymbianOS/9.1 Series60/3.0 Profile/MIDP-2.0
Configuration/CLDC-1.1" -u USER --url http://twitter.com/statuses/update.json

curl -d 'source=curl&status=test+302' -A "Nokia E70-2/3.0
(2.0618.07.10) SymbianOS/9.1 Series60/3.0 Profile/MIDP-2.0
Configuration/CLDC-1.1" -u USER --url http://twitter.com/statuses/update.json

twibble

unread,
Apr 13, 2008, 2:11:43 PM4/13/08
to Twitter Development Talk
Alex,

I also get complaints of people using my twibble mobile client (http://
www.twibble.de/twibble-mobile). A J2ME client should really not get a
302 after a successful post. Is there any news on that?

Best,
@twibble

On Apr 7, 3:58 pm, sugree <sug...@gmail.com> wrote:
> There are something weird happened in update api.http://twitter.com/statuses/update.format
> will response with 302 if user-agent is not curl. For example
>
> curl -v -u username -d status=test302http://twitter.com/statuses/update.json
> The api works correctly if follow the redirection tohttp://twitter.com/home

sugree

unread,
Apr 29, 2008, 11:17:13 PM4/29/08
to Twitter Development Talk
Any news in this issue? Is 302 expected to happen regularly?

Sugree

On Apr 14, 1:11 am, twibble <thilo.horstm...@gmail.com> wrote:
> Alex,
>
> I also get complaints of people using my twibble mobile client (http://www.twibble.de/twibble-mobile). A J2ME client should really not get a

Alex Payne

unread,
Apr 30, 2008, 2:24:35 PM4/30/08
to twitter-deve...@googlegroups.com
If you're hitting a URL that redirects, yes...

--
Alex Payne
http://twitter.com/al3x

sugree

unread,
May 1, 2008, 11:37:20 AM5/1/08
to Twitter Development Talk
Does it mean mobile applications always get 302 because of user-agent
"Profile/MIDP-2.1 Configuration/CLDC-1.1"? I tested this problem in
curl and it works as long as user-agent is curl. I always get 302 to
http://twitter.com/home when I specify user-agent similar to real
phone.

curl -v -u username -A "Profile/MIDP-2.1 Configuration/CLDC-1.1" -d
status=test302 http://twitter.com/statuses/update.json

As a result, the application will get result in html format which is
big and useless. Is this a normal behavior? Anyway, I expect to get
200 and status id for later use.

sugree

twibble

unread,
May 2, 2008, 1:50:46 PM5/2/08
to Twitter Development Talk
Alex, honestly I don't think the API behaves correctly in the case of
MIDP user agents. If you send a request to the correct URI you should
not get a 302 (the tweet is accepted and propagated correctly by the
twitter api, thats not a 302!). MIDP clients should get a 200 in case
of a successful status update just like any other user agent. There is
also no indication in the API docs that MIDP clients are handled
differently.

Best,
Thilo

Alex Payne

unread,
May 2, 2008, 1:58:27 PM5/2/08
to twitter-deve...@googlegroups.com
Indeed, we don't have any special logic for any sort of client.

--
Alex Payne
http://twitter.com/al3x

twibble

unread,
May 2, 2008, 2:03:10 PM5/2/08
to Twitter Development Talk
this means you are going to fix it?

On 2 Mai, 19:58, "Alex Payne" <a...@twitter.com> wrote:
> Indeed, we don't have any special logic for any sort of client.
>

Alex Payne

unread,
May 2, 2008, 2:11:31 PM5/2/08
to twitter-deve...@googlegroups.com
We'll look into it.

--
Alex Payne
http://twitter.com/al3x

sugree

unread,
May 2, 2008, 8:02:46 PM5/2/08
to Twitter Development Talk
Thank you very much.
Reply all
Reply to author
Forward
0 new messages