Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 25. október 2026

Rozdiely pre dead/mail2sms/http.c medzi verziami 1.12 a 1.13

verzia 1.12, 2001/11/12 20:19:10 verzia 1.13, 2001/11/14 16:00:07
Riadok 1 
Riadok 1 
 /*  /*
  * Author: Lubomir Host 'rajo' <host8@kepler.fmph.uniba.sk>   * Author: Lubomir Host 'rajo' <host8@kepler.fmph.uniba.sk>
  * $Log$   * $Log$
    * Revision 1.13  2001/11/14 16:00:07  host8
    * Changed some debug messages.
    * Improvements in cookies (still not works fine).
    *
  * Revision 1.12  2001/11/12 20:19:10  host8   * Revision 1.12  2001/11/12 20:19:10  host8
  * http_connect() probably works fine.   * http_connect() probably works fine.
  * Some problems with http_requests for www.mtnsms.com.   * Some problems with http_requests for www.mtnsms.com.
Riadok 188  Cookie: mtnsms%2Ep%2E2=color=0&cn=rajo%4
Riadok 192  Cookie: mtnsms%2Ep%2E2=color=0&cn=rajo%4
                 char *tmp;                  char *tmp;
   
 #ifdef DEBUG  #ifdef DEBUG
                 if (debug > 7)                  if (debug > 4)
                         fprintf(stderr, "parsed_cookie[%d] = '%s'\n", i, array[i]);                          fprintf(stderr, "COOKIES: parsed_cookie[%d] = '%s'\n", i,
                                                                           array[i]);
 #endif  #endif
   
                 tmp = array[i];                  tmp = array[i];
Riadok 204  Cookie: mtnsms%2Ep%2E2=color=0&cn=rajo%4
Riadok 209  Cookie: mtnsms%2Ep%2E2=color=0&cn=rajo%4
                 }                  }
                 else {                  else {
 #ifdef DEBUG  #ifdef DEBUG
                         if (debug >7)                          if (debug > 4)
                                 fprintf(stderr, "cookies->text-old = '%s'", c->text);                                  fprintf(stderr, "COOKIES: cookies->text-old = '%s'",
                                                                                   c->text);
 #endif  #endif
                         if (c->text == NULL)                          if (c->text == NULL)
                                 c->text = strdup(tmp);                                  c->text = strdup(tmp);
Riadok 216  Cookie: mtnsms%2Ep%2E2=color=0&cn=rajo%4
Riadok 222  Cookie: mtnsms%2Ep%2E2=color=0&cn=rajo%4
                                 c->text = strdyn_implode_str(ar, "");                                  c->text = strdyn_implode_str(ar, "");
                         }                          }
 #ifdef DEBUG  #ifdef DEBUG
                         if (debug >7)                          if (debug > 4)
                                 fprintf(stderr, " new = '%s'\n", c->text);                                  fprintf(stderr, "COOKIES: new = '%s'\n", c->text);
 #endif  #endif
                 }                  }
         }          }
   #ifdef DEBUG
           if (debug > 4)
                   fprintf(stderr, "COOKIES: returning cookie, "
                                                                   "c->domain = '%s' c->text ='%s'\n",
                                                                   c->domain, c->text);
   #endif
   
         return (c);          return (c);
 } // }}}  } // }}}
Riadok 231  static char *get_cookie(HTTP_REQUEST *r)
Riadok 243  static char *get_cookie(HTTP_REQUEST *r)
         int count;          int count;
         char *str = NULL;          char *str = NULL;
   
           if (r == NULL || r->host == NULL)
                   return (NULL);
   
         count = get_size_cookies(cookies);          count = get_size_cookies(cookies);
 #ifdef DEBUG  #ifdef DEBUG
         fprintf(stderr, "count = %d in get_cookie()\n", count);          fprintf(stderr, "COOKIES: count = %d in get_cookie()\n", count);
           if (debug > 4)
                   fprintf(stderr, "COOKIES: Comparing '%s' with: \n", r->host);
 #endif  #endif
         for (i=(count-1); i >= 0; i--) {          for (i=(count-1); i >= 0; i--) {
   #ifdef DEBUG
                   if (debug > 4)
                           fprintf(stderr, "COOKIES: %02d '%s'\n", i, cookies[i]->domain);
   #endif
                 if (cookies[i] != NULL &&                  if (cookies[i] != NULL &&
                                                                 cookies[i]->domain != NULL &&                                                                  cookies[i]->domain != NULL &&
                                                                 strstr(r->host, cookies[i]->domain)                                                                  strstr(r->host, cookies[i]->domain)
Riadok 244  static char *get_cookie(HTTP_REQUEST *r)
Riadok 265  static char *get_cookie(HTTP_REQUEST *r)
                         break;                          break;
                 }                  }
         }          }
   #ifdef DEBUG
           if (debug > 4)
                   fprintf(stderr, "COOKIES: END of comparising, returning '%s'\n", str);
   #endif
   
         return (str);          return (str);
 }  }
Riadok 262  static int get_size_cookies(COOKIE **coo
Riadok 287  static int get_size_cookies(COOKIE **coo
 static void http_set_cookie(char *str)  static void http_set_cookie(char *str)
 {  {
         if (str != NULL) {          if (str != NULL) {
                 if (str == strstr("Set-Cookie: ", str)) {                  if (str == strstr(str, "Set-Cookie: ")) {
   #ifdef DEBUG
                           if (debug > 4)
                                   fprintf(stderr, "COOKIES: adding cookie '%s'\n", str);
   #endif
                         cookies = add_to_cookies(cookies, parse_cookie(str + 12));                          cookies = add_to_cookies(cookies, parse_cookie(str + 12));
                 }                  }
         }          }
Riadok 618  static void http_read_source(HTTP_REQUES
Riadok 647  static void http_read_source(HTTP_REQUES
 #else  #else
         int info = 1;          int info = 1;
 #endif  #endif
           int bad_request = 0;
         HTTP_REQUEST *new_r = NULL;          HTTP_REQUEST *new_r = NULL;
   
         while (1) {          while (1) {
Riadok 625  static void http_read_source(HTTP_REQUES
Riadok 655  static void http_read_source(HTTP_REQUES
   
                 if (fgets(buf, 1023, r->frw) == NULL)                  if (fgets(buf, 1023, r->frw) == NULL)
                         break;                          break;
                   strrmcr(buf);
   
                 if (r->ret_val == NULL)                  if (r->ret_val == NULL)
                         r->ret_val = strdup(buf);                          r->ret_val = strdup(buf);
                 if (search_for_link == 1) {  /* Handling " 302 Object Moved" */                  if (buf == strstr(buf, "Set-Cookie: "))
                           http_set_cookie(buf);
                   if (search_for_link == 1) {  /* Handling " 302 Object Moved" {{{ */
                         if (buf == strstr(buf, "Location: ")) {                          if (buf == strstr(buf, "Location: ")) {
                                 char *str;                                  char *str;
   
Riadok 662  static void http_read_source(HTTP_REQUES
Riadok 696  static void http_read_source(HTTP_REQUES
                                 free(str);                                  free(str);
                                 search_for_link = 0;                                  search_for_link = 0;
                         }                          }
                 }                  } /* }}} End of Handling '302 Object Moved' */
                 if (info) {                  if (info) {
                         fprintf(stderr, "\t%.*s\n", (int)(strlen(buf)-2), buf);                          fprintf(stderr, "\t%.*s\n", (int)(strlen(buf)-2), buf);
                         info=0;                          info=0;
Riadok 677  static void http_read_source(HTTP_REQUES
Riadok 711  static void http_read_source(HTTP_REQUES
                                         search_for_link = 1 ;                                          search_for_link = 1 ;
                                 }                                  }
                                 if ((buf+8) == strstr(buf, " 400 Bad Request")) {                                  if ((buf+8) == strstr(buf, " 400 Bad Request")) {
                                         exit(1);                                          bad_request = 1;
                                 }                                  }
                                 if ((buf+8) == strstr(buf, " 404 Object Not Found")) {                                  if ((buf+8) == strstr(buf, " 404 Object Not Found")) {
                                         exit(1);                                          bad_request = 1;
                                 }                                  }
                         }                          }
                 }                  }
 #ifdef DEBUG  #ifdef DEBUG
                 if (debug > 8 ) {                  if (debug > 10) {
                           fprintf(stderr, "HTTP_SOURCE: '%s'\n", buf);
                   }
                   else if (debug > 8 ) {
                         fputs(buf, stderr);                          fputs(buf, stderr);
                 }                  }
 #endif  #endif
                 if (buf == strstr(buf, "Set-Cookie: "))  
                         http_set_cookie(buf);  
         }          }
 #ifdef DEBUG  #ifdef DEBUG
         if (search_for_link == 1) {          if (search_for_link == 1) {
Riadok 698  static void http_read_source(HTTP_REQUES
Riadok 733  static void http_read_source(HTTP_REQUES
         }          }
 #endif  #endif
         fclose (r->frw);          fclose (r->frw);
           if (bad_request)
                   exit(1);
         if (new_r != NULL)          if (new_r != NULL)
                 http_request_by_request(new_r);                  http_request_by_request(new_r);
   
Riadok 768  int http_request(int method, char *file,
Riadok 805  int http_request(int method, char *file,
                 fprintf(r->frw, "Referer: %s\r\n", get_http_referer(requests));                  fprintf(r->frw, "Referer: %s\r\n", get_http_referer(requests));
         if (get_cookie(r) != NULL) {          if (get_cookie(r) != NULL) {
 #ifdef DEBUG  #ifdef DEBUG
                 if (debug)                  if (debug > 4)
                         fprintf(stderr, "Cookie2: $Version=\"1\"\r\nCookie: %s\r\n",                          fprintf(stderr, "HTTP: sending cookies:\r\n"
                                                                           "Cookie2: $Version=\"1\"\r\n"
                                                                           "Cookie: %s;\r\n",
                                                                         get_cookie(r));                                                                          get_cookie(r));
 #endif  #endif
                 fprintf(r->frw, "Cookie2: $Version=\"1\"\r\nCookie: %s\r\n",                  fprintf(r->frw, "Cookie2: $Version=\"1\"\r\nCookie: %s;\r\n",
                                                                 get_cookie(r));                                                                  get_cookie(r));
         }          }
         if (fmt != NULL) {          if (fmt != NULL) {

Legend:
Odstranené z verzie1.12  
zmenené riadky
  Pridané vo verzii1.13

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok