亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? http.java

?? 網絡機器人
?? JAVA
字號:
package com.heaton.bot;import java.util.zip.*;import java.net.*;import java.io.*;/** * This class implements an HTTP handler.  The low-level * details are left to a derived class.  Most likely you * will be using the HTTPSocket class, which derives from * this one.  This class handles these specific issues: * * + Cookies * + The referrer tag * + HTTP User Authentication * + Automatic Redirection * + Parsing headers * * Copyright 2001-2003 by Jeff Heaton (http://www.jeffheaton.com) * * @author Jeff Heaton * @version 1.0 */public abstract class HTTP {  /**   * The body data that was downloaded during the last send.   */  protected byte body[];  /**   * The raw header text that was recieved during the last   * send.   */  protected StringBuffer header = new StringBuffer();  /**   * The URL that was ultimately used during the last send.   */  protected String url;  /**   * True if the HTTP class should automatically follow HTTP   * redirects.   */  protected boolean autoRedirect = true;  /**   * The cookies that are being tracked by this HTTP session.   */  protected AttributeList cookieStore = new AttributeList();  /**   * The client headers, these are the headers that are sent   * to the server.   */  protected AttributeList clientHeaders = new AttributeList();  /**   * The server headers, these are the the headers that the   * server sends back.   */  protected AttributeList serverHeaders = new AttributeList();  /**   * True if session cookies should be used.   */  protected boolean useCookies = false;  /**   * True if permanent cookies should be used.   */  protected boolean usePermCookies = false;  /**   * The HTTP response(i.e. OK).  If NOT okay, this response is   * thrown as an exception.   */  protected String response;  /**   * The timeout in milliseconds.   */  protected int timeout = 30000;  /**   * The page previously on.  Used to accurately represent the   * referrer header.   */  protected String referrer = null;  /**   * The agent(or browser) that the HTTP class is reporting   * to the server.   */  protected String agent = "Mozilla/4.0";  /**   * The user being reported for HTTP authentication.   */  protected String user = "";  /**   * The password being reported for user authentication.   */  protected String password = "";  /**   * The max size that a HTTP body can be.   */  protected int maxBodySize = -1;  /**   * The actual page that was requested, URL may have been redirected   * elsewhere.   */  protected String rootURL;  protected int err;  /**   * The copy method is used to create a new copy of this HTTP handler.   * This method is implemented abstract and should be implemented by   * derived classes.   *   * @return A new HTTP handler.   */  abstract HTTP copy();  /**   * This method actually sends the data.  This is where derived   * classes implement their own low-level send.   *   * @param url The URL to send data to.   * @param post Any data that is to be posted.  If no data is posted, this method   * does an HTTP GET.   * @exception java.net.UnknownHostException Thrown if the host can not be located.   * @exception java.io.IOException Thrown if a network error occurs.   */  abstract protected void lowLevelSend(String url,String post)  throws java.net.UnknownHostException, java.io.IOException;  /**   * This method is called to clear any cookies that this HTTP   * object might be holding.   */  public void clearCookies()  {    cookieStore.clear();  }  /**   * This method is called to add any applicable cookies to the   * header.   */  protected void addCookieHeader()  {    int i=0;    String str="";    if ( cookieStore.get(0)==null )      return;    while ( cookieStore.get(i) != null ) {      CookieParse cookie;      if ( str.length()!=0 )        str+="; ";// add on ; if needed      cookie = (CookieParse)cookieStore.get(i);      str+=cookie.toString();      i++;    }    clientHeaders.set("Cookie",str);    Log.log(Log.LOG_LEVEL_TRACE,"Send cookie: " + str );  }  /**   * This method is called to add the user authorization headers   * to the HTTP request.   */  protected void addAuthHeader()  {    if ( (user.length()==0) || (password.length()==0) )      return;    String hdr = user + ":" + password;    String encode = URLUtility.base64Encode(hdr);    clientHeaders.set("Authorization","Basic " + encode );  }  /**   * Send is the public interface to this class that actually sends   * an HTTP request.   *   * @param url The URL being sent to.   * @param post Any data to post.   * @exception java.net.UnknownHostException   * @exception java.io.IOException   */  public void send(String requestedURL,String post)  throws HTTPException,java.net.UnknownHostException,java.io.IOException  {    int rtn; // the return value    if ( post==null )      Log.log(Log.LOG_LEVEL_NORMAL,"HTTP GET " + requestedURL );    else      Log.log(Log.LOG_LEVEL_NORMAL,"HTTP POST " + requestedURL );    rootURL = requestedURL;    setURL(requestedURL);    if ( clientHeaders.get("referrer")==null )      if ( referrer!=null )        clientHeaders.set("referrer",referrer.toString());    if ( clientHeaders.get("Accept")==null )      clientHeaders.set("Accept","image/gif,"                        + "image/x-xbitmap,image/jpeg, "                        + "image/pjpeg, application/vnd.ms-excel,"                        + "application/msword,"                        + "application/vnd.ms-powerpoint, */*");    if ( clientHeaders.get("Accept-Language")==null )      clientHeaders.set("Accept-Language","en-us");    if ( clientHeaders.get("User-Agent")==null )      clientHeaders.set("User-Agent",agent);    while ( true ) {      if ( useCookies )        addCookieHeader();      addAuthHeader();      lowLevelSend(this.url,post);      if ( useCookies )        parseCookies();      Attribute encoding = serverHeaders.get("Content-Encoding");      if ( (encoding!=null) && "gzip".equalsIgnoreCase(encoding.getValue()) )        processGZIP();      Attribute a = serverHeaders.get("Location");      if ( (a==null) || !autoRedirect ) {        referrer = getURL();        return;      }      URL u = new URL(new URL(url),a.getValue());      Log.log(Log.LOG_LEVEL_NORMAL,"HTTP REDIRECT to " + u.toString() );      post=null;// don't redirect as a post      setURL(u.toString());    }  }  /**   * This method is called to get the body data that was returned   * by this request as a string.   *   * @return The body data for the last request.   */  public String getBody()  {    return new String(body);  }  /**   * This method is called to get the body data that was returned   * by this request as an encoded string.   * @param enc How to encode the string.   * @exception UnsupportedEncodingException   * @return The body data for the last request.   */  public String getBody(String enc)  throws UnsupportedEncodingException  {    return new String(body,enc);  }  /**   * This method is called to get the body data that was returned   * by this request as a byte-array. This is more efficent than   * getting the data as a sting, as the data is stored internally   * as a byte-array.   *   * @return The body data for the last request.   */  public byte[] getBodyBytes()  {    return body;  }  /**   * Get the URL that was ultimately requested. You might get a   * different URL than was requested if auto redirection is   * enabled.   */  public String getURL()  {    return url;  }  /**   * Called to set the internal URL that is kept for the last   * request.   *   * @param u The new URL.   */  public void setURL(String u)  {    url = u;  }  /**   * Used to determine if the HTTP class should automatically   * resolve any HTTP redirects.   *   * @param b True to resolve redirects, false otherwise.   */  public void SetAutoRedirect(boolean b)  {    autoRedirect = b;  }  /**   * This method will return an AttributeLIst of client headers.   *   * @return An AttributeList of client headers.   */  public AttributeList getClientHeaders()  {    return clientHeaders;  }  /**   * This method will return an AttributeList of server headers.   *   * @return An AttributeList of server headers.   */  public AttributeList getServerHeaders()  {    return serverHeaders;  }  /**   * This method is called internally to parse any cookies and add   * them to the cookie store.   */  protected void parseCookies()  {    Attribute a;    int i=0;    while ( (a = serverHeaders.get(i++)) != null ) {      if ( a.getName().equalsIgnoreCase("set-cookie") ) {        CookieParse cookie = new CookieParse();        cookie.source=new StringBuffer(a.getValue());        cookie.get();        cookie.setName(cookie.get(0).getName());        if ( cookieStore.get(cookie.get(0).getName())==null ) {          if ( (cookie.get("expires")==null) ||               ( cookie.get("expires")!=null) && usePermCookies )            cookieStore.add(cookie);        }        Log.log(Log.LOG_LEVEL_TRACE,"Got cookie: " + cookie.toString() );      }    }  }  /**   * This method is called uncompress a GZIP encoded document.   */  protected void processGZIP()  throws IOException  {    ByteArrayInputStream bis = new ByteArrayInputStream(body);    GZIPInputStream is = new GZIPInputStream(bis);    StringBuffer newBody = new StringBuffer();    ByteList byteList = new ByteList();    byteList.read(is,-1);          body = byteList.detach();  }  /**   * This method is used to access a specific cookie.   *   * @param name The name of the cookie being sought.   * @return The cookie being sought, or null.   */  public CookieParse getCookie(String name)  {    return((CookieParse)cookieStore.get(name));  }  /**   * This method controls the use of cookies by this HTTP object.   *   * @param session True to use session cookies, false not to.   * @param perm True to use permanent cookies, false not to.   */  public void setUseCookies(boolean session,boolean perm)  {    useCookies = session;    usePermCookies = perm;  }  /**   * This method allows you to determine if session cookies   * are being used.   *   * @return True if session cookies are being used.   */  public boolean getUseCookies()  {    return useCookies;  }  /**   * This method allows you to determine if permanent cookies   * are being used.   *   * @return Returns true if permanent cookies are being used, false otherwise.   */  public boolean getPerminantCookies()  {    return usePermCookies;  }  protected void processResponse(String name)  throws java.io.IOException  {    int i1,i2;    response = name;    i1 = response.indexOf(' ');    if ( i1!=-1 ) {      i2 = response.indexOf(' ',i1+1);      if ( i2!=-1 ) {        try {          err=Integer.parseInt(response.substring(i1+1,i2));        } catch ( Exception e ) {        }      }    }    Log.log(Log.LOG_LEVEL_TRACE,"Response: " + name );  }  /**   * This method is called internally to process user headers.   *   * @exception java.io.IOException Thrown if a network error occurs.   */  protected void parseHeaders()  throws java.io.IOException  {    boolean first;    String name,value;    int l;    first = true;    serverHeaders.clear();    name = "";    String parse = new String(header);    for ( l=0;l<parse.length();l++ ) {      if ( parse.charAt(l)=='\n' ) {        if ( name.length()==0 )          return;        else {          if ( first ) {            first = false;            processResponse(name);          } else {            int ptr=name.indexOf(':');            if ( ptr!=-1 ) {              value = name.substring(ptr+1).trim();              name = name.substring(0,ptr);              Attribute a = new Attribute(name,value);              serverHeaders.add(a);              Log.log(Log.LOG_LEVEL_TRACE,"Sever Header:" + name + "=" + value);            }          }        }        name = "";      } else if ( parse.charAt(l)!='\r' )        name+=parse.charAt(l);    }  }  /**   * This method is called to set the amount of time that the   * HTTP class will wait for the requested resource.   *   * @param i The timeout in milliseconds.   */  public void setTimeout(int i)  {    timeout = i;  }  /**   * This method will return the amount of time in milliseconds   * that the HTTP object will wait for a timeout.   */  public int getTimeout()  {    return timeout;  }  /**   * This method will set the maximum body size   * that will be downloaded.   *   * @param i The maximum body size, or -1 for unlimted.   */  public void setMaxBody(int i)  {    maxBodySize = i;  }  /**   * This method will return the maximum body size   * that will be downloaded.   *   * @return The maximum body size, or -1 for unlimted.   */  public int getMaxBody()  {    return maxBodySize;  }  /**   * Returns the user agent being reported by this HTTP class.   * The user agent allows the web server to determine what   * software the web-browser is using.   *   * @return The agent string being presented to web servers.   */  public String getAgent()  {    return agent;  }  /**   * This method is called to set the agent reported to the browser.   *   * @param a The user agent string to be reported to servers.   */  public void setAgent(String a)  {    agent = a;  }  /**   * This method is called to set the user id for HTTP user   * authentication.   *   * @param u The user id.   */  public void setUser(String u)  {    user = u;  }  /**   * This method is used to set the user's password for HTTP   * user authentificaiton.   *   * @param p The password.   */  public void setPassword(String p)  {    password = p;  }  /**   * This method is used to return the user id that is being   * used for HTTP authentification.   *   * @return The user id.   */  public String getUser()  {    return user;  }  /**   * This method is used to get the password that is being used   * for user authentication.   *   * @return The password.   */  public String getPassword()  {    return password;  }  /**   * This method is used to get the referrer header   *   * @return The referrer header.   */  public String getReferrer()  {    return referrer;  }  /**   * This method is used to set the referrer header   *   * @param p The referrer header.   */  public void setReferrer(String p)  {    referrer = p;  }  /**   * This method will return an AttributeList of cookies.   *   * @return An AttributeList of server headers.   */  public AttributeList getCookies()  {    return cookieStore;  }  /**   * This method will return the first URL that was requested. This   * will be different than the current URL when redirection has occured.   *   * @return The root URL.   */  public String getRootURL()  {    return rootURL;  }    public String getContentType()  {      Attribute a = serverHeaders.get("Content-Type");      if( a==null )          return null;      else          return a.getValue();  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费视频视频在线观看免费| 国产三级精品视频| 日韩欧美国产高清| 国产亚洲一区字幕| 一二三四社区欧美黄| 日本色综合中文字幕| 国产盗摄精品一区二区三区在线| 不卡的电视剧免费网站有什么| 欧美视频在线观看一区二区| 精品美女一区二区三区| 国产精品成人一区二区三区夜夜夜| 亚洲国产精品视频| 韩国成人福利片在线播放| 成人美女视频在线观看18| 欧美日韩国产在线观看| 国产欧美日本一区视频| 亚洲不卡av一区二区三区| 国产乱码精品一区二区三| 欧美午夜寂寞影院| 国产亚洲一本大道中文在线| 亚洲精品第1页| 国产一二精品视频| 欧美午夜电影在线播放| 国产亚洲综合在线| 婷婷夜色潮精品综合在线| 国产乱子伦视频一区二区三区| 在线观看日韩高清av| 2021中文字幕一区亚洲| 一区二区三区电影在线播| 国产成人综合亚洲91猫咪| 欧美视频中文字幕| 亚洲欧洲美洲综合色网| 免费在线观看一区二区三区| 色综合天天性综合| 久久先锋资源网| 亚洲va欧美va人人爽| 91亚洲精品久久久蜜桃| 国产色婷婷亚洲99精品小说| 日本不卡不码高清免费观看| 91麻豆6部合集magnet| 精品国产一区二区三区久久影院| 亚洲国产精品一区二区久久| www.激情成人| 久久久国际精品| 日本欧美久久久久免费播放网| 91在线观看一区二区| 久久久久久久久蜜桃| 免费成人av资源网| 欧美男人的天堂一二区| 亚洲美女在线一区| 成人国产电影网| 精品88久久久久88久久久| 日本不卡一区二区三区高清视频| 欧亚洲嫩模精品一区三区| 亚洲视频 欧洲视频| 成人午夜视频在线观看| 国产色一区二区| 国产米奇在线777精品观看| 日韩精品中文字幕在线一区| 天天做天天摸天天爽国产一区 | 欧美一区二区三区免费在线看| 亚洲视频在线观看三级| 成人晚上爱看视频| 久久久久青草大香线综合精品| 人妖欧美一区二区| 91精品国产综合久久香蕉麻豆| 亚洲一级在线观看| 欧洲人成人精品| 一区二区三区不卡在线观看| 97久久超碰国产精品| 中文字幕一区二区三区四区| 波多野结衣在线aⅴ中文字幕不卡| 久久九九国产精品| 福利一区二区在线| 国产精品视频免费看| 成人av影院在线| 国产精品高清亚洲| 91丝袜国产在线播放| 亚洲三级在线看| 一本大道av一区二区在线播放| 亚洲女与黑人做爰| 色婷婷精品久久二区二区蜜臀av | 久久se精品一区精品二区| 欧美二区三区91| 日韩电影一区二区三区| 日韩欧美一级精品久久| 久久精品久久综合| 久久久久国产精品厨房| 成人网男人的天堂| 怡红院av一区二区三区| 欧美性xxxxxxxx| 日本欧美一区二区在线观看| 日韩精品一区二区三区在线| 国内外精品视频| 国产精品视频yy9299一区| 欧美另类一区二区三区| 亚洲va韩国va欧美va精品 | 日本大胆欧美人术艺术动态| 日韩欧美高清dvd碟片| 国产精品资源在线看| 国产精品乱人伦中文| 日本韩国精品在线| 日一区二区三区| 国产伦精一区二区三区| 国内精品免费**视频| 福利一区二区在线| 亚洲三级电影全部在线观看高清| 在线一区二区三区四区五区| 日本成人在线不卡视频| 久久久久97国产精华液好用吗| 成人免费视频一区| 亚洲国产毛片aaaaa无费看| 日韩欧美国产高清| 成a人片国产精品| 性做久久久久久免费观看| 精品国产sm最大网站免费看| 成人高清视频在线观看| 天天影视网天天综合色在线播放 | 久久精品免费观看| 国产精品福利一区| 制服丝袜日韩国产| 成人免费高清在线| 日韩国产在线一| 欧美国产禁国产网站cc| 欧美日韩免费在线视频| 国产在线播放一区二区三区| 亚洲色图丝袜美腿| 精品国产乱码久久久久久浪潮| 99久免费精品视频在线观看| 日韩制服丝袜av| 国产精品第一页第二页第三页| 91精品国产乱码久久蜜臀| 成人激情免费电影网址| 石原莉奈一区二区三区在线观看 | 不卡区在线中文字幕| 男女激情视频一区| 亚洲欧美激情插| 欧美精品一区二区三区一线天视频| 91麻豆.com| 国产高清亚洲一区| 日韩电影免费一区| 亚洲女爱视频在线| 久久亚洲私人国产精品va媚药| 欧美午夜精品电影| av一区二区三区四区| 狠狠色丁香婷婷综合| 亚洲va欧美va人人爽| 亚洲欧洲精品天堂一级| 欧美精品一区二区不卡| 777奇米成人网| 色综合欧美在线| 国产成人av电影在线播放| 日韩电影免费一区| 亚洲午夜在线观看视频在线| 国产精品美女久久久久aⅴ国产馆| 制服丝袜国产精品| 欧美色综合久久| av网站一区二区三区| 国产精品一区二区免费不卡| 午夜精品久久一牛影视| 亚洲欧美日韩国产综合在线| 欧美激情一区二区三区不卡| 日韩精品专区在线影院重磅| 欧美人妇做爰xxxⅹ性高电影 | 亚洲综合小说图片| 国产精品第五页| 久久久久久久久免费| 欧美成人精精品一区二区频| 欧美高清视频在线高清观看mv色露露十八| 99视频精品免费视频| 成人av资源在线| 国产成人亚洲综合a∨婷婷图片 | 91精品国产免费| 欧美日韩一区二区三区免费看 | 亚洲免费色视频| 国产精品福利在线播放| 欧美激情一区二区三区全黄| 久久久蜜桃精品| 26uuu国产在线精品一区二区| 欧美一级二级三级蜜桃| 日韩一区二区免费视频| 日韩一级大片在线观看| 欧美一区二区二区| 91精品国产麻豆国产自产在线| 欧美绝品在线观看成人午夜影视| 欧美三区免费完整视频在线观看| 在线观看免费亚洲| 欧洲在线/亚洲| 欧美性猛交一区二区三区精品| 日本道色综合久久| 91黄色小视频| 欧美视频在线播放| 欧美高清精品3d| 555夜色666亚洲国产免| 欧美一区二区三区免费在线看 | 处破女av一区二区| 国产99久久久久久免费看农村| 高清shemale亚洲人妖| 99在线精品视频| 在线观看亚洲a|