Package org.parosproxy.paros.network

Examples of org.parosproxy.paros.network.HttpResponseHeader


            if (!HttpStatusCode.isSuccess(msg.getResponseHeader().getStatusCode())) {
                return;
            }

            if (msg.getResponseHeader().getContentLength() > 200000) {
                msg.setResponseHeader(new HttpResponseHeader());
                msg.getResponseBody().setBody("");
            }

            parent.readURI(msg);

            if (isNeglectResponse(msg.getResponseHeader())) {
                return;
            }
           
            html = new Html(msg.getRequestHeader().getURI(), msg.getResponseBody().toString());
            collector.collect(html, depth);

            // no more response processing needed.  remove from msg to save memory
           
        } catch (Exception e) {
           
            e.printStackTrace();
        } finally {
            msg.setResponseHeader(new HttpResponseHeader());
            msg.getResponseBody().setBody("");
            parent.addVisitedLink(msg);
        }
       
    }
View Full Code Here


    /* (non-Javadoc)
     * @see org.parosproxy.paros.extension.filter.FilterAdaptor#onHttpResponseReceive(org.parosproxy.paros.network.HttpMessage)
     */
    public void onHttpResponseReceive(HttpMessage msg) {
        HttpResponseHeader resHeader = msg.getResponseHeader();
        if (resHeader == null || resHeader.isEmpty()) {
            return;
        }
       
        if (resHeader.getHeader("Set-cookie") != null) {
            String content = resHeader.toString();
            matcher = pattern.matcher(content);
            result = new Vector();
            while (matcher.find()){
                String cookie = matcher.group(1);
                if (cookie != null){
                   
                    // Modal dialog with OK/cancel and a text field
                    getView().getMainFrame().toFront();
                    String text = JOptionPane.showInputDialog(getView().getMainFrame(), "Accept the following cookie (Ok=Accept, Cancel=Reject)?", cookie);
                   
                    // text == null means cancel pressed.  If cancel, cookie rejected
                    if ((text != null && !text.equals(""))){           
                        resHeader.setHeader("Set-cookie", null);         
                        result.add(text);
                    } else if (text==null) {
                        resHeader.setHeader("Set-cookie", null);
                    }
                }
            }
           
            if (result.size() >0){
                content = matcher.replaceAll("");
               
                for (int i = 0;i< result.size(); i++){
                    content += "Set-Cookie: " + result.get(i).toString() + "\r\n";
                }
                try{
                    //  resHeader = new HttpResponseHeader(content);
                    resHeader.setMessage(content);
                }
                catch (Exception e){
                    System.out.println(e.getMessage());
                }
            }
View Full Code Here

          .getStatusCode())) {
        return;
      }

      if (msg.getResponseHeader().getContentLength() > 200000) {
        msg.setResponseHeader(new HttpResponseHeader());
        msg.getResponseBody().setBody("");
      }

      parent.readURI(msg);

      if (isNeglectResponse(msg.getResponseHeader())) {
        return;
      }

      html = new Html(msg.getRequestHeader().getURI(), msg
          .getResponseBody().toString());
      collector.collect(html, depth);

      // no more response processing needed. remove from msg to save
      // memory

    } catch (Exception e) {

      e.printStackTrace();
    } finally {
      msg.setResponseHeader(new HttpResponseHeader());
      msg.getResponseBody().setBody("");
      parent.addVisitedLink(msg);
    }

  }
View Full Code Here

   * @see
   * org.parosproxy.paros.extension.filter.FilterAdaptor#onHttpResponseReceive
   * (org.parosproxy.paros.network.HttpMessage)
   */
  public void onHttpResponseReceive(HttpMessage msg) {
    HttpResponseHeader resHeader = msg.getResponseHeader();
    if (resHeader == null || resHeader.isEmpty()) {
      return;
    }

    if (resHeader.getHeader("Set-cookie") != null) {
      String content = resHeader.toString();
      matcher = pattern.matcher(content);
      result = new Vector<String>();
      while (matcher.find()) {
        String cookie = matcher.group(1);
        if (cookie != null) {

          // Modal dialog with OK/cancel and a text field
          getView().getMainFrame().toFront();
          String text = JOptionPane
              .showInputDialog(
                  getView().getMainFrame(),
                  "Accept the following cookie (Ok=Accept, Cancel=Reject)?",
                  cookie);

          // text == null means cancel pressed. If cancel, cookie
          // rejected
          if ((text != null && !text.equals(""))) {
            resHeader.setHeader("Set-cookie", null);
            result.add(text);
          } else if (text == null) {
            resHeader.setHeader("Set-cookie", null);
          }
        }
      }

      if (result.size() > 0) {
        content = matcher.replaceAll("");

        for (int i = 0; i < result.size(); i++) {
          content += "Set-Cookie: " + result.get(i).toString()
              + "\r\n";
        }
        try {
          // resHeader = new HttpResponseHeader(content);
          resHeader.setMessage(content);
        } catch (Exception e) {
          System.out.println(e.getMessage());
        }
      }

View Full Code Here

TOP

Related Classes of org.parosproxy.paros.network.HttpResponseHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.