【Android】OkHttp测试网络连接

学而不思则罔,思而不学则殆

【Android】OkHttp测试网络连接

  • 引言
  • 发送网络请求
    • 测试http
      • 1. 建立socket连接
      • 2. 发送请求
      • 3. 接受数据
      • 测试post数据
      • 测试http://www.baidu.com
    • 测试https
      • 建立安全通道
      • 测试https://www.baidu.com/
      • 测试二
  • 总结


引言

知道OkHttp底层是通过Socket连接,发送网络请求,本篇文章就是模拟这种方式来发送网路请求

发送网络请求

测试http

1. 建立socket连接

    public static void main(String[] args) {
        try {
            testHttp("http://localhost:3434/okhttp");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void testHttp(String url) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder().build();
        Request request = new Request.Builder().url(url).build();
        System.out.println(request);
        HttpUrl httpUrl = request.url;
        System.out.println("httpUrl:" + httpUrl);
        System.out.println("host:" + httpUrl.host());
        System.out.println("port:" + httpUrl.port());
        System.out.println("pathSegments:" + httpUrl.pathSegments());

        Dns dns = client.dns;
        System.out.println("dns:" + dns);
        List<InetAddress> addresses = dns.lookup(httpUrl.host());
        //[localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:
        System.out.println("addresses:" + addresses);


        SocketFactory socketFactory = client.socketFactory();
        System.out.println("SocketFactory:" + socketFactory);

        //建立安全连接的时候需要
        SSLSocketFactory sslSocketFactory = null;
        HostnameVerifier hostnameVerifier = null;
        CertificatePinner certificatePinner = null;
        if (httpUrl.isHttps()) {
            sslSocketFactory = client.sslSocketFactory();
            hostnameVerifier = client.hostnameVerifier();
            certificatePinner = client.certificatePinner();
        }

        Authenticator authenticator = client.authenticator();
        Proxy proxy = client.proxy();

        List<Protocol> protocols = client.protocols;
        System.out.println("DEFAULT_PROTOCOLS:" + protocols);
        List<ConnectionSpec> connectionSpecs = client.connectionSpecs;
        System.out.println("DEFAULT_CONNECTION_SPECS:" + connectionSpecs);
        ProxySelector proxySelector = ProxySelector.getDefault();
        System.out.println("ProxySelector:" + proxySelector);


        //创建Address
        Address address = new Address(httpUrl.host, httpUrl.port, dns, socketFactory,
                sslSocketFactory, hostnameVerifier, certificatePinner, authenticator,
                proxy, protocols, connectionSpecs, proxySelector);

        //建立socket连接
        Socket socket = socketFactory.createSocket();
        //需要IPV4
        InetAddress inetAddress = addresses.get(0);
        //localhost/127.0.0.1
        System.out.println(inetAddress);
        //构建InetSocketAddress
        InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, httpUrl.port);
        //localhost/127.0.0.1:3434
        System.out.println(inetSocketAddress);
        //socket.connect(inetAddress, 1000);
        socket.connect(inetSocketAddress);
        System.out.println("socket:" + socket);

        //获取输入输出流
        OutputStream outputStream = socket.getOutputStream();
        InputStream inputStream = socket.getInputStream();
     }
Request{method=GET, url=http://localhost:3434/okhttp, tag=null}
httpUrl:http://localhost:3434/okhttp
host:localhost
port:3434
pathSegments:[okhttp]
dns:okhttp3.Dns$1@7506e922
addresses:[localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1]
SocketFactory:javax.net.DefaultSocketFactory@4ee285c6
DEFAULT_PROTOCOLS:[h2, http/1.1]
DEFAULT_CONNECTION_SPECS:[ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_3, TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec()]
ProxySelector:sun.net.spi.DefaultProxySelector@621be5d1
localhost/127.0.0.1
localhost/127.0.0.1:3434
socket:Socket[addr=localhost/127.0.0.1,port=3434,localport=58392]

当目前为止已经建立了连接,由于http是不安全的连接,不需要嵌套安全连接。

2. 发送请求

模拟发送http请求

        String header = "GET http://localhost:3434/okhttp HTTP/1.1\r\n";
        outputStream.write(header.getBytes());
        //发送请求头
        outputStream.write("Accept-Encoding: gzip\r\n".getBytes());
        outputStream.write("Connection: keep-alive\r\n".getBytes());
        outputStream.write("Host: localhost:3434\r\n".getBytes());
        outputStream.write("User-Agent: DiyClient/zy\r\n".getBytes());
        outputStream.write("\r\n".getBytes());
        outputStream.flush();

3. 接受数据

        //读取数据
        byte[] data = new byte[1024];
        System.out.println("read...");
        int read = inputStream.read(data);
        while (read != -1) {
            System.out.println(new String(data));
            read = inputStream.read(data);
        }
HTTP/1.1 200 OK
Date: Fri, 09 Oct 2020 00:30:45 GMT
Content-Type: application/json; charset=UTF-8
author: zy
Connection: close
Server: Jetty(9.3.2.v20150730)

{"code":200,"msg":"OK","data":"GET from Server,Your Msg is :"}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

测试post数据

确认请求行

POST http://localhost:3434/okhttp HTTP/1.1
Accept-Encoding: gzip
Connection: keep-alive
Content-Length: 22
Content-Type: application/json; charset=UTF-8
Host: localhost:3434
User-Agent: zy/test

{"name":"zy","age":18}

用java代码发送:

        //发送请求行
        String header = "POST http://localhost:3434/okhttp HTTP/1.1\r\n";
        outputStream.write(header.getBytes());
        //发送请求头
        outputStream.write("Accept-Encoding: gzip\r\n".getBytes());
        outputStream.write("Connection: keep-alive\r\n".getBytes());
        outputStream.write("Host: localhost:3434\r\n".getBytes());
        outputStream.write("Content-Length: 22\r\n".getBytes());
        outputStream.write("Content-Type: application/json; charset=UTF-8\r\n".getBytes());
        outputStream.write("User-Agent: DiyClient/zy\r\n".getBytes());
        outputStream.write("\r\n".getBytes());
        outputStream.write("{\"name\":\"zy\",\"age\":18}".getBytes());//发送内容
        outputStream.write("\r\n".getBytes());
        outputStream.flush();

结果如下:

Request{method=GET, url=http://localhost:3434/okhttp, tag=null}
httpUrl:http://localhost:3434/okhttp
host:localhost
port:3434
pathSegments:[okhttp]
dns:okhttp3.Dns$1@7506e922
addresses:[localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1]
SocketFactory:javax.net.DefaultSocketFactory@4ee285c6
DEFAULT_PROTOCOLS:[h2, http/1.1]
DEFAULT_CONNECTION_SPECS:[ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_3, TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec()]
ProxySelector:sun.net.spi.DefaultProxySelector@621be5d1
localhost/127.0.0.1
localhost/127.0.0.1:3434
socket:Socket[addr=localhost/127.0.0.1,port=3434,localport=58505]
read...
HTTP/1.1 200 OK
Date: Fri, 09 Oct 2020 00:46:45 GMT
Content-Type: application/json; charset=UTF-8
author: zy
Connection: close
Server: Jetty(9.3.2.v20150730)

{"code":200,"msg":"OK","data":"POST from Server,Your Msg is :{\"name\":\"zy\",\"age\":18}"}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

成功发送post请求。

测试http://www.baidu.com

Request{method=GET, url=http://www.baidu.com/, tag=null}
httpUrl:http://www.baidu.com/
host:www.baidu.com
port:80
pathSegments:[]
dns:okhttp3.Dns$1@7506e922
addresses:[www.baidu.com/14.215.177.39, www.baidu.com/14.215.177.38]
SocketFactory:javax.net.DefaultSocketFactory@4ee285c6
DEFAULT_PROTOCOLS:[h2, http/1.1]
DEFAULT_CONNECTION_SPECS:[ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_3, TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec()]
ProxySelector:sun.net.spi.DefaultProxySelector@621be5d1
www.baidu.com/14.215.177.39
www.baidu.com/14.215.177.39:80
socket:Socket[addr=www.baidu.com/14.215.177.39,port=80,localport=58439]
read...
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=1
Content-Encoding: gzip
Content-Length: 3371
Content-Type: text/html
Date: Fri, 09 Oct 2020 00:39:35 GMT
Etag: "1cd6-5480030886bc0"
Expires: Fri, 09 Oct 2020 00:39:36 GMT
Last-Modified: Wed, 08 Feb 2017 07:55:35 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Server: Apache
Set-Cookie: BAIDUID=836C0A6A03607B2CA66A3A8A696F1A79:FG=1; expires=Sat, 09-Oct-21 00:39:35 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
Set-Cookie: BAIDUID=836C0A6A03607B2C1FD8681AFAB08262:FG=1; expires=Sat, 09-Oct-21 00:39:35 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
Vary: Accept-Encoding,User-Agent

      �Y�o���_�\u2Q%�N"�
l�i��M���W�Ę_%))��?����)ִ˖�]?Ҵ]��Y�tO�a�4`@;`;^R�d9+:;u��u�����4�ف��L�&��l����͆�
�D���$	��T�Ѱ�4�YbvZ��j�4����y�7}��?���W�����_�����'pAàϢ��u�K�Q+��mPU��������L]���-0�EF�Z��(��v��n�9��� �Ԟ;�h�q��n�Զ�S�^h{0���	�z�\�8}6J�aN������:�V�,~:7��]�F�N-���Q�7̴�˫:|,Ÿ�7?r:�dT���N���S@ed�J���P���X���'Х���S��f�*(GU�j��W�~^�	�A��(�~Z?,{T�����Qw����عp_:�[/��4WO"���`�B׋\W�T��֢��Ӭ����+N�����E�r�BF���v�W�&��4I����m�:��4lU��ױ��e�o�����4�����*���ı��:$	�z3u�饉?��îu�GSȵm[�	>0�^��a�`2p���Ü?��.Wuġ�q�H�D�쐖�<���:����v�Хu�w��[n`���a��5F���8~8'�����b���OK"�|���N��7L�^��n7����5��0N�H�A�������1clm�z	3xc�h������
Cw�h׵:��:N;;^*Wyp�E}L���=
<�SF��h��
o�O4�36���&�A�! bm�T:4��TBX����5l٤���|�ѷ�kTh���и!.c��!��0���ϸl�������y��wF%l6l�ύ�Hf�ہ��
RYc�sW{����-D�80I�N$�B�Tk��ԋ�GC���B���m=��A<QE���+���h��/7Z��?[_��Qi���Z4/�O�7?Je�0���A���+���;9�p1O�yiq>��A����w_���wl6e��R�[GXB�<��G�����18�I>����U��b���	U1o��n`ο? �G����`�!�g�Dnel
Q��k�D�S�K$�r(Y. �$���H�{-�I�<�P+��=�c&R�{ �������,j_ 
���1a�K��- &4��{rI95���7��{�WcB i6z� �
t�3As!s�㱽� ����EH��H���4��ſ�ٮ]4�����ۏ^�r�^鹩�Od	�8�NDoy��h��)<�����I�dtiP�-
J��}(ݐ&e�"V!���獿;��b���%���
�3~�௨r'��� ��U�1+�A�
Q�Ľ�SO���slk��I���X�37H��J�1ڵ�L��3բ�7W+)H�Q�-	�k���kꪺ�w8��˅�>X���-e=����e���p�a
\eF=f0R�S({P��r�n=[l�X� 0�eN���R_�[��(-./��8����Dž��gq^�Hi�D;���i�>R1��Љഴ�%�S��W �~G�g���s�ya���:���"�7��e�>���K6HW}W�!��^:-o嵭�2ճu�Fں�� \6�P>�߸���Z�����@9�Q���S@$�IΤ�:�ׅd$e�����YL���H����618L1`��{>��Gؑ'�t��N��9�k�OS>�͞c�t��7���~�������/=

发现返回来的参数都是乱码
原来在请求头中添加了Accept-Encoding字段,但是本地却没有编码处理,所以移除掉这个字段。

        //outputStream.write("Accept-Encoding: gzip\r\n".getBytes());

把编码屏蔽掉,在测试一下。

Request{method=GET, url=http://www.baidu.com/, tag=null}
httpUrl:http://www.baidu.com/
host:www.baidu.com
port:80
pathSegments:[]
dns:okhttp3.Dns$1@7506e922
addresses:[www.baidu.com/14.215.177.39, www.baidu.com/14.215.177.38]
SocketFactory:javax.net.DefaultSocketFactory@4ee285c6
DEFAULT_PROTOCOLS:[h2, http/1.1]
DEFAULT_CONNECTION_SPECS:[ConnectionSpec(cipherSuites=[TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA], tlsVersions=[TLS_1_3, TLS_1_2, TLS_1_1, TLS_1_0], supportsTlsExtensions=true), ConnectionSpec()]
ProxySelector:sun.net.spi.DefaultProxySelector@621be5d1
www.baidu.com/14.215.177.39
www.baidu.com/14.215.177.39:80
socket:Socket[addr=www.baidu.com/14.215.177.39,port=80,localport=58461]
read...
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=1
Content-Length: 7382
Content-Type: text/html
Date: Fri, 09 Oct 2020 00:41:07 GMT
Etag: "1cd6-5480030886bc0"
Expires: Fri, 09 Oct 2020 00:41:08 GMT
Last-Modified: Wed, 08 Feb 2017 07:55:35 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Server: Apache
Set-Cookie: BAIDUID=BA73D174037EBF3FE9815E4618F7A335:FG=1; expires=Sat, 09-Oct-21 00:41:07 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
Set-Cookie: BAIDUID=BA73D174037EBF3F53EFF7CAB3C4B594:FG=1; expires=Sat, 09-Oct-21 00:41:07 GMT; max-age=31536000; path=/; domain=.baidu.com; version=1
Vary: Accept-Encoding,User-Agent

<!doctype html><html><head><meta http-equiv="Content-Type" content="text/html;charset=gb2312"><title>�ٶ�һ�£����֪��      </title><style>html{overflow-y:auto}body{font:12px arial;text-align:center;background:#fff}body,p,form,ul{margin:0;padding:0}body,form,#fm{position:relative}td{text-align:left}img{border:0}a{color:#
00c}a:active{color:#f60}#u{padding:7px 10px 3px 0;text-align:right}#m{width:680px;margin:0 auto}#nv{font-size:16px;margin:0 0 4px;text-align:left;text-indent:117px}#nv a,#nv b,.btn,#lk{font-size:14px}#fm{padding-left:90px;text-align:left}#kw{width:404px;height:22px;padding:4px 7px;padding:6px 7px 2px\9;font:16px arial;background:url(http://www.baidu.com/img/i-1.0.0.png) no-repeat -304px 0;_background-attachment:fixed;border:1px solid #cdcdcd;border-color:#9a9a9a #cdcdcd #cdcdcd #9a9a9a;vertical-align:top}.btn{width:95px;height:32px;padding:0;padding-top:2px\9;border:0;background:#ddd url(http://www.baidu.com/img/i-1.0.0.png) no-repeat;cursor:pointer}.btn_h{background-position:-100px 0}#kw,.btn_wr{margin:0 5px 0 0}.btn_wr{width:97px;height:34px;display:inline-block;background:url(http://www.baidu.com/img/i-1.0.0.png) no-repeat -202px 0;_top:1px;*position:relative}#lk{margin:33px 0}#lk span{font:14px "����"}#lm{height:60px}#lh{margin:16px 0 5px;word-spacing:3px}#mCon{height:18px;line-height:18px;position:absolu
te;right:7px;top:8px;top:10px\9;cursor:pointer;padding:0 18px 0 0;background:url(http://www.baidu.com/img/bg-1.0.0.gif) no-repeat right -134px;background-position:right -136px\9}#mCon span{color:#00c;cursor:default;display:block}#mCon .hw{text-decoration:underline;cursor:pointer}#mMenu{width:56px;border:1px solid #9a99ff;list-style:none;position:absolute;right:7px;top:28px;display:none;background:#fff}#mMenu a{width:100%;height:100%;display:block;line-height:22px;text-indent:6px;text-decoration:none}#mMenu a:hover{background:#d9e1f6}#mMenu .ln{height:1px;background:#ccf;overflow:hidden;margin:2px;font-size:1px;line-height:1px}#cp,#cp a{color:#77c}#sh{display:none;behavior:url(#default#homepage)}</style></head>
<body><p id="u"><a href="/gaoji/preferences.html">��������</a>&nbsp;|&nbsp;<a href="http://passport.baidu.com/?login&tpl=mn">��¼</a></p><div id="m"><p id="lg"><img src="http://www.baidu.com/img/baidu_sylogo1.gif" width="270" height="129" usemap="#mp"></p><p id="nv"><a href="http://news.baidu.com">��&nb
sp;��</a>��<b>��&nbsp;ҳ</b>��<a href="http://tieba.baidu.com">��&nbsp;��</a>��<a href="http://zhidao.baidu.com">֪&nbsp;��</a>��<a href="http://mp3.baidu.com">MP3</a>��<a href="http://image.baidu.com">ͼ&nbsp;Ƭ</a>��<a href="http://video.baidu.com">��&nbsp;Ƶ</a>��<a href="http://map.baidu.com">��&nbsp;ͼ</a></p><div id="fm"><form name="f" action="/s"><input type="text" name="wd" id="kw" maxlength="100"><input type="hidden" name="rsv_bp" value="0"><span class="btn_wr"><input type="submit" value="�ٶ�һ��" id="su" class="btn" onmousedown="this.className='btn btn_h'" onmouseout="this.className='btn'"></span></form><div id="mCon"><span>���뷨</span></div><ul id="mMenu"><li><a href="#" name="ime_hw">��д</a></li><li><a href="#" name="ime_py">ƴ��</a></li><li class="ln"></li><li><a href="#" name="ime_cl">�ر�</a></li></ul></div>
<p id="lk"><a href="http://hi.baidu.com">�ռ�</a>��<a href="http://baike.baidu.com">�ٿ�</a>��<a href="http://www.hao123.com">hao123</a><span> | <a href="/more/">����&gt;&gt;</a></span><
/p><p id="lm"></p><p><a id="sh" onClick="this.setHomePage('http://www.baidu.com/')" href="http://utility.baidu.com/traf/click.php?id=215&url=http://www.baidu.com" onmousedown="return ns_c({'fm':'behs','tab':'homepage','pos':0})">�Ѱٶ���Ϊ��ҳ</a></p><p id="lh"><a href="http://e.baidu.com/?refer=888">����ٶ��ƹ�</a> | <a href="http://top.baidu.com">�������ư�</a> | <a href="http://home.baidu.com">���ڰٶ�</a> | <a href="http://ir.baidu.com">About Baidu</a></p><p id="cp">&copy;2015 Baidu <a href="/duty/">ʹ�ðٶ�ǰ�ض�</a> <a href="http://www.miibeian.gov.cn" target="_blank">��ICP֤030173��</a> <img src="http://gimg.baidu.com/img/gs.gif"></p></div><map name="mp"><area shape="rect" coords="40,25,230,95"  href="http://hi.baidu.com/baidu/" target="_blank" title="��˽��� �ٶȵĿռ�" ></map></body>
<script>var w=window,d=document,n=navigator,k=d.f.wd,a=d.getElementById("nv").getElementsByTagName("a"),isIE=n.userAgent.indexOf("MSIE")!=-1&&!window.opera,sh=d.getElementById("sh");if(isIE&&sh&&!sh.isHomePage("http://
www.baidu.com/")){sh.style.display="inline"}for(var i=0;i0){var C=this,A=C.href,B=encodeURIComponent(k.value);if(A.indexOf("q=")!=-1){C.href=A.replace(/q=[^&$]*/,"q="+B)}else{this.href+="?q="+B}}}}(function(){if(/q=([^&]+)/.test(location.search)){k.value=decodeURIComponent(RegExp.$1)}})();if(n.cookieEnabled&&!/sug?=0/.test(d.cookie)){d.write('
                    
                    

你可能感兴趣的:(android,android)