DAY6 处理http头,格式化输出
- <html>
- <head>
- <script>
- function insertStr(str1,n,str2){
- if(str1.length<n){
- return str1+str2;
- }else{
- s1 = str1.substring(,n);
- s2 = str1.substring(n,str1.length);
- return s1+str2+s2;
- }
- }
- function searchd(key1,mod_rest) {
- var loc = mod_rest.search(key1);
- if(loc==-){
- return mod_rest;
- }
- else{
- var mod_restd = insertStr(mod_rest,loc,"\n");
- return mod_restd;
- }
- }
- function displayResult()
- {
- //打印post和get
- var testval = document.getElementById("myTextarea").value;
- var post_get = testval.split(" ",);
- //alert(typeof post_get);
- var raw1 = post_get[]+" "+post_get[]+" "+post_get[];
- //剩下的以":" 为分隔符
- //var rest = testval.split(":",5);
- //alert(typeof row1);
- //post_get.tostring();
- rest = testval.replace(raw1,"");
- //alert(rest);
- t = searchd(/Accept:/,rest);
- //alert(t);
- t1 = searchd(/Accept-Encoding:/,t);
- t2 = searchd(/Host:/,t1);
- t3 = searchd(/Accept-Charset:/,t2);
- t4 = searchd(/Cookie:/,t3);
- t5 = searchd(/Connection:/,t4);
- t6 = searchd(/Cache-Control:/,t5);
- t7 = searchd(/User-Agent:/,t6);
- t8 = searchd(/Pragma:/,t7);
- t9 = searchd(/Acunetix-Aspect:/,t8);
- t10 = searchd(/Acunetix-Aspect-Password:/,t9);
- t11 = searchd(/Acunetix-Aspect-Queries:/,t10);
- t12 = searchd(/Content-Length:/,t11);
- t13 = searchd(/Content-Type:/,t12);
- t14 = searchd(/Accept-Language:/,t13);
- t15 = searchd(/Accept-Ranges:/,t14);
- t16 = searchd(/Authorization:/,t15);
- t17 = searchd(/Date:/,t16);
- t18 = searchd(/Expect:/,t17);
- t19 = searchd(/From:/,t18);
- t20 = searchd(/If-Match:/,t19);
- t21 = searchd(/If-Modified-Since:/,t20);
- t22 = searchd(/Max-Forwards:/,t21);
- t23 = searchd(/Proxy-Authorization:/,t22);
- t24 = searchd(/Range:/,t23);
- t25 = searchd(/Warning:/,t24);
- t26 = searchd(/Referer:/,t25);
- //alert(t26);
- document.getElementById('myexparea').value=raw1+t26;
- }
- </script>
- </head>
- <body>
- <textarea id="myTextarea" name="testt" cols="" rows="">
- 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=
- </textarea>
- <textarea id="myexparea" name="expio" cols="" rows="">
- </textarea>
- <br>
- <button type="button" onclick="displayResult()">Alert value of text area</button>
- </body>
- </html>
DAY6 处理http头,格式化输出的更多相关文章
- cout 格式化输出
一直习惯于C语言的printf函数来打印,突然有一天要用cout来打印,发现有点不适应. 原来cout也是有格式化输出的. 首先要引入头文件 #include<iostream> // 在 ...
- [转载] c++ cout 格式化输出浮点数、整数及格方法
C语言里可以用printf(),%f来实现浮点数的格式化输出,用cout呢...? 下面的方法是在网上找到的,如果各位有别的办法谢谢留下... iomanip.h是I/O流控制头文件,就像C里面的格式 ...
- Debug格式化输出----基于C语言
Debug格式化输出----基于C语言 1. 使用宏实现 举例: #include <stdio.h> #define ECHO_COLOR_NONE "\033[0;0m&qu ...
- C++格式化输出浮点数
主要内容 介绍C++中如何格式化输出浮点数. 控制浮点数输出格式需要包含iomanip头文件. 使用fixed来控制输出的浮点数的小数位是固定的.可参考http://en.cppreference.c ...
- Python基础之注释,算数运算符,变量,输入和格式化输出
Python的注释 注释的作用:用自己熟悉的语言,对某些代码进行标注说明,增强程序的可读性: 在python解释器解释代码的过程中,凡是#右边的,解释器都直接跳过这一行: 注释的分类 单行注释 # 这 ...
- Java基础 -- 字符串(格式化输出、正则表达式)
一 字符串 1.不可变String String对象是不可变的,查看JDK文档你就会发现,String类中每一个看起来会修改String值的方法,实际上都是创建一个全新的String对象,以包含修改后 ...
- C++ cout格式化输出(转)
C++ cout格式化输出(转) 这篇文章主要讲解如何在C++中使用cout进行高级的格式化输出操作,包括数字的各种计数法(精度)输出,左或右对齐,大小写等等.通过本文,您可以完全脱离scanf/pr ...
- Go语言从入门到放弃(三) 布尔/数字/格式化输出
本章主要介绍Go语言的数据类型 布尔(bool) 布尔指对或者错,也就是说bool只有两个值, True 或 False 两个类型相同的值可以使用比较运算符来得出一个布尔值 当两个值是完全相同的情况下 ...
- c++中利用localtime_s函数格式化输出当地日期与时间
Visual C++ 6.0开发环境中显示当地日期与时间主要通过localtime()函数来实现,该函数的原型在time.h头文件中,其语法格式如下: struct tm *localtime(xon ...
- [ZZ]c++ cout 格式化输出浮点数、整数及格式化方法
C语言里可以用printf(),%f来实现浮点数的格式化输出,用cout呢...?下面的方法是在网上找到的,如果各位有别的办法谢谢留下... iomanip.h是I/O流控制头文件,就像C里面的格式化 ...
随机推荐
- [No000074]C#创建桌面快捷方式
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Remove Duplicates from Sorted List II
Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplica ...
- Python-05-常用模块
sys模块 # sys.argv # 在执行程序的时候可以给程序传参数,例如类似执行nginx检测配置文件语法功能的命令, nginx -t # mode_sys.py import sys prin ...
- c语言函数
听着函数这两个字多多少少都会觉得有点复杂吧.因为一想到函数大多数人都会想到f(x),但其实c语言里面的函数不是那样的,老师教了一个很好的理解方法函数就是个机器人,而这个机器人是你自己做出来的.所有不用 ...
- jquery实现html表格隔行变色
效果图 实现代码: 通过css控制样式,利用jquery的addClass方法实现 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Trans ...
- JQuery中each()的使用方法说明
JQuery中each()的使用方法说明 对于jQuery对象,只是把each方法简单的进行了委托:把jQuery对象作为第一个参数传递给jQuery的each方法.换句话说:jQuery提供的eac ...
- HTML5 移动浏览器支持
- python基础-修改haproxy配置文件
需要掌握的知识: 1.函数 2.文件处理 3.tag的用法 4.程序的解耦 需求: 1:查询 2:添加 3:删除 4:修改 5:退出 haproxy.conf 配置文件内容: global log 1 ...
- Mysql 命令大全
1.连接Mysql 格式: mysql -h主机地址 -u用户名 -p用户密码1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root - ...
- offsetHeight, clientHeight与scrollHeight的区别
在网上搜了一下,结论非常笼统,讲IE从不讲版本,因此自己做了测试并上传结论.以下结论皆是在标准模式下测试通过的,没有测试quirk模式. clientHeight 大部分浏览器对 clientHe ...