zoukankan      html  css  js  c++  java
  • jsp server chuncked output & python client parser chuncked test

    #!/usr/bin/env python
    #encoding=utf-8
    """
    内置原生支持chuncked编码的解析
    """
    import sys
    reload(sys)
    sys.setdefaultencoding("utf-8")

    import urllib2
    url="http://localhost:8080/jsp_test/NewFile.jsp"
    r=urllib2.urlopen(url)
    html=r.read()
    print html
    print r.info()

    headers="""
    GET /jsp_test/NewFile.jsp HTTP/1.1
    Host: localhost:8080
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Cookie: JSESSIONID=53F2990C465E194734C5509BF16309B7
    Cache-Control: max-age=0
    """

    the pair server jsp page code is :

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
    </head>
    <body>
    dddddddddddd----
    sb
    大家 好
    <%
    System.out.println("44444444dd");
    //Response.Write("4444444ddd");
    //PrintWriter pw=response.getWriter().write("ZZZZZZZZZZZZZZ");
    //out.print("fffffffffffffffff");
    out.print("fffffffffffff");
    out.flush();
    out.print("zzzz<br/>");
    out.flush();
    out.print("zz<br/>");
    %>
    </body>
    </html>

  • 相关阅读:
    CSP-S 2019游记
    南校五天集训游记
    web.xml模板
    JDBC Template的基本使用
    Spring AOP(3)使用AspectJ xml配置
    Spring AOP(2)使用AspectJ注解
    Spring Aop(面向切面编程)
    Spring Bean管理3(xml与注解混合使用)
    Python核心技术与实战——十二|Python的比较与拷贝
    test
  • 原文地址:https://www.cnblogs.com/lexus/p/2416643.html
Copyright © 2011-2022 走看看