Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14
  1. #1

    [C] Eliminare gli Header della risposta del server

    Come posso fare per eliminare gli header che mi arrivano alla risposta dal server ???
    recv(*sock, receve, 1024, 0);


    codice:
    HTTP/1.1 200 OK
    Date: Sun, 27 Jun 2004 15:18:39 GMT
    Server: Apache/2.0.49 (Gentoo/Linux) mod_python/3.1.3 Python/2.3.3 mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6
    Content-Location: index.html.en
    Vary: negotiate,accept-language,accept-charset
    TCN: choice
    Last-Modified: Wed, 16 Jun 2004 18:29:31 GMT
    ETag: "54544-5b0-80cf38c0"
    Accept-Ranges: bytes
    Content-Length: 1456
    Content-Type: text/html; charset=ISO-8859-1
    Content-Language: en
    PoWered by:
    Gentoo 1.5.3 - Kernel 2.6.7
    Debian Sid - Kernel 2.6.7 - Bash 3.0
    Slackware current - Kernel 2.6.7

  2. #2

    Nessuno ???
    PoWered by:
    Gentoo 1.5.3 - Kernel 2.6.7
    Debian Sid - Kernel 2.6.7 - Bash 3.0
    Slackware current - Kernel 2.6.7

  3. #3
    ma in teoria tra risposta e header non c'è uno spazio?
    Cioe in pratica, ti serve qualcosa che usi per cancellare da inizio header fino a li.
    Altra soluzione......li tieni lo stesso ma non li mostri.
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  4. #4
    Io Per quello ho risolto cercando il primo spazio...
    Ma se scarico pagine php mi trovo all'inizio alla fine dei numeri (per adesso mi e' capitato solo con pagine php)

    codice:
    HTTP/1.1 200 OK
    Date: Thu, 08 Jul 2004 17:28:42 GMT
    Server: Apache/2.0.49 (Debian/Linux)
    X-Powered-By: PHP/4.3.7
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=ISO-8859-1
    
    1001
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html><head>
    ...
    0
    Quindi adesso La mia pagina scaricata inizia e finisce con due numeri e sono quasi sempre diversi...
    Come posso fare ???
    #include <stdio.h>
    int main() { char m[18+1] = "_TeYS_We2^[TWda [f";
    int i = (((3*7))-21); for (; m[i]; i++)
    (i<27) ? m[i]+=(((13)*3)-25) : m[i] -= (7+(i)*(-1));
    puts(m); getchar(); return 0; };

  5. #5
    se apri la pagina con un editor esadecimale noterai che c'è subito prima dei numeri una sequenze di questo tipo:
    0D 0A 0D 0A
    ecco quella dovrebbe essere la fine dell'header

  6. #6
    Il '\n' va bene...
    Basta cercare quello...

    ma i numeri ???
    #include <stdio.h>
    int main() { char m[18+1] = "_TeYS_We2^[TWda [f";
    int i = (((3*7))-21); for (; m[i]; i++)
    (i<27) ? m[i]+=(((13)*3)-25) : m[i] -= (7+(i)*(-1));
    puts(m); getchar(); return 0; };

  7. #7
    occhi che forse non è solo uno \n ma mesà \n\r oppure il contrario...nn ricordo, i numeri ce li scrive qualcuno (o qualcosa), non credo facciano parte dell'header

  8. #8
    Si i caratteri da cercare sono \r\n ma se trovi il \r o \n come primo/secondo carattere di riga sai che quella e' la fine dell'header...

    Per i numeri a me' succede solo con le pagine php e mi sono accorto che non sono solo all'inizio e alla fine ma anche in alcune parti della pagina...
    (Quei numeri non fanno parte nel del codice php ne' dell'output che risulta)
    Ma non so' proprio come eliminarli... non ho ne riferimenti ne altro per trovarli...
    #include <stdio.h>
    int main() { char m[18+1] = "_TeYS_We2^[TWda [f";
    int i = (((3*7))-21); for (; m[i]; i++)
    (i<27) ? m[i]+=(((13)*3)-25) : m[i] -= (7+(i)*(-1));
    puts(m); getchar(); return 0; };

  9. #9
    Utente di HTML.it L'avatar di /dev/null
    Registrato dal
    May 2004
    Messaggi
    1,936
    Originariamente inviato da nightfall
    Si i caratteri da cercare sono \r\n ma se trovi il \r o \n come primo/secondo carattere di riga sai che quella e' la fine dell'header...

    Per i numeri a me' succede solo con le pagine php e mi sono accorto che non sono solo all'inizio e alla fine ma anche in alcune parti della pagina...
    (Quei numeri non fanno parte nel del codice php ne' dell'output che risulta)
    Ma non so' proprio come eliminarli... non ho ne riferimenti ne altro per trovarli...
    Tutte le pagine php sputano quei numeri? (di tutti i siit? Anche di questo forum?)
    E gli altri browser riescono a levarli dal sorgente della pagina?
    Se hai risposto sì a tutte le domande potresti cercare di capire in che punti vengono messi e in quei punti saltarli...
    Se ad esempio sai che c'è all'inizio e alla fine e ogni 500 caratteri puoi fare:

    codice:
    // buf è un char * buf che contiene l'output privo di headerinviato dal server
    for ( i = 0; i < strlen(buf); i++ ) {
       if ( i == 0 || ! (i % 500) || i == ultimo_carattere ) {
          int jmp = saltanumeri ( &buf[i] );
          i += jmp;
       }
       // ...
    }
    
    int saltanumeri ( char * buf ) {
       int i;
       while ( is_number ( *buf ) ) {
          buf++;
          i++;
       }
       return i;
    }
    
    void is_number ( char c ) {
       if ( c < '0' || c > '9' )
          return 0;
       return 1;
    }
    Non l'ho provato: probabilmente contiene gravi errori, comunque mi sembra che come algoritmo possa funzionare
    Ultima modifica ad opera dell'utente /dev/null il 01-01-0001 alle 00:00

  10. #10
    Anchio ho lo stesso problema con le pagine php...
    Ma non ho trovato nessun modo per toglierli...
    Questa e' una pagina php scaricata (Ho tolto gli header)
    codice:
    1001
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html><head>
    <style type="text/css"><!--
    body {background-color: #ffffff; color: #000000;}
    body, td, th, h1, h2 {font-family: sans-serif;}
    pre {margin: 0px; font-family: monospace;}
    a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
    a:hover {text-decoration: underline;}
    table {border-collapse: collapse;}
    .center {text-align: center;}
    .center table { margin-left: auto; margin-right: auto; text-align: left;}
    .center th { text-align: center !important; }
    td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}
    h1 {font-size: 150%;}
    h2 {font-size: 125%;}
    .p {text-align: left;}
    .e {background-color: #ccccff; font-weight: bold; color: #000000;}
    .h {background-color: #9999cc; font-weight: bold; color: #000000;}
    .v {background-color: #cccccc; color: #000000;}
    i {color: #666666; background-color: #cccccc;}
    img {float: right; border: 0px;}
    hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
    //--></style>
    <title>phpinfo()</title></head>
    <body><div class="center">
    <table border="0" cellpadding="3" width="600">
    <tr class="h"><td>
    [img]/info.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42[/img]<h1 class="p">PHP Version 4.3.7</h1>
    </td></tr>
    </table>
    
    <table border="0" cellpadding="3" width="600">
    <tr><td class="e">System </td><td class="v">Linux minasTirith.net 2.4.26-gentoo-r5 #1 Fri Jul 9 20:45:32 CEST 2004 i686 </td></tr>
    <tr><td class="e">Build Date </td><td class="v">Jul  5 2004 21:26:58 </td></tr>
    <tr><td class="e">Configure Command </td><td class="v"> './configure' '--prefix=/usr' '--host=i686-pc-linux-gnu'
     '--mandir/share/man' '--infodir=/usr/share/info' 
    '--datadir=/usr/share' '--sysconfdir=/etc' 
    '--localstatedir=/var/lib' '--with-apxs2=/usr/sbin/apxs2' 
    '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' 
    '--with-mhash=/usr' '--without-interbase' '--with-ming=/usr'
     '--with-swf=/usr' '--without-sybase' '--with-gdbm=/usr' 
    '--without-fdftk' '--with-java=/opt/blackdown-jdk-1.4.1' 
    '--without-mcal' '--without-unixODBC' '--without-pgsql' 
    '--without-snmp' '--with-xpm-dir=/usr/X11R6' '--without-gmp'
     '--without-mssql' '--with-pdflib=/usr' '--with-gd' 
    '--enable-gd-native-ttf' '--with-png=/usr' 
    '--with-png-dir=/usr' '--with-jpeg=/usr' 
    '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' 
    '--with-tiff-dir=/usr' '--with-mysql=/usr' 
    '--with-mysql-sock=/var/run/mysqld/mysqld.sock' 
    '--with-freetype-dir=/usr' '--with-ttf=/usr' 
    '--with-t1lib=/usr' '--with-gettext' 
    '--with-qtdom=/usr/qt/3' '--with-pspell=/usr' 
    '--with-openssl=/usr' '--with-imap=/usr' '--without-ldap' 
    '--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt' 
    '--without-kerberos' '--with-pam' '--disable-memory-limit'
     '--enable-ipv6' '--without-yaz' '--without-curl' 
    '--enable-dbx' '--with-imap-ssl' '--with-zlib=/usr' 
    '--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' 
    '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' 
    '--with-xml' '--enable-mbstring=all' '--enable-mbregex' 
    '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' 
    '--enable-pcntl' '--enable-bcmath' '--enable-calendar' 
    '--enable-dbase' '--enable-filepro' '--enable-ftp' 
    '--with-mime-magic=/usr/share/misc/file/magic.mime' 
    '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
    '--enable-sysvipc' '--with-iconv' '--enable-shmop' 
    '--enable-dio' '--enable-yp' '--without-ncurses' 
    '--without-readline' '--enable-inline-optimization' 
    '--enable-track-vars' '--enable-trans-sid' 
    '--enable-versioning' 
    '--with-config-file-path=/etc/php/apache2-php4' 
    '--without-pear' </td></tr>
    <tr><td class="e">Server API </td><td class="v">Apache 2.0 Handler </td></tr>
    <tr><td class="e">Virtual Directory Support </td><tss="v">disabled </td></tr>
    <tr><td class="e">Configuration File (php.ini) Path </td><td class="v">/etc/php/apache2-php4/php.ini </td></tr>
    <tr><td class="e">PHP API </td><td class="v">20020918 </td></tr>
    <tr><td class="e">PHP Extension </td><td class="v">20020429 </td>
    
    1005
    
    </tr>
    <tr><td class="e">Zend Extension </td><td class="v">20021010 </td></tr>
    <tr><td class="e">Debug Build </td><td class="v">no </td></tr>
    <tr><td class="e">Thread Safety </td><td class="v">disabled </td></tr>
    <tr><td class="e">Registered PHP Streams </td><td class="v">php, http, ftp, https, ftps, compress.bzip2, compress.zlib   </td></tr>
    </table>
    
    <table border="0" cellpadding="3" width="600">
    <tr class="v"><td>
    [img]/info.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42[/img]
    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    </td></tr>
    </table>
    
    <hr />
    <h1>PHP Credits</h1>
    <hr />
    <h1>Configuration</h1>
    <h2>PHP Core</h2>
    <table border="0" cellpadding="3" width="600">
    <tr class="h"><th>Directive</th><th>Local Value</th><th>Master Value</th></tr>
    <tr><td class="e">allow_call_time_pass_reference</td><td class="v">On</td><td class="v">On</td></tr>
    <tr><td class="e">allow_url_fopen</td><td class="v">Off</td><td class="v">Off</td></tr>
    <tr><td class="e">always_populate_raw_post_data</td><td class="v">Off</td><td class="v">Off</td></tr>
    <tr><td class="e">arg_separator.input</td><td class="v">&amp;</td><td class="v">&amp;</td></tr>
    <tr><td class="e">arg_separator.output</td><td class="v">&amp;</td><td class="v">&amp;</td></tr>
    <tr><td class="e">asp_tags</td><td class="v">Off</td><td class="v">Off</td></tr>
    <tr><td class="e">auto_append_file</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">auto_prepend_file</td><td class="v">no value</td><td class="v">no value</td></tr>
    td class="e">browscap</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">default_charset</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">default_mimetype</td><td class="v">text/html</td><td class="v">text/html</td></tr>
    <tr><td class="e">define_syslog_variables</td><td class="v">Off</td><td class="v">Off</td></tr>
    <tr><td class="e">disable_classes</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">disable_functions</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">display_errors</td><td class="v">On</td><td class="v">On</td></tr>
    <tr><td class="e">display_startup_errors</td><td class="v">Off</td><td class="v">Off</td></tr>
    <tr><td class="e">doc_root</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">docref_ext</td><td class="v">no value</td><td class="v">no value</tr>
    <tr><td class="e">docref_root</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">enable_dl</td><td class="v">On</td><td class="v">On</td></tr>
    <tr><td class="e">error_append_string</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">error_log</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">error_prepend_string</td><td class="v">no value</td><td class="v">no value</td></tr>
    <tr><td class="e">error_reporting</td><td class="v">2039</td><td class="v">2039</td></tr>
    <tr><td class="e">expose_php</td><td class="v">On</td><td class="v">On</td></tr>
    <tr><td class="e">extension_dir</td><td class="v">/usr/lib/php/extensions/no-debug-non-zts-20020429</td><td class="v">/usr/lib/php/extensions/no-debug-non-zts-20020429</td></tr>
    <tr><td class="e">file_uploads</td><td class="v">On</td><td class="v">On</td></tr>
    <tr><td class="e">gpc_order</td><td class="v">GPC</td><tds="v">GPC</td></tr>
    <tr><td class="e">highlight.bg</td><td class="v"><font style="color: #FFFFFF">#FFFFFF</font></td><td class="v"><font style="color: #FFFFFF">#FFFFFF</font></td></tr>
    <tr><td class="e">highlight.comment</td><td class="v"><font style="color: #FF8000">#FF8000</font>
    
    100d
    PoWered by:
    Gentoo 1.5.3 - Kernel 2.6.7
    Debian Sid - Kernel 2.6.7 - Bash 3.0
    Slackware current - Kernel 2.6.7

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.