Skip to content

HTTP request with unwritable destination #33

@jamesjer

Description

@jamesjer

Accidentally stumbled across this while playing with AtlasRep:

gap> SingleHTTPRequest( "brauer.maths.qmul.ac.uk", 80, "GET", "/Atlas/spor/J1/mtx/J1G1-f2r20B0.m1", rec(), false, "/tmp/J1G1-f2r20B0.m1");
rec( body := "/tmp/J1G1-f2r20B0.m1", closed := true, 
  header := rec( ("accept-ranges") := "bytes", connection := "close", 
      ("content-length") := "441", 
      ("content-type") := "text/plain; charset=UTF-8", 
      date := "Tue, 28 Jul 2015 16:39:28 GMT", 
      etag := "\"1d45b1-1b9-34b9ec0c23140\"", 
      ("last-modified") := "Mon, 24 May 1999 18:22:21 GMT", 
      server := "Apache/2.2.3 (Scientific Linux)" ), protoversion := "1.1", 
  status := "OK", statuscode := 200 )
gap> SingleHTTPRequest( "brauer.maths.qmul.ac.uk", 80, "GET", "/Atlas/spor/J1/mtx/J1G1-f2r20B0.m1", rec(), false, "/unwritabledir/J1G1-f2r20B0.m1");
Error, Usage: IO_Write( f ,things ... ) with IsFile(f) called from
IO_Write( out, chunk ); called from
HTTPRequest( conn, method, uri, header, body, target ) called from
<function "SingleHTTPRequest">( <arguments> )
 called from read-eval loop at line 77 of _stdin_
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> Print(out);
fail

This also happens when trying to write to a directory that exists, but for which the user does not have write permission. Can something friendlier be done, like in the conn.sock = fail case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions