Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to HttpServer #76

Merged
merged 11 commits into from
Apr 11, 2021
Merged

Migrate to HttpServer #76

merged 11 commits into from
Apr 11, 2021

Conversation

rr83019
Copy link
Contributor

@rr83019 rr83019 commented Apr 3, 2021

Solves #66

Signed-off-by: Rahul Rudragoudar <[email protected]>
Signed-off-by: Rahul Rudragoudar <[email protected]>
Signed-off-by: Rahul Rudragoudar <[email protected]>
Signed-off-by: Rahul Rudragoudar <[email protected]>
Signed-off-by: Rahul Rudragoudar <[email protected]>
@rr83019 rr83019 requested a review from hrj April 3, 2021 17:52
src/main/scala/lc/background/taskThread.scala Outdated Show resolved Hide resolved
src/main/scala/lc/core/captcha.scala Outdated Show resolved Hide resolved
src/main/scala/lc/core/captcha.scala Outdated Show resolved Hide resolved
src/main/scala/lc/core/captcha.scala Outdated Show resolved Hide resolved
Signed-off-by: Rahul Rudragoudar <[email protected]>
@hrj
Copy link
Contributor

hrj commented Apr 6, 2021

The following is a good replacement for fibry for now:

import com.sun.net.httpserver.HttpServer 
import java.net.InetSocketAddress

...

        val server = HttpServer.create(new InetSocketAddress(port), 32)                                                                                                  

        server.createContext("/", ex => {
            val response = "Hi there!";                                                                                                                                  
            val bytes = response.getBytes()
            try {
              ex.sendResponseHeaders(200, bytes.length);//response code and length
              val os = ex.getResponseBody();
              os.write(bytes);
              os.close();                                                                                                                                                
            } catch {                                                                                                                                                    
              case e: Exception =>
                println("exception: " + e)
            }
        });
        server.start()

Signed-off-by: Rahul Rudragoudar <[email protected]>
Signed-off-by: Rahul Rudragoudar <[email protected]>
Signed-off-by: Rahul Rudragoudar <[email protected]>
@rr83019 rr83019 requested a review from hrj April 11, 2021 10:40
Signed-off-by: Rahul Rudragoudar <[email protected]>
build.sbt Outdated Show resolved Hide resolved
Signed-off-by: Rahul Rudragoudar <[email protected]>
@hrj hrj changed the title Migrate to Fibry Migrate to HttpServer Apr 11, 2021
@hrj hrj merged commit 4612dfa into librecaptcha:master Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants