Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pike pike
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 104
    • Issues 104
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pikelang
  • pikepike
  • Issues
  • #6499
Closed
Open
Issue created Aug 31, 2012 by Peter Bortas@zinoOwner

Protocols.HTTP.Server.Request()->response_and_finish() should not modify m

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=6499

Reported by Per Cederqvist ceder@lysator.liu.se

I think it makes sense to use response_and_finish() like this:

constant forbidden = ([ "error":403, "data":"Forbidden" ]);

void handle_request( Protocols.HTTP.Server.Request id )
{
  if (some_condition( id ) )
     id->response_and_finish( forbidden );

// normal processing... }

This does not work reliably, however. The response_and_finish() method alters the "forbidden" mapping, so what one client does can affect the processing of future requests.

For example, if one client supplies a "Range: bytes=999-1020" header it will get a 416 response. The next forbidden request will also get the same 416 response (at least if it contains no "Range:" header).

I think response_and_finish() should be careful not to modify its argument. Failing that, the documentation should warn that m is modified and that code like the one above is broken.

I'm attaching a proposed fix.

Assignee
Assign to
Time tracking