Advertisement
AbraaoAllysson

tratamento

Jun 17th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. bool comparacaoChar(char *trying, int pi, int n, string ideal, int s)
  2. {
  3. if(s!=n) return 0;
  4. while((i<pi+n))
  5. if(trying[i]!=ideal[i-pi]) return 0;
  6. return 1;
  7. }
  8.  
  9.  
  10. bool badRequis(char *r)
  11. {
  12. int i = 0;
  13.  
  14. if(!cmpChar(r, i, 3, "GET", 3)) return 1; while(r[i]!='\n') ++i;
  15. if(!cmpChar(r, ++i, 4, "Host", 4)) return 1; while(r[i]!='\n') ++i;
  16. if(!cmpChar(r, ++i, 10, "User-Agent", 10)) return 1; while(r[i]!='\n') ++i;
  17. if(!cmpChar(r, ++i, 6, "Accept", 6)) return 1; while(r[i]!='\n') ++i;
  18. if(!cmpChar(r, ++i, 15, "Accept-Language", 15)) return 1; while(r[i]!='\n') ++i;
  19. if(!cmpChar(r, ++i, 15, "Accept-Encoding", 15)) return 1; while(r[i]!='\n') ++i;
  20. if(!cmpChar(r, ++i, 10, "Connection", 10)) return 1; while(r[i]!='\n') ++i;
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement