Diff for /parser3/src/main/pa_common.C between versions 1.152 and 1.153

version 1.152, 2003/06/20 09:56:01 version 1.153, 2003/07/21 07:07:16
Line 255  static int http_request(String& response Line 255  static int http_request(String& response
 #endif  #endif
 }  }
   
   #undef CRLF
   #define CRLF "\r\n"
   
 #ifndef DOXYGEN  #ifndef DOXYGEN
 struct Http_pass_header_info {  struct Http_pass_header_info {
         String* request;          String* request;
Line 268  static void http_pass_header(const Hash: Line 271  static void http_pass_header(const Hash:
           
     *(i.request)<<key<<": "      *(i.request)<<key<<": "
                 << attributed_meaning_to_string(*static_cast<Value *>(value), String::UL_HTTP_HEADER, false)                  << attributed_meaning_to_string(*static_cast<Value *>(value), String::UL_HTTP_HEADER, false)
                 <<"\n";                   << CRLF; 
                   
         if(key.change_case(pool, String::CC_UPPER)=="USER-AGENT")          if(key.change_case(pool, String::CC_UPPER)=="USER-AGENT")
                 i.user_agent_specified=true;                  i.user_agent_specified=true;
Line 329  static void file_read_http(Pool& pool, c Line 332  static void file_read_http(Pool& pool, c
   
         //making request          //making request
         String request(pool);          String request(pool);
         request<< method <<" "<< uri <<" HTTP/1.0\nHost: "<< host<<"\n";           request<< method <<" "<< uri <<" HTTP/1.0" CRLF "Host: "<< host<< CRLF; 
         bool user_agent_specified=false;          bool user_agent_specified=false;
         if(vheaders && !vheaders->is_string()) { // allow empty          if(vheaders && !vheaders->is_string()) { // allow empty
                 if(Hash *headers=vheaders->get_hash(&connect_string)) {                  if(Hash *headers=vheaders->get_hash(&connect_string)) {
Line 342  static void file_read_http(Pool& pool, c Line 345  static void file_read_http(Pool& pool, c
                                 "headers param must be hash");                                   "headers param must be hash"); 
         };          };
         if(!user_agent_specified) // defaulting          if(!user_agent_specified) // defaulting
                 request << "user-agent: " DEFAULT_USER_AGENT "\n";                  request << "user-agent: " DEFAULT_USER_AGENT CRLF;
         request<<"\n";           request<<CRLF; 
                   
         //sending request          //sending request
         String response(pool);           String response(pool); 
Line 352  static void file_read_http(Pool& pool, c Line 355  static void file_read_http(Pool& pool, c
                 timeout, fail_on_status_ne_200);                   timeout, fail_on_status_ne_200); 
                   
         //processing results              //processing results    
         int pos=response.pos("\r\n\r\n", 4);           int pos=response.pos(CRLF CRLF, 4); 
         if(pos<1){          if(pos<1){
                 throw Exception("http.response",                   throw Exception("http.response", 
                         &connect_string,                          &connect_string,
Line 368  static void file_read_http(Pool& pool, c Line 371  static void file_read_http(Pool& pool, c
         Hash& tables=vtables->hash(0);          Hash& tables=vtables->hash(0);
   
         size_t pos_after_ref=0;          size_t pos_after_ref=0;
         header_block.split(aheaders, &pos_after_ref, "\r\n", 2);           header_block.split(aheaders, &pos_after_ref, CRLF, 2); 
                   
         //processing headers          //processing headers
         for(int i=1;i<aheaders.size();i++) {          for(int i=1;i<aheaders.size();i++) {

Removed from v.1.152  
changed lines
  Added in v.1.153


E-mail: