1. <html>
  2. <head>
  3. <script>
  4. function insertStr(str1,n,str2){
  5. if(str1.length<n){
  6. return str1+str2;
  7. }else{
  8. s1 = str1.substring(,n);
  9. s2 = str1.substring(n,str1.length);
  10. return s1+str2+s2;
  11. }
  12. }
  13.  
  14. function searchd(key1,mod_rest) {
  15. var loc = mod_rest.search(key1);
  16. if(loc==-){
  17. return mod_rest;
  18. }
  19. else{
  20. var mod_restd = insertStr(mod_rest,loc,"\n");
  21. return mod_restd;
  22. }
  23. }
  24.  
  25. function displayResult()
  26. {
  27. //打印post和get
  28. var testval = document.getElementById("myTextarea").value;
  29. var post_get = testval.split(" ",);
  30. //alert(typeof post_get);
  31. var raw1 = post_get[]+" "+post_get[]+" "+post_get[];
  32. //剩下的以":" 为分隔符
  33. //var rest = testval.split(":",5);
  34. //alert(typeof row1);
  35. //post_get.tostring();
  36. rest = testval.replace(raw1,"");
  37. //alert(rest);
  38.  
  39. t = searchd(/Accept:/,rest);
  40. //alert(t);
  41. t1 = searchd(/Accept-Encoding:/,t);
  42. t2 = searchd(/Host:/,t1);
  43. t3 = searchd(/Accept-Charset:/,t2);
  44. t4 = searchd(/Cookie:/,t3);
  45. t5 = searchd(/Connection:/,t4);
  46. t6 = searchd(/Cache-Control:/,t5);
  47. t7 = searchd(/User-Agent:/,t6);
  48. t8 = searchd(/Pragma:/,t7);
  49. t9 = searchd(/Acunetix-Aspect:/,t8);
  50. t10 = searchd(/Acunetix-Aspect-Password:/,t9);
  51. t11 = searchd(/Acunetix-Aspect-Queries:/,t10);
  52. t12 = searchd(/Content-Length:/,t11);
  53. t13 = searchd(/Content-Type:/,t12);
  54. t14 = searchd(/Accept-Language:/,t13);
  55. t15 = searchd(/Accept-Ranges:/,t14);
  56. t16 = searchd(/Authorization:/,t15);
  57. t17 = searchd(/Date:/,t16);
  58. t18 = searchd(/Expect:/,t17);
  59. t19 = searchd(/From:/,t18);
  60. t20 = searchd(/If-Match:/,t19);
  61. t21 = searchd(/If-Modified-Since:/,t20);
  62. t22 = searchd(/Max-Forwards:/,t21);
  63. t23 = searchd(/Proxy-Authorization:/,t22);
  64. t24 = searchd(/Range:/,t23);
  65. t25 = searchd(/Warning:/,t24);
  66. t26 = searchd(/Referer:/,t25);
  67. //alert(t26);
  68. document.getElementById('myexparea').value=raw1+t26;
  69. }
  70. </script>
  71. </head>
  72.  
  73. <body>
  74. <textarea id="myTextarea" name="testt" cols="" rows="">
  75. POST /maneinfo/login.asp HTTP/1.1 Pragma: no-cache Cache-Control: no-cache Referer: http://sbzxyey.jdjy.cn/ Content-Length: 48 Content-Type: application/x-www-form-urlencoded Acunetix-Aspect: enabled Acunetix-Aspect-Password: 082119f75623eb7abd7bf357698ff66c Acunetix-Aspect-Queries: filelist;aspectalerts Cookie: ASPSESSIONIDSSATAQRD=AOGJBOEBGCGIFPCFHEDNOCNH Host: sbzxyey.jdjy.cn Connection: Keep-alive Accept-Encoding: gzip,deflate User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.63 Safari/537.36 Accept: */* picnum=3943&pwhidden=&saveUser=&SecEx=&username=
  76. </textarea>
  77. <textarea id="myexparea" name="expio" cols="" rows="">
  78. </textarea>
  79. <br>
  80. <button type="button" onclick="displayResult()">Alert value of text area</button>
  81.  
  82. </body>
  83. </html>

DAY6 处理http头,格式化输出的更多相关文章

  1. cout 格式化输出

    一直习惯于C语言的printf函数来打印,突然有一天要用cout来打印,发现有点不适应. 原来cout也是有格式化输出的. 首先要引入头文件 #include<iostream> // 在 ...

  2. [转载] c++ cout 格式化输出浮点数、整数及格方法

    C语言里可以用printf(),%f来实现浮点数的格式化输出,用cout呢...? 下面的方法是在网上找到的,如果各位有别的办法谢谢留下... iomanip.h是I/O流控制头文件,就像C里面的格式 ...

  3. Debug格式化输出----基于C语言

    Debug格式化输出----基于C语言 1. 使用宏实现 举例: #include <stdio.h> #define ECHO_COLOR_NONE "\033[0;0m&qu ...

  4. C++格式化输出浮点数

    主要内容 介绍C++中如何格式化输出浮点数. 控制浮点数输出格式需要包含iomanip头文件. 使用fixed来控制输出的浮点数的小数位是固定的.可参考http://en.cppreference.c ...

  5. Python基础之注释,算数运算符,变量,输入和格式化输出

    Python的注释 注释的作用:用自己熟悉的语言,对某些代码进行标注说明,增强程序的可读性: 在python解释器解释代码的过程中,凡是#右边的,解释器都直接跳过这一行: 注释的分类 单行注释 # 这 ...

  6. Java基础 -- 字符串(格式化输出、正则表达式)

    一 字符串 1.不可变String String对象是不可变的,查看JDK文档你就会发现,String类中每一个看起来会修改String值的方法,实际上都是创建一个全新的String对象,以包含修改后 ...

  7. C++ cout格式化输出(转)

    C++ cout格式化输出(转) 这篇文章主要讲解如何在C++中使用cout进行高级的格式化输出操作,包括数字的各种计数法(精度)输出,左或右对齐,大小写等等.通过本文,您可以完全脱离scanf/pr ...

  8. Go语言从入门到放弃(三) 布尔/数字/格式化输出

    本章主要介绍Go语言的数据类型 布尔(bool) 布尔指对或者错,也就是说bool只有两个值, True 或 False 两个类型相同的值可以使用比较运算符来得出一个布尔值 当两个值是完全相同的情况下 ...

  9. c++中利用localtime_s函数格式化输出当地日期与时间

    Visual C++ 6.0开发环境中显示当地日期与时间主要通过localtime()函数来实现,该函数的原型在time.h头文件中,其语法格式如下: struct tm *localtime(xon ...

  10. [ZZ]c++ cout 格式化输出浮点数、整数及格式化方法

    C语言里可以用printf(),%f来实现浮点数的格式化输出,用cout呢...?下面的方法是在网上找到的,如果各位有别的办法谢谢留下... iomanip.h是I/O流控制头文件,就像C里面的格式化 ...

随机推荐

  1. [No000074]C#创建桌面快捷方式

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. Remove Duplicates from Sorted List II

    Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplica ...

  3. Python-05-常用模块

    sys模块 # sys.argv # 在执行程序的时候可以给程序传参数,例如类似执行nginx检测配置文件语法功能的命令, nginx -t # mode_sys.py import sys prin ...

  4. c语言函数

    听着函数这两个字多多少少都会觉得有点复杂吧.因为一想到函数大多数人都会想到f(x),但其实c语言里面的函数不是那样的,老师教了一个很好的理解方法函数就是个机器人,而这个机器人是你自己做出来的.所有不用 ...

  5. jquery实现html表格隔行变色

    效果图 实现代码: 通过css控制样式,利用jquery的addClass方法实现 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Trans ...

  6. JQuery中each()的使用方法说明

    JQuery中each()的使用方法说明 对于jQuery对象,只是把each方法简单的进行了委托:把jQuery对象作为第一个参数传递给jQuery的each方法.换句话说:jQuery提供的eac ...

  7. HTML5 移动浏览器支持

  8. python基础-修改haproxy配置文件

    需要掌握的知识: 1.函数 2.文件处理 3.tag的用法 4.程序的解耦 需求: 1:查询 2:添加 3:删除 4:修改 5:退出 haproxy.conf 配置文件内容: global log 1 ...

  9. Mysql 命令大全

    1.连接Mysql 格式: mysql -h主机地址 -u用户名 -p用户密码1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root - ...

  10. offsetHeight, clientHeight与scrollHeight的区别

      在网上搜了一下,结论非常笼统,讲IE从不讲版本,因此自己做了测试并上传结论.以下结论皆是在标准模式下测试通过的,没有测试quirk模式. clientHeight 大部分浏览器对 clientHe ...