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

Rozdiely pre dead/mail2sms/http.c medzi verziami 1.9 a 1.10

verzia 1.9, 2001/10/30 17:24:01 verzia 1.10, 2001/10/30 18:18:12
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.10  2001/10/30 18:18:12  jombik9
    * Improvements.
    *
  * Revision 1.9  2001/10/30 17:24:01  host8   * Revision 1.9  2001/10/30 17:24:01  host8
  * New implementation of http request.   * New implementation of http request.
  *   *
Riadok 42  static void free_requests(HTTP_REQUEST *
Riadok 45  static void free_requests(HTTP_REQUEST *
 static int get_size_requests(HTTP_REQUEST **req);  static int get_size_requests(HTTP_REQUEST **req);
 static HTTP_REQUEST **create_requests(void);  static HTTP_REQUEST **create_requests(void);
 static HTTP_REQUEST *new_request(void);  static HTTP_REQUEST *new_request(void);
 static HTTP_REQUEST *duplicate_request(HTTP_REQUEST *r);  static HTTP_REQUEST *duplicate_request(const HTTP_REQUEST *r);
 static HTTP_REQUEST **add_to_requests(HTTP_REQUEST **req, const HTTP_REQUEST *r);  static HTTP_REQUEST **add_to_requests(HTTP_REQUEST **req, const HTTP_REQUEST *r);
 static char *get_http_referer(HTTP_REQUEST **req);  static char *get_http_referer(HTTP_REQUEST **req);
 static char *get_cookie(HTTP_REQUEST *r);  static char *get_cookie(HTTP_REQUEST *r);
Riadok 148  static void http_read_source(HTTP_REQUES
Riadok 151  static void http_read_source(HTTP_REQUES
         HTTP_REQUEST *new_r = NULL;          HTTP_REQUEST *new_r = NULL;
   
         while (1) {          while (1) {
                 char bla[1024];                  char buf[1024];
   
                 if (fgets(bla, sizeof(bla), r->frw) == NULL)                  if (fgets(buf, 1023, r->frw) == NULL)
                         break;                          break;
                 if (r->ret_val == NULL)                  if (r->ret_val == NULL)
                         r->ret_val = strdup(bla);                          r->ret_val = strdup(buf);
                 if (search_for_link == 1) {  /* Handling " 302 Object Moved" */                  if (search_for_link == 1) {  /* Handling " 302 Object Moved" */
                         if (bla == strstr(bla, "Location: ")) {                          if (buf == strstr(buf, "Location: ")) {
                                 char *str;                                  char *str;
   
                                 if ((str = strdup(bla)) == NULL) {                                  if ((str = strdup(buf)) == NULL) {
                                         fprintf(stderr, "strdup(%s) failed!\n", bla);                                          fprintf(stderr, "strdup(%s) failed!\n", buf);
                                         exit(1);                                          exit(1);
                                 }                                  }
                                 while (strlen(str) > 0 && isspace(str[strlen(str) - 1]))                                  while (strlen(str) > 0 && isspace(str[strlen(str) - 1]))
Riadok 172  static void http_read_source(HTTP_REQUES
Riadok 175  static void http_read_source(HTTP_REQUES
                                                 malloc ((new_r->file - str - 16)*sizeof(char));                                                  malloc ((new_r->file - str - 16)*sizeof(char));
                                         strncpy(new_r->host, (str + 17),                                          strncpy(new_r->host, (str + 17),
                                                                                         (new_r->file - str - 17));                                                                                          (new_r->file - str - 17));
                                           new_r->host[new_r->file - str - 17] = '\0';
   #ifdef DEBUG
                                           fprintf(stderr, "FILENAME = '%s', HOST = '%s'\n",
                                                                                           new_r->file,
                                                                                           new_r->host);
   #endif
                                 }                                  }
 #ifdef DEBUG  #ifdef DEBUG
                                 else {                                  else {
                                         fprintf(stderr, "Invalid link '%s'!\n", str);                                          fprintf(stderr, "Invalid link '%s'!\n", str);
                                 }                                  }
   
                                 fprintf(stderr, "Object Moved  = '%s'\n", str);                                  fprintf(stderr, "Object Moved  = '%s'\n", str);
 #endif  #endif
                                 free(str);                                  free(str);
Riadok 184  static void http_read_source(HTTP_REQUES
Riadok 194  static void http_read_source(HTTP_REQUES
                         }                          }
                 }                  }
                 if (info) {                  if (info) {
                         fprintf(stderr, "\t%.*s\n", (int)(strlen(bla)-2), bla);                          fprintf(stderr, "\t%.*s\n", (int)(strlen(buf)-2), buf);
                         info=0;                          info=0;
                         if (strstr(bla, "HTTP/1.") != NULL) {                          if (strstr(buf, "HTTP/1.") != NULL) {
                                 if ((bla+8) == strstr(bla, " 200 OK")) {                                  if ((buf+8) == strstr(buf, " 200 OK")) {
                                         //http_set_referer(host, file);                                          //http_set_referer(host, file);
                                 }                                  }
                                 if ((bla+8) == strstr(bla, " 302 Object moved")) {                                  if ((buf+8) == strstr(buf, " 302 Object moved")) {
 #ifdef DEBUG  #ifdef DEBUG
                                         fprintf(stderr, "Searching for 'Location: '...\n");                                          fprintf(stderr, "Searching for 'Location: '...\n");
 #endif  #endif
                                         search_for_link = 1 ;                                          search_for_link = 1 ;
                                 }                                  }
                                 if ((bla+8) == strstr(bla, " 404 Object Not Found")) {                                  if ((buf+8) == strstr(buf, " 404 Object Not Found")) {
                                         exit(1);                                          exit(1);
                                 }                                  }
                         }                          }
                 }                  }
 #ifdef DEBUG  #ifdef DEBUG
                 if (debug > 8 ) {                  if (debug > 8 ) {
                         fputs(bla, stderr);                          fputs(buf, stderr);
                 }                  }
 #endif  #endif
                 if (bla == strstr(bla, "Set-Cookie: "))                  if (buf == strstr(buf, "Set-Cookie: "))
                         http_set_cookie(r, bla);                          http_set_cookie(r, buf);
         }          }
 #ifdef DEBUG  #ifdef DEBUG
         if (search_for_link == 1) {          if (search_for_link == 1) {
Riadok 377  static HTTP_REQUEST *new_request(void)
Riadok 387  static HTTP_REQUEST *new_request(void)
         return (new);          return (new);
 } // }}}  } // }}}
 // static HTTP_REQUEST *duplicate_request(HTTP_REQUEST *r) {{{  // static HTTP_REQUEST *duplicate_request(HTTP_REQUEST *r) {{{
 static HTTP_REQUEST *duplicate_request(HTTP_REQUEST *r)  static HTTP_REQUEST *duplicate_request(const HTTP_REQUEST *r)
 {  {
         HTTP_REQUEST *new;          HTTP_REQUEST *new;
   

Legend:
Odstranené z verzie1.9  
zmenené riadky
  Pridané vo verzii1.10

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