[issue3243] Broken pipe with dhttpclient

xan bugs at mercurial.selenic.com
Fri Feb 3 07:37:54 CST 2012


New submission from xan <xancorreu at gmail.com>:

Hi,

I have 
ii  mercurial                 1.9.1-1ubuntu0.1 in ubuntu.

When I use hg serve and I run this code (in D):

/D 2.0
//gdmd-4.6 <fitxer> dhttpclient => surt el fitxer amb el mateix nom i .o
//Usa https://github.com/Bystroushaak/DHTTPClient

//ordenar alfabèticament:
import std.conv, std.stdio, std.stream, std.string;
import std.socket, std.socketstream;
import dhttpclient;

const string versió = "0.0.4";
const string nom = "aranya-d";
const string comanda = "./aranya3";

int main(string [] args)
{
    if (args.length < 2) {
        writeln(nom, " versió ", versió);
        writeln(comanda, " {<url1>, <url2>, ...}");
        return 0;
    }
    else {
        try {
            string[string] capcalera = dhttpclient.FFHeaders;
            HTTPClient navegador = new HTTPClient();
            navegador.setClientHeaders(capcalera);

            foreach (a; args[1..$]) {
                auto contingut = cast(ubyte[]) navegador.get(a);
                auto capçalera = navegador.getResponseHeaders();
                stdout.writeln("[URL: <", a, ">. Longitud: ",
contingut.length, ". Capçalera: ", capçalera, "]");
            }
        }
        catch (Exception e) {
            writeln("[Excepció: ", e, "]");
        }
        return 0;
    }
}



I get:

./aranya3 http://localhost:8000/
[URL: <http://localhost:8000/>. Longitud: 0. Capçalera:
["ETag":"1328178201.56", "Date":"Thu, 02 Feb 2012 18:35:17 GMT",
"Content-Type":"text/html; charset=UTF-8", "Connection":"close",
"StatusCode":"200 Script output follows", "Server":"BaseHTTP/0.3
Python/2.7.2+"]]


and in the server side:

xan at gerret:~/yottium$ hg serve
listening at http://localhost6.localdomain6:8000/ (bound to *:8000)
127.0.0.1 - - [02/Feb/2012 19:35:17] "GET / HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59073)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.py", line
48, in __init__
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kargs)
  File "/usr/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
---------------------------------------- 


I ask author of dhttpclient and he said me it was server issue.
Can you confirm it?

Thanks in advance,
Xan.

----------
messages: 18947
nosy: xan
priority: bug
status: unread
title: Broken pipe with dhttpclient

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3243>
____________________________________________________


More information about the Mercurial-devel mailing list