本帖最后由 dmcyxsdn 于 2013-04-11 11:35:20 编辑

解决方案 »

  1.   

    如果成功了,返回的是:HTTP/1.1 200 OK
    Date: Thu, 11 Apr 2013 02:40:03 GMT
    Server: Apache
    Set-Cookie: U_TRS1=0000000b.ad9e2187.51662283.7d49ff20; path=/; expires=Sun, 09-Apr-23 02:40:03 GMT; domain=.sina.com.cn
    Set-Cookie: U_TRS2=0000000b.adad2187.51662283.e20bf120; path=/; domain=.sina.com.cn
    Cache-Control: no-cache, must-revalidate
    Expires: Sat, 26 Jul 1997 05:00:00 GMT
    Pragma: no-cache
    P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
    DPOOL_HEADER: jason129
    Content-Length: 3345
    Connection: close
    Content-Type: application/json; charset=utf-8
    SINA-LB:eWYyMDYuaGEueWZncm91cDEuYmoubG9hZGJhbGFuYw=={"code":"100000","msg":"","data":{"html":"\t\t\t\t\t                \t\t<div  diss-data=\"group_source=\" class=\"WB_feed_type SW_fun  S_line2\" mid=\"3565848532470723\"  action-type=\"feed_list_item\"   >\n\t\t\t\n\t\t\t\t\t\t\t\t\t\t<div class=\"WB_feed_datail S_line2 clearfix\">\n\t\t\t<div class=\"WB_face\">\n\t\t\t\t<a class=\"W_face_radius\" href=\"\/u\/2840040617\" title=\"\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34\"><img usercard=\"id=2840040617\" title=\"\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34\" alt=\"\" width=\"50\" height=\"50\" src=\"http:\/\/tp2.sinaimg.cn\/2840040617\/50\/40019436744\/1\"\/><\/a>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t<div class=\"WB_detail\">\n\t\t\t\t\t\t\t\t<div class=\"WB_info\"><a class=\"WB_name S_func1\" nick-name=\"\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34\" title=\"\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34\" href=\"\/u\/2840040617\" title=\"\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34\" usercard=\"id=2840040617\">\n\t\t\t\t\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34<\/a>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"WB_text\" node-type=\"feed_list_content\">\u4e09\u751f\u65e0\u77f3\uff0c\u5fd8\u5ddd\u716e\u6c34\u3002 9121522526821046<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"WB_func clearfix\">\n\t\t\t\t\t<div class=\"WB_handle\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"hover\"><a  href=\"javascript:void(0);\" action-type=\"feed_list_delete\">\u5220\u9664<\/a><i class=\"S_txt3\">|<\/i><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"javascript:void(0);\" action-type=\"feed_list_like\" action-data=\"version=mini&qid=heart&mid=3565848532470723\" title=\"\u8d5e\" ><em class=\"W_ico20 icon_praised_b\"><\/em><\/a><i class=\"S_txt3\">|<\/i>\n\t\t\t\t\t\t\t\t\t\t\t\t<a suda-data=\"key=smart_feed&value=time_sort_tran\" href=\"javascript:void(0);\" action-type=\"feed_list_forward\" action-data=\"allowForward=1&url=http:\/\/weibo.com\/2840040617\/zrD1jamKn&mid=3565848532470723&name=\u4e09\u751f\u65e0\u77f3_\u5fd8\u5ddd\u716e\u6c34&uid=2840040617&domain=2840040617\" >\u8f6c\u53d1<\/a><i class=\"S_txt3\">|<\/i>\n\t\t\t\t\t\t\t\t\t\t\t\t<a suda-data=\"key=smart_feed&value=time_sort_collect\" href=\"javascript:void(0);\" diss-data=\"fuid=2840040617\" action-type=\"feed_list_favorite\"  >\u6536\u85cf<\/a><i class=\"S_txt3\">|<\/i>\n\t\t\t\t\t\t\t\t\t\t\t\t<a suda-data=\"key=smart_feed&value=time_sort_comm\" href=\"javascript:void(0);\" action-type=\"feed_list_comment\" action-data=\"ouid=2840040617&location=\">\u8bc4\u8bba<\/a>\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<div class=\"WB_from\">\n\t\t\t\t\t\n\t\t\t\t\t<a target=\"_blank\" href=\"\/2840040617\/zrD1jamKn\" title=\"2013-04-11 10:40\" date=\"1365648002000\" class=\"S_link2 WB_time\" node-type=\"feed_list_item_date\" suda-data=\"key=tblog_home_new&value=feed_time\"> 10\u79d2\u524d<\/a> <em class=\"S_txt2\">\u6765\u81ea<\/em><a class=\"S_link2\" suda-data=\"key=tblog_home_new&value=feed_come_from\" target=\"_blank\" href=\"http:\/\/app.weibo.com\/t\/feed\/69yt1V\" rel=\"nofollow\">\u65b0\u6d6a\u5fae\u535a<\/a>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<div node-type=\"feed_list_repeat\" class=\"WB_media_expand repeat S_line1 S_bg4\" style=\"display:none;\"><\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\t\n\t\t \n\t"}}我的程序运行之后返回的是:
    HTTP/1.1 302 Found 
    [Date: Thu, 11 Apr 2013 02:41:38 GMT
    Server: Apache
    Set-Cookie: U_TRS1=0000000b.699a3895.516622e2.4bbcc0d4; path=/; expires=Sun, 09-Apr-23 02:41:38 GMT; domain=.sina.com.cn
    Set-Cookie: U_TRS2=0000000b.69ad3895.516622e2.bc330e2c; path=/; domain=.sina.com.cn
    Cache-Control: no-cache, must-revalidate
    Expires: Sat, 26 Jul 1997 05:00:00 GMT
    Pragma: no-cache
    P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
    Location: http://weibo.com/sorry?sysbusy
    DPOOL_HEADER: balor154
    Vary: Accept-Encoding
    Content-Length: 0
    Connection: close
    Content-Type: text/html; charset=utf-8
    SINA-LB:eWYxNjYuaGEueWZncm91cDEuYmoubG9hZGJhbGFuYw==]
      

  2.   

    上面的太乱了,我把不同的贴出来:成功返回:
    HTTP/1.1 200 OK
    DPOOL_HEADER: jason129                         失败则是balor154,好像是人名
    Content-Length: 3345
    Content-Type: application/json; charset=utf-8  失败的type是text/html
    返回一个json,在页面显示。我目前返回:
    HTTP/1.1 302 Found 
    Location: http://weibo.com/sorry?sysbusy
    DPOOL_HEADER: balor154
    Vary: Accept-Encoding---------------------这个不知道是什么
    Content-Length: 0
    Content-Type: text/html; charset=utf-8
      

  3.   

    Vary: Accept-Encoding这个是压缩你请求头设为application/json看喜爱
      

  4.   

    使用wireshark抓包,比较你的代码发送的请求和微博客户端发送的请求有什么不同。我想这个不同点就是造成响应代码不同的原因吧!
      

  5.   

    14.44 VaryThe Vary field value indicates the set of request-header fields that fully determines, while the response is fresh, whether a cache is permitted to use the response to reply to a subsequent request without revalidation. For uncacheable or stale responses, the Vary field value advises the user agent about the criteria that were used to select the representation. A Vary field value of "*" implies that a cache cannot determine from the request headers of a subsequent request whether this response is the appropriate representation. See section 13.6 for use of the Vary header field by caches.       Vary  = "Vary" ":" ( "*" | 1#field-name )An HTTP/1.1 server SHOULD include a Vary header field with any cacheable response that is subject to server-driven negotiation. Doing so allows a cache to properly interpret future requests on that resource and informs the user agent about the presence of negotiationon that resource. A server MAY include a Vary header field with a non-cacheable response that is subject to server-driven negotiation, since this might provide the user agent with useful information about the dimensions over which the response varies at the time of the response.A Vary field value consisting of a list of field-names signals that the representation selected for the response is based on a selection algorithm which considers ONLY the listed request-header field values in selecting the most appropriate representation. A cache MAY assume that the same selection will be made for future requests with the same values for the listed field names, for the duration of time for which the response is fresh.The field-names given are not limited to the set of standard request-header fields defined by this specification. Field names are case-insensitive.A Vary field value of "*" signals that unspecified parameters not limited to the request-headers (e.g., the network address of the client), play a role in the selection of the response representation. The "*" value MUST NOT be generated by a proxy server; it may only be generated by an origin server. 我觉得vary不是关键,system busy的提示我倒看到了,还是试试楼上说的抓包比较吧